Skip to content

docs(plan): #1705 Phase 2 scope shape decisions and review findings in the implementation plan - #1862

Merged
dlrivada merged 5 commits into
mainfrom
docs/1705-phase2-plan-update
Oct 6, 2026
Merged

dlrivada merged 5 commits into
mainfrom
docs/1705-phase2-plan-update

Conversation

@dlrivada

@dlrivada dlrivada commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

This updates the #1705 implementation plan with the Phase 2 scope-shape decisions. The analysis is in PR #1849, kept as the design record and not merged. The maintainer decisions are in the #1705 comments of 2026-10-05.

Decisions applied

Decision What the plan now says
C1 The public IRequestContextScopeFactory is delegate-only: RunAsServiceAsync, RunAsPrincipalAsync, RunInboundAsync, RunRestoredAsync. RunAsBuiltInAsync lives on an internal interface. Ending a scope only invalidates its holder; the caller's context is restored by the async frame.
Q1 Immutable origin and kind on each scope holder. The refusals walk the holder chain, including ended holders. The setter keeps identity and origin and never clears. #1855 is absorbed.
Q2 PerTokenClaimTypes is configurable. auth_time is no longer excluded; nonce, at_hash and c_hash are added. A validator rejects excluding the subject, role, permission, amr and acr types.
Q3 An internal IdentityIssuer token, one identity per scope. Liveness is checked both in Resolve and when the identity is read. Issuer-less explicit identities are refused. The rule order is stated.
Q4 No TState overloads. Phase 3 adds a benchmark of the middleware and the circuit scope.

Review findings folded in, from the pr-reviewer and the adversarial review of PR #1849:

  • WebSocket upgrades and HubMetadata endpoints are skipped, under a connection-origin marker scope; TenantResolutionMiddleware applies the same skip.
  • The Blazor Left branch runs inside an anonymous masking scope.
  • Misordered routing is detected and logged at Critical (EventId 202).
  • The setter accepts a tenant change only while !IsDispatchInFlight.
  • The principal is cloned for IsSameAs.
  • Encina-owned long-lived loops start under SuppressFlow.
  • Cancellation semantics are stated.
  • The test-migration budget is complete.

A new "Review log (Phase 2 scope shape)" table maps every finding to its plan change.

Maintainer decisions: MQ-1 is (b) and (c) together, and MQ-2 is confirmed. D1-D4 come from the adversarial review of this PR. All of them are recorded in the #1705 comments of 2026-10-05 and in the plan.

The plan was self-reviewed with docs-reviewer: 2 majors and 7 minors, all fixed.

Refs #1705

Add amendment M6 (scope shape): a delegate-only IRequestContextScopeFactory
(RunAsServiceAsync, RunAsPrincipalAsync, RunInboundAsync, RunRestoredAsync),
holder origin and kind that survive invalidation (Q1), an identity- and
origin-preserving setter, issuer-stamped identities checked at Resolve and at
read time (Q3), per-token claim exclusion (Q2), the accessor-type validator,
and the Phase 3 connection-endpoint rules (WebSocket and HubMetadata skip,
connection-origin marker, Blazor masking scope, misordered routing logged).

Apply section 7 of the PR #1849 design record and both of its reviews,
rewrite the Phase 2 tasks and prompt, budget the test migrations, and add
the "Review log (Phase 2 scope shape)" with two open maintainer questions.

Refs #1705
Copilot AI balanced review requested due to automatic review settings October 5, 2026 19:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (1)
  • docs/plans/security-context-population-implementation-plan-1705.md
⚙️ Run configuration
  • Configuration used: Repository: dlrivada/Encina/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 06480287-c823-4973-a105-1723c7859068
📥 Commits

Reviewing files that changed from the base of the PR and between 54a89b7 and 152270e.

📒 Files selected for processing (1)
  • docs/plans/security-context-population-implementation-plan-1705.md

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…se 2 plan

MQ-1: skip Accept: text/event-stream requests under the connection marker and answer 500 to every request after the first detected UseEncinaContext-before-UseRouting misordering. MQ-2: the connection-origin marker is a confirmed decision.
@dlrivada

dlrivada commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Copilot AI balanced review requested due to automatic review settings October 5, 2026 19:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

No files to review.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

… to the #1705 plan

WebSocket upgrades are detected through IHttpUpgradeFeature and
IHttpExtendedConnectFeature, the misorder latch trips only on a hub
endpoint and lives on the middleware instance, every new context holder
inherits the facts of the current one, the tenant rule applies to every
accepted explicit context, user ids leave the authorization and EF Core
interceptor logs, and ordinary SSE endpoints opt in per event through a
public InboundRequestInfo builder. Records D1-D4, the EventIds 172-174,
the CS0051 decision, the test budget gaps and a review log; rewrites the
Phase 2 and Phase 3 prompts.
Copilot AI balanced review requested due to automatic review settings October 5, 2026 20:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

…#1705 plan

E1: the misordering latch needs an unchanged Request.Path; a changed path
logs Warning 203 and latches nothing. E2: an External restore ignores the
persisted tenant and accepts only a trusted tenant from dispatcher
configuration. E3: the connection skip applies only to GET requests that
accept text/event-stream. Also applies minors 3 and 5-9, the 174 service
name, and the Information log for application calls of RunInboundAsync.
Copilot AI balanced review requested due to automatic review settings October 5, 2026 21:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

@dlrivada

dlrivada commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

No files to review.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@dlrivada
dlrivada enabled auto-merge (squash) October 6, 2026 08:24
@dlrivada
dlrivada merged commit 24d5fe7 into main Oct 6, 2026
24 checks passed
@dlrivada
dlrivada deleted the docs/1705-phase2-plan-update branch October 6, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants