You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(docs-audit): admit only LEAF symbols into the route bridge (#9431)
A symbol derived from a CONTAINER declaration (class / interface / type / enum /
namespace / key-owning const) is a doc anchor but not a route's implementation, so
it no longer feeds the symbol -> route -> sdk bridge.
Measured on 9e2e682: a 27-line edit confined to `RestServer.probeMcpServeable`
(17 of them its doc comment, which attributes to the enclosing class) put
`RestServer` in the anchor set; two handlers ~1350 lines away call `RestServer.`
statics, and the bridge's bare-identifier handler scan read that qualifier as
"this handler implements the changed symbol". Result: `/book/:name/tree`,
`/:type/:name/layers`, `getBookTree` and `meta.getBookTree`. Two routes is under
MAX_ROUTES_PER_SYMBOL, so the cross-cutting cap never fired.
The `RestServer (symbol)` row is correct and survives untouched — only the bridge
hop is cut. Self-test 197 -> 212, pinned in both directions including a
counterfactual that the raw anchor set still selects the book route.
Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
check('parseRegistrarSource','the mechanism is real: a static-call QUALIFIER lands in the handler window','RestServer',true,!!bookIds?.has('RestServer'));
1371
+
check('parseRegistrarSource','and so does the handler\'s own implementation symbol','anyPermissionSetAudience',true,!!bookIds?.has('anyPermissionSetAudience'));
1372
+
1373
+
constdocCommentLine=3;// `* [#9120] Resolve the environment …` — inside the JSDoc
check('symbolAnchorsFromSource','a changed DOC COMMENT above a method still anchors on the enclosing class — the correct row that must survive',`line ${docCommentLine}`,true,anchorsAt(serverSource,docCommentLine).has('RestServer'));
1376
+
check('symbolAnchorsFromSource.bridgeable','but the CLASS is not a route\'s implementation, so it never enters the bridge',`line ${docCommentLine}`,false,bridgeableAt(serverSource,docCommentLine).has('RestServer'));
1377
+
check('symbolAnchorsFromSource.bridgeable','the METHOD is a leaf and stays bridgeable — the #9192 recall win is untouched',`line ${methodBodyLine}`,true,bridgeableAt(serverSource,methodBodyLine).has('probeMcpServeable'));
1378
+
check('symbolAnchorsFromSource','and the method is still the anchor for its own body (most-specific-wins)',`line ${methodBodyLine}`,true,anchorsAt(serverSource,methodBodyLine).has('probeMcpServeable'));
1379
+
1380
+
// End to end over the fixture: the doc-comment edit selects NO route, and the method
1381
+
// edit selects no route HERE either (it appears in no handler) — while `auditMetaItem`
1382
+
// above still selects its own. Absence proved by the same selection step the bridge
1383
+
// runs, not by asserting on a different quantity.
check('bridge','a doc-comment-only edit inside a class selects no route at all','tails',JSON.stringify([]),JSON.stringify(tailsSelectedBy(bridgeableAt(serverSource,docCommentLine),bookRegistrar)));
1390
+
check('bridge','the pre-fix behaviour, held as the counterfactual: the raw anchor set DID select the book route','tails',JSON.stringify(['/book/:name/tree']),JSON.stringify(tailsSelectedBy(anchorsAt(serverSource,docCommentLine),bookRegistrar)));
1391
+
check('bridge','a changed protocol METHOD still selects its own route','tails',JSON.stringify(['/:type/:name/audit']),JSON.stringify(tailsSelectedBy(bridgeableAt(protocolSource,9),registrar)));
1392
+
1393
+
// The container/leaf split on the two fixtures the derivation is already pinned against,
1394
+
// so the new flag is read off the same shapes the anchor cases use.
1395
+
constbridgeableCases=[
1396
+
[protocolSource,1,'ObjectStackProtocolImplementation',false,'a changed CLASS LINE anchors, but a class is a scope, not a route implementation'],
1397
+
[protocolSource,9,'auditMetaItem',true,'a changed method body is a leaf'],
1398
+
[protocolSource,16,'historyMetaItem',true,'a method reached past an intermediate block is still a leaf'],
1399
+
[schemaSource,1,'ObjectSchema',false,'a `const` object that owns its keys is a container'],
1400
+
[schemaSource,2,'controlled_by_parent',true,'a schema KEY is a leaf — it names one property, not a scope'],
1401
+
[schemaSource,6,'buildObject',true,'a function is a leaf: it holds locals, it does not own surface'],
0 commit comments