docs+test(client): correct the phantom-graph claim, verify graph behavior in e2e

The lib e2e harness now characterizes all three SPARQL graph shapes against the real
broker (24/24): (a) no-GRAPH anchored write round-trips; (b) an explicit anchored
GRAPH <plainNuri> ALSO resolves to the same repo (no phantom graph) — the earlier
'targets a phantom graph, does NOT round-trip' claim is FALSE on @ng-org/web
0.1.2-alpha.13; (c) an anchorless GRAPH ?g scan spans every named graph (O(wallet)
union, 32 graphs) — TRUE, re-verified.

Reconcile the comments accordingly: inbox.ts / store-registry.ts drop the false
phantom-graph justification (no-GRAPH stays as the canonical, always-safe shape — a
simplicity choice, not a round-trip necessity; re-verify via e2e if the broker
version changes). read-model.md keeps the anchorless-O(wallet) rationale (the real
reason reads are per-doc anchored) and appends a note distinguishing the variable
GRAPH ?g SCAN from a constant GRAPH <D> WRITE. No new absolute introduced.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sylvain Duchesne
2026-07-07 09:38:59 +02:00
parent 1c475d8c9f
commit 4a2569e243
4 changed files with 97 additions and 39 deletions
+8 -5
View File
@@ -422,11 +422,14 @@ export async function createEntityDoc(id: string, scope: Scope): Promise<Nuri> {
try {
await sparqlUpdate(
s.sessionId,
// NO explicit `GRAPH <…>` wrapper: the real broker stores each repo's
// triples under repo_graph_name(repo_id, overlay_id), not the plain NURI,
// so an INSERT into `GRAPH <plainNuri>` targets a phantom graph and does
// NOT round-trip. Write the anchored DEFAULT graph instead (the `indexDoc`
// anchor scopes it). entityNuri is a NURI stored as a literal → escapeLiteral.
// NO explicit `GRAPH <…>` wrapper: write the anchored DEFAULT graph (the
// `indexDoc` anchor scopes it) — the CANONICAL, always-safe shape the
// anchored default-graph read queries (readScopeIndex below, same as
// read-model.ts). Not a round-trip necessity on the current broker: the e2e
// harness (`packages/client/e2e/`) verified an anchored `GRAPH <plainNuri>`
// write ALSO round-trips here (same repo graph, no phantom graph); no-GRAPH
// is kept as a simplicity/safety convention. entityNuri is a NURI stored as
// a literal → escapeLiteral.
`INSERT DATA { <${INDEX_SUBJECT}> <${P.contains}> "${escapeLiteral(entityNuri)}" }`,
indexDoc,
);