Context
Follow-up from PR #1780 (GH#1778). The PR added parseContextGraphAssertionUri(subject) in packages/core/src/constants.ts, an inverse of contextGraphAssertionUri(...).
Because a context-graph ID may itself contain / (wallet-scoped IDs like 0xabc…/project, permitted by validateContextGraphId) and an optional sub-graph name is also slash-joined, the inverse cannot recover (contextGraphId, subGraphName) from the subject alone. The helper therefore returns a single conflated scope field, and every consumer must compare scope against subGraphName ? contextGraphId + "/" + subGraphName : contextGraphId themselves. The parser is correct (right-anchored on /assertion/<addr>/<name>), but the API name implies a clean inverse that does not exist, and it leaks the grammar into callers.
Suggested refinement (non-blocking, maintainability)
Add a matcher that keeps the unavoidable ambiguity local to core:
matchContextGraphAssertionUri(
subject: string,
expected: { contextGraphId: string; subGraphName?: string; name: string },
): { agentAddress: string } | undefined
It returns the author address only when the subject matches the full expected coordinate. This collapses contextGraphAssertionQueryBounds + parse-and-compare into one canonical helper and removes the ambiguous scope from the consumer-facing surface.
Pointers
packages/core/src/constants.ts — parseContextGraphAssertionUri, contextGraphAssertionQueryBounds, contextGraphAssertionUri
- Consumers:
packages/agent/src/finalized-assertion-author.ts, packages/agent/src/sync/durable-integrity.ts
Filed as a non-blocking maintainability follow-up from PR #1780 review.
Context
Follow-up from PR #1780 (GH#1778). The PR added
parseContextGraphAssertionUri(subject)inpackages/core/src/constants.ts, an inverse ofcontextGraphAssertionUri(...).Because a context-graph ID may itself contain
/(wallet-scoped IDs like0xabc…/project, permitted byvalidateContextGraphId) and an optional sub-graph name is also slash-joined, the inverse cannot recover(contextGraphId, subGraphName)from the subject alone. The helper therefore returns a single conflatedscopefield, and every consumer must comparescopeagainstsubGraphName ? contextGraphId + "/" + subGraphName : contextGraphIdthemselves. The parser is correct (right-anchored on/assertion/<addr>/<name>), but the API name implies a clean inverse that does not exist, and it leaks the grammar into callers.Suggested refinement (non-blocking, maintainability)
Add a matcher that keeps the unavoidable ambiguity local to core:
It returns the author address only when the subject matches the full expected coordinate. This collapses
contextGraphAssertionQueryBounds+ parse-and-compare into one canonical helper and removes the ambiguousscopefrom the consumer-facing surface.Pointers
packages/core/src/constants.ts—parseContextGraphAssertionUri,contextGraphAssertionQueryBounds,contextGraphAssertionUripackages/agent/src/finalized-assertion-author.ts,packages/agent/src/sync/durable-integrity.tsFiled as a non-blocking maintainability follow-up from PR #1780 review.