Skip to content

Node UI assertions tab ignores sub-graph-scoped WM assertions #606

@Zigoljube

Description

@Zigoljube

Bug Description

The Node UI Assertions tab can show "No assertions in this layer" for a project even when that project has many Working Memory assertions, if those assertions were created under a sub-graph.

Observed with the local project:

  • Context graph: dkg-v10-codebase-graphify / "DKG v10 Codebase - Graphify"
  • Sub-graph: code
  • UI symptom: Working Memory → Assertions tab shows No assertions in this layer
  • Actual data: 129 WM assertion graphs exist under the code sub-graph, with 713,702 triples

Environment

  • Node version: 10.0.0-rc.9
  • Commit: e0f6b543
  • Store backend: oxigraph-worker
  • Node UI source inspected at: packages/node-ui/src/ui/api.ts and packages/node-ui/src/ui/views/project/components.tsx

Evidence

The assertion data exists under sub-graph-scoped assertion graph IRIs:

SELECT (COUNT(DISTINCT ?g) AS ?assertions) (COUNT(*) AS ?triples) WHERE {
  GRAPH ?g { ?s ?p ?o }
  FILTER(STRSTARTS(STR(?g), "did:dkg:context-graph:dkg-v10-codebase-graphify/code/assertion/"))
}

Result:

assertions = 129
triples    = 713702

The root assertion prefix has no assertion graphs:

SELECT (COUNT(DISTINCT ?g) AS ?assertions) (COUNT(*) AS ?triples) WHERE {
  GRAPH ?g { ?s ?p ?o }
  FILTER(STRSTARTS(STR(?g), "did:dkg:context-graph:dkg-v10-codebase-graphify/assertion/"))
}

Result:

assertions = 0
triples    = 0

The lifecycle metadata does know about the assertions and encodes the sub-graph in the assertion URN:

SELECT ?assertion ?name ?state ?layer WHERE {
  GRAPH <did:dkg:context-graph:dkg-v10-codebase-graphify/_meta> {
    ?assertion a <http://dkg.io/ontology/Assertion> ;
      <http://dkg.io/ontology/assertionName> ?name ;
      <http://dkg.io/ontology/state> ?state ;
      <http://dkg.io/ontology/memoryLayer> ?layer .
  }
}
LIMIT 5

Sample result:

urn:dkg:assertion:dkg-v10-codebase-graphify:code:0xccAdb7C905eA4fd1b594A7536C7DE8dB2CB69c03:graphify-e0f6b543-cross-links-001
name  = "graphify-e0f6b543-cross-links-001"
state = "created"
layer = "WM"

Probable Root Cause

packages/node-ui/src/ui/api.tslistAssertions(contextGraphId, layer) handles WM assertions by running:

const sparql = `SELECT DISTINCT ?g (COUNT(?s) AS ?cnt) WHERE { GRAPH ?g { ?s ?p ?o } } GROUP BY ?g`;
const prefix = `did:dkg:context-graph:${contextGraphId}/assertion/`;
...
if (!g || !g.startsWith(prefix)) continue;

That prefix only matches root assertion graph IRIs:

did:dkg:context-graph:<cg>/assertion/<agent>/<name>

It misses sub-graph assertion graph IRIs:

did:dkg:context-graph:<cg>/<subGraph>/assertion/<agent>/<name>

The UI then passes the empty result to AssertionsList in packages/node-ui/src/ui/views/project/components.tsx, which renders:

<div className="v10-layer-state">No assertions in this layer</div>

Why this matters

Large/project-organized imports are naturally partitioned into sub-graphs. The current assertion listing makes those WM assertions invisible in the UI, even though:

  • Entities/triples exist in the graph
  • Lifecycle metadata exists
  • Assertion names are recoverable
  • The user needs the assertions tab to inspect/promote/import lifecycle state

Also, promoteAssertion(contextGraphId, assertionName) currently does not pass a subGraphName, so simply listing sub-graph assertions may not be sufficient: promote/publish actions from the assertions UI likely need to carry the sub-graph scope as well.

Expected Behavior

The Node UI should surface assertions stored in sub-graphs, either:

  1. In the top-level layer Assertions tab, grouped/labeled by sub-graph, or
  2. In a sub-graph-specific assertions tab/page, scoped to the selected sub-graph.

For sub-graph assertions, any actions such as promote should pass the correct subGraphName to the API.

Actual Behavior

Top-level WM Assertions tab shows:

No assertions in this layer

while 129 WM assertion graphs exist under did:dkg:context-graph:dkg-v10-codebase-graphify/code/assertion/....

Suggested Fix Direction

  • Extend AssertionInfo with optional subGraphName.
  • Update listAssertions() WM path to enumerate both:
    • did:dkg:context-graph:<cg>/assertion/...
    • did:dkg:context-graph:<cg>/<subGraph>/assertion/...
  • Or prefer _meta lifecycle records for WM assertion enumeration, since they already include sub-graph-scoped assertion URNs.
  • Update promoteAssertion() / UI handlers to pass subGraphName when acting on sub-graph assertions.
  • Consider adding an Assertions tab inside SubGraphDetailView so the user can inspect/promote assertions for a selected sub-graph directly.

Reproduction Shape

  1. Create a context graph.
  2. Create/register a sub-graph, e.g. code.
  3. Create/write WM assertions with subGraphName: "code".
  4. Open the project in Node UI.
  5. Navigate to Working Memory → Assertions tab.
  6. Observe No assertions in this layer, despite assertion graph data under <cg>/code/assertion/....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions