Skip to content

Signpost src/auth and disambiguate two colliding type names#478

Merged
alistair3149 merged 3 commits into
masterfrom
auth-legibility
Jul 23, 2026
Merged

Signpost src/auth and disambiguate two colliding type names#478
alistair3149 merged 3 commits into
masterfrom
auth-legibility

Conversation

@alistair3149

@alistair3149 alistair3149 commented Jul 23, 2026

Copy link
Copy Markdown
Member

Pure docs + renames, no behaviour change.

README

New src/auth/README.md maps the subsystem on its central distinction, which is easy to miss when reading the files cold:

  • src/auth/ (top level) — this server acting as an OAuth client to a wiki (discover, log in, acquire/refresh/store a token).
  • src/auth/authorizationServer/ — this server acting as an OAuth authorization server: the hosted proxy that mints its own per-user tokens and speaks the full authorize / consent / callback / token / registration surface.

Each file gets a one-line role. AGENTS.md gains a src/auth repo-layout entry pointing to it; while there, its transport line drops the request context that #476 moved to runtime/, and the runtime line gains it.

Renames

Two names read as collisions:

  • AsMetadataUpstreamAsMetadata (metadata.ts). It is an upstream wiki's AS metadata, distinct from authorizationServer/asMetadata.ts's AsMetadataDoc (the metadata this server serves about itself as the proxy). "upstream" matches the vocabulary already used for the wiki throughout the proxy code. A comment now states the contrast.
  • WikiSlice (local, in proxyConfig.ts) → ProxyWikiInput. There were two interface WikiSlice — the exported one in metadata.ts (client discovery) and a separate local one in proxyConfig.ts (proxy resolution). Different shape, different concern, and they never met at an import, so it was reader-confusion rather than a type bug. Renaming the local one leaves the exported WikiSlice as the only type by that name.

Testing

Renames are reference-complete (a missed site fails tsc). Verified: tsc, 1572 tests, oxlint, oxfmt, build — all green. The AsMetadata → UpstreamAsMetadata rewrite used a word-boundary match so it could not touch AsMetadataDoc / buildAsMetadata; confirmed no mangling.

Pure-internal refactor + docs: no tool surface or user-visible behaviour change, so no top-level README / CHANGELOG entry per repo policy.

🤖 Generated with Claude Code

alistair3149 and others added 3 commits July 23, 2026 10:44
Add src/auth/README.md mapping the subsystem on its central distinction: the
top level is this server acting as an OAuth client to a wiki, while
authorizationServer/ is this server acting as an authorization server (the
hosted proxy). AGENTS.md gains a src/auth entry pointing to it; its transport
line drops the now-moved request context and the runtime line gains it.

Rename two names that read as collisions:
- metadata.ts AsMetadata -> UpstreamAsMetadata. It is an upstream wiki's AS
  metadata, distinct from authorizationServer/asMetadata.ts's AsMetadataDoc (the
  metadata this server serves about itself). A comment now states the contrast.
- proxyConfig.ts's local WikiSlice -> ProxyWikiInput, so the exported WikiSlice
  in metadata.ts is the only type by that name. Different shape, different
  concern; the two never met at an import.

Pure rename plus docs; no behaviour change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Review caught one-liners that pointed a reader at the wrong file:
- consent.ts renders pages and handles cookies; the consent cookie is signed and
  verified in jwt.ts, so credit jwt.ts for it.
- redirectPolicy.ts holds a redirect-URI allowlist, not a host allowlist; the
  CIMD host allowlist is in cimd.ts.
- pageShell.ts also renders the stdio loopback login pages, so it is shared
  between both roles, not just the proxy consent flow.
- paths.ts resolves two files (client credentials and the proxy store), not a
  single credential directory.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
oxfmt normalizes markdown emphasis to underscores; the prior commit's `*host*`
tripped fmt:check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alistair3149
alistair3149 marked this pull request as ready for review July 23, 2026 15:01
@alistair3149
alistair3149 merged commit 6ffc175 into master Jul 23, 2026
1 check passed
@alistair3149
alistair3149 deleted the auth-legibility branch July 23, 2026 15:01
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.

1 participant