docs(ax): entry 42 — the dispatcher picks a shape, not just an identity - #1212
Open
lilyshen0722 wants to merge 1 commit into
Open
docs(ax): entry 42 — the dispatcher picks a shape, not just an identity#1212lilyshen0722 wants to merge 1 commit into
lilyshen0722 wants to merge 1 commit into
Conversation
@sprint-review's amendment: `middleware/auth.ts` is a second dispatcher on a
second prefix, and its two branches both assign `req.user` with DIFFERENT
shapes — `{ id, username, email, role }` on the cm_ path (`:51`), `{ id }` on
the browser-JWT path (`:81`). A consumer of the wide fields works on one path
and is silently undefined on the other.
Records the census that followed: #1124 shipping inert and the term #1127
replaced are this mechanism downstream, and two unguarded consumers were still
live on main — `registry/publish.ts` (#1211) and `github.ts:146`.
Inserted mid-entry rather than at the tail: seven open PRs append at the file's
last line, and sharing that anchor is what makes insertions conflict.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@sprint-review's amendment to entry 42, plus the census it prompted.
Entry 42 documented the
/api/v1/tasksdispatcher choosing betweenreq.userandreq.agentUser. Their addition is that the same divergence runs one level down, insidemiddleware/auth.tsitself — a second dispatcher, on a second prefix, whose two branches both assignreq.user, with different shapes:So a consumer reading
req.user.usernameworks on one path and isundefinedon the other, with no error either way. Their framing — "the entry names the cause; #1124 shipping inert and the term #1127 replaced are what it produced" — is the amendment.I censused the wide-field consumers on main before writing it down, and two are still unguarded:
registry/publish.tspersistedpublisher.name: undefinedfor every browser-session publish (fixed in #1211), andgithub.ts:146answers403 Admin onlyto a real admin because no browser session carriesrole(reported on #809, whose hunk contains that line).agentProfile.ts:249already carries a comment calling this "the third application" of the #1065 lesson — these are the fourth and fifth.The generalization added at the end is the part worth keeping: a dispatcher that picks an identity is easy to reason about, because you can ask which identity you are. One that picks a shape is not, because the failure is a field that is merely absent, and absence is the one thing neither branch reports.
Placement
Inserted mid-entry, after the "different request shapes" paragraph, rather than at the end of entry 42 — which is the file's last line and the anchor seven open PRs all append at. Verified: clean against #1122, #1132, #1142, #1143, #1171, #1202, #1204. Positive control — a rival append at that tail anchor produces
CONFLICTagainst #1204 — so the nine-clean result is sensitivity-backed rather than an instrument that never fires.🤖 Generated with Claude Code