Skip to content

documentIri pinning causes frontmatter rootEntity override to disagree with promote partitioning #122

@Jurij89

Description

@Jurij89

Summary

The import-file route handler in packages/cli/src/daemon.ts pins documentIri: assertionUri when calling extractFromMarkdown. This causes all structural content triples (frontmatter properties, H1→schema:name, wikilinks, hashtags, dataview fields, section headings) to be emitted with the assertion UAL as their subject — regardless of whether the user supplied a frontmatter rootEntity override.

The result is a semantic mismatch: _meta row 14 (<assertionUal> dkg:rootEntity <urn:note:parent>) claims the assertion's root entity is urn:note:parent, but the actual content triples partition under <assertionUri> when assertionPromote runs — NOT under <urn:note:parent>. A SPARQL consumer querying "what content belongs to urn:note:parent?" finds nothing in SWM for assertions that were supposed to be about it.

This was flagged by Codex Review as Bug 10 on PR #121 (see #121 (comment) or whichever review link applies). It was deliberately deferred out of the PR #121 Round 4 scope because it's architectural — fixing it requires either:

  1. Extractor rewrites content-triple subjects to resolvedRootEntity when frontmatter rootEntity is set. ~20 LOC in extractFromMarkdown, but has semantic hazards: if two assertions both claim rootEntity: urn:note:parent, they'd both write content triples on <urn:note:parent>, re-introducing the cross-assertion contention problem PR feat: source-file linkage triples + devnet hardening (chain onto PR #120) #121 Bug 8 just solved via the assertionPromote filter.

  2. Remove the rootEntity override feature entirely. Drop frontmatter rootEntity precedence from buildSourceFileLinkage. Row 3/14 always = reflexive. Deletes a spec-defined feature (§19.10.1:508) but sidesteps the semantic question.

  3. Document the current behavior as "rootEntity is a metadata HINT, not a content-retargeting". Row 14 in _meta is an annotation/backlink, not an authoritative partition statement. Zero code change beyond comments.

The Round 4 consensus (parked as a follow-up, not a decision) was that 10C — documenting the current behavior — is the smallest defensible path, and that 10A's semantic hazards around cross-assertion subject contention need a wider architectural discussion before we commit to a retargeting pipeline.

Context

Acceptance criteria

Whichever option is chosen, the outcome should be that a user who sets frontmatter rootEntity: urn:note:parent on a document and then imports it gets either:

  • A consistent graph where content-triple subjects actually match _meta row 14 (Option 10A), or
  • Clear documentation that rootEntity is a hint, not a retargeting directive (Option 10C), or
  • A spec update that removes the promise in §19.10.1:508 (Option 10B).

Not blocking

This is tracking a known-deferred issue; the current PR #121 ships without fixing it. Users who hit the mismatch today can work around it by leaving rootEntity unset (the reflexive default is correct and consistent), or by accepting that the _meta annotation is informational.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions