Skip to content

Shared Markdown fence/link readers, strict newestVersion, middleware Vary merging, package contributor guides (#1118, #1119, #1120, #1121) - #1122

Merged
jimhoyd merged 9 commits into
mainfrom
claude/issues-1118-1121
Oct 1, 2026
Merged

jimhoyd merged 9 commits into
mainfrom
claude/issues-1118-1121

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

#1118: one Markdown fence reader and titled-link discovery

  • Shared fence reader: the new packages/core/src/markdown-fences.ts has no dependencies and follows CommonMark's fence rules. All seven repo readers now use it:
    • docs-search headingsOf
    • check-local-links markdownAnchors
    • check-doc-yaml yamlBlocks
    • check-guidance-claims
    • build-llms-full's demoteHeadings and pinDocsMentions
    • package-audit's packedLinkProblems
  • Link scanning: markdownLinkTargets replaces the old regexes. It finds titled links, <angle> destinations, balanced and escaped parentheses, an image wrapped in a link, and reference definitions indented 0–3 spaces. It skips GitHub footnotes.
  • The issue's two probes now pass: a titled dead link fails the check, and a 4-space "closing" fence gives the same result in every reader.
  • Effect on the real repo: every reader produces the same output as before. Link discovery finds one more target, an absolute link. No dead links were found.

#1119: newestVersion

  • Strict SemVer 2.0.0: an owned comparator. Numeric identifiers compare exactly as digit strings, with no Number conversion. Invalid versions are never chosen.
  • Why not semver: it has the same precision bug (semver.compare calls 1.0.0-9007199254740993 and …992 equal) and would add 101 KB as a runtime dependency.
  • Outdated report: it now says when the registry returns no valid version.

#1120: middleware no longer overwrites Vary

  • Which files: cors (in both the recipe and the cookbook), plus negotiate, bucket and locale, which had the same bug.
  • How: each merges its token into the existing Vary, ignoring case, keeping * as *, and adding no duplicates. An immutable downstream response is copied before its headers change.
  • Generated copies: regenerated with docs:cookbook-index.

#1121: package contributor guides match the code

  • mcp: AGENTS.md, llms.txt and the authoring description now say the official SDK owns the protocol. They no longer mention cursor pagination, and the extension is stateless. Streaming: native on Node, delegated on Vercel, refused on AWS.
  • store: AGENTS.md now describes the scoped access contract (shared vs owner collections, readers, transitions) and drops the leftover ui notes. auth's guide was already correct.
  • Drift check: check-agent-facts now rejects prose naming package folders that don't exist, wrong streaming targets, and claims that the mcp extension owns the protocol or paginates.

Verification

  • New and extended tests:
    • test/doc-checks.test.ts: link-scanner units, an end-to-end checker run, and an 11-case fence fixture run through every reader.
    • test/addon-files.test.ts: fixed cases, all 40,320 orderings of a mixed set, and 500 generated sets cross-checked against semver.rsort.
    • test/middleware-vary.test.ts: 54 cases; 28 of them fail on the old code.
    • test/agent-facts.test.ts.
  • Package audit tests: test/package-audit.test.ts passes 7/7 on the shared readers. The real package audit passes.
  • Each agent's branch: npm run verify exited 0.
  • The combined branch: a full local verify was still running when this PR was opened. CI is the gate.

Closes #1118
Closes #1119
Closes #1120
Closes #1121

🤖 Generated with Claude Code

jimhoyd and others added 9 commits October 1, 2026 08:05
…ry (#1118)

Link discovery in check-local-links.ts read only `[x](target)`, so a dead
link with a title, an angle-bracket destination or balanced parentheses
escaped checking. markdownLinkTargets now reads inline links and images
as CommonMark does (titles in "", '' or (), <...> destinations, balanced
and escaped parentheses, a link around an image) and reference
definitions (not GitHub footnotes). Links inside fenced code are code.

The repository's Markdown readers each kept their own fence rules and
disagreed: a four-space "closing" run closed the fence for the link
checker but not for docs search. packages/core/src/markdown-fences.ts
holds the CommonMark rules docs search already followed (#826), and
headingsOf, markdownAnchors, yamlBlocks, withoutFences, the
guidance-claims rule-4 fence exemption and build-llms-full's
demoteHeadings/pinDocsMentions now all use it. Scripts import core;
core imports nothing from scripts.

Over every tracked Markdown file the anchors, YAML blocks,
fence-stripped text and docs-search headings are identical before and
after; the only newly discovered link is the CI workflow around the
README badge, which resolves. No dead links found.

Refs #1118, #826

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mplementation (#1121)

packages/mcp/AGENTS.md said the package owns JSON-RPC 2.0 framing, version
negotiation, request ids and cursor pagination; src/mcp.ts serves every request
through the official SDK's Server and createMcpHandler, and its lists return
every declared entry. It now separates the SDK's protocol from URLCode's
declarative mapping, admission and safe result/error behavior, describes the
stateless server (no sessions, GET stream or replay) and states streaming per
core's streamingTargets: native self-hosted, delegated Vercel (adapter support,
not provider deployment proof), refused AWS. The same stale claims are fixed
in packages/mcp/llms.txt (which also described sessions, a GET stream and
Vercel as refused, and an Origin rule without alias origins) and in the mcp
authoring description (regenerated into urlcode.json and README.md).

packages/store/AGENTS.md replaced its blanket "every caller can read and change
every record" with the scoped contract: shared vs owned collections, readers
mounts and membership, and the transition/transfer/create gates, with their
code and tests; the issue-routing line no longer names extension page styling
(the ui package is gone).

scripts/check-agent-facts.ts derives three more facts (the workspace packages
under packages/, core's streamingTargets, and the mcp extension's SDK serving
path and lack of pagination) and rejects prose that contradicts them, so the
old package sentences now fail check:docs; test/agent-facts.test.ts plants
each shipped sentence and the current wording.

Refs #1121, #1091

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d ignores invalid versions (#1119)

The owned comparator converted numeric identifiers to Number, so
1.0.0-9007199254740993 and 1.0.0-9007199254740992 tied, and its loose
pattern accepted leading-zero identifiers and empty build metadata.
newestVersion now validates strict SemVer 2.0.0, compares numeric
identifiers by digit count then digits, ignores build metadata for
precedence (equal-precedence ties resolve to the greatest string, so the
answer is order-independent) and never chooses an invalid version;
`outdated` reports a registry answer with no valid version.

Kept owned rather than promoting semver to a runtime dependency: semver
7.8.5 compares numeric identifiers as Numbers too (compare returns 0 for
the issue's pair), and accepts a leading `v`.

Refs #1119

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#1120)

Both standalone CORS middleware modules replaced the downstream response's
Vary with Origin, dropping tokens the producer set. They now merge Origin
case-insensitively, keep other tokens in order, do not duplicate an existing
Origin, and leave Vary: * as *, on allowed and disallowed origins alike. A
downstream Response with immutable headers is copied instead of throwing.
The recipes/middleware copy is regenerated from the cookbook.

Adds a composition regression for all three modules. Refs #1120.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r and link scanner

packedLinkProblems kept its own fence reader (trimmed closing fence, any indent)
and the old inline/reference link regexes, the last Markdown reader #1118 had not
moved. It now uses packages/core/src/markdown-fences.ts fenceLines and
check-local-links' markdownLinkTargets, so titled, angle-bracket and
balanced-paren links in shipped documents are checked too. Code spans are masked
rather than removed so a line that starts with one is not read as a reference
definition. Refs #1118.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Vary (#1120)

The cookbook's negotiate, bucket and locale middleware replaced the
downstream response's Vary with accept, cookie and accept-language, the
same overwrite the CORS modules had. Each now merges its token
case-insensitively through a local helper, keeps other tokens in order,
does not duplicate an existing token, leaves Vary: * as *, and copies a
downstream response whose headers are immutable. The recipes/middleware
copies are regenerated from the cookbook.

The composition regression is renamed middleware-vary.test.ts and covers
all seven modules. Refs #1120.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) October 1, 2026 13:45
@jimhoyd
jimhoyd merged commit fadf3cb into main Oct 1, 2026
49 of 51 checks passed
@jimhoyd
jimhoyd deleted the claude/issues-1118-1121 branch October 1, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant