Skip to content

fix(node-ui): SubGraphBar "All" pill now matches layer tab badge#725

Merged
Jurij89 merged 2 commits into
mainfrom
fix/subgraphbar-all-pill-count
May 27, 2026
Merged

fix(node-ui): SubGraphBar "All" pill now matches layer tab badge#725
Jurij89 merged 2 commits into
mainfrom
fix/subgraphbar-all-pill-count

Conversation

@Jurij89
Copy link
Copy Markdown
Contributor

@Jurij89 Jurij89 commented May 27, 2026

Summary

  • The SubGraphBar's All pill silently undercounted SWM root-bucket entities (graph URI <cg>/_shared_memory). User-visible repro: layer tab badge 27 but All 25 on the SWM tab of a context graph with two root-bucket SWM entities.
  • Root cause: entityScopedAllTotal skipped entities with an empty subGraphs set, but whether the set is empty depends on a layer-asymmetric parse in subGraphOf (filters _-prefixed first segments). WM root-bucket URIs leak through (<cg>/assertion/... → slug 'assertion') and were counted by accident; SWM root-bucket URIs (<cg>/_shared_memory) were filtered and silently dropped.
  • Fix: drop the subGraphs.size === 0 skip so All reflects every layer-resident entity, matching the tab badge. Per-chip counts are untouched — they only iterate real named sub-graphs from fetchSubGraphs, so removing the skip doesn't surface phantom chips. This is a pre-existing semantic bug, not a regression from fix(node-ui): WM Assertions tab surfaces sub-graph assertions (#706) #710.

Related

Files changed

File What
packages/node-ui/src/ui/components/SubGraphBar.tsx Remove the empty-subGraphs skip in entityScopedAllTotal; expand the inline doc to explain the new semantic and the underscore-filter asymmetry that drove the bug.
packages/node-ui/test/sub-graph-bar-layer-scope.test.ts New vitest case pinning that root-bucket entities (empty subGraphs set) count toward the All umbrella. Existing 6 cases stay green.

Test plan

  • pnpm --filter @origintrail-official/dkg-node-ui exec tsc --noEmit — clean
  • pnpm --filter @origintrail-official/dkg-node-ui exec vitest run test/sub-graph-bar-layer-scope.test.ts — 7/7 pass (new case + 6 existing R2-5 / Issue B regressions)
  • Live walk on the user's ui-refresh CG: SWM tab All reads 27 (matches tab badge); epcis-supply-chain reads 24 unchanged. WM tab All still reads 12. Root-only CG (no sub-graphs): bar still renders nothing.

Out of scope (intentional follow-ups)

  • subGraphOf parse asymmetry — the function still returns 'assertion' for WM root-bucket URIs. Cosmetic (no chip renders for it); a hygiene cleanup for a future touch.
  • meta membership leaking into entityScopedCounts.get('meta') — invisible today because the meta chip is filtered at the display merge.

🤖 Generated with Claude Code

The All pill skipped any entity whose `subGraphs` set was empty,
which silently undercounted root-bucket SWM entities (graph URI
`<cg>/_shared_memory`) — their first path segment starts with `_`
and `subGraphOf` filters it out, leaving an empty set. WM masked
the same bug by accident because root-bucket WM URIs start with
`assertion` (non-underscore) which leaks through as a slug.

Drop the size === 0 skip so All equals the layer tab badge in
both layers. Per-chip counts are unaffected (they still only
iterate real named sub-graphs). Pin the new behavior with a
fresh vitest case alongside the existing R2-5 / Issue B
regressions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread packages/node-ui/src/ui/components/SubGraphBar.tsx
The previous commit dropped the `subGraphs.size === 0` skip
unconditionally, which inflated the "All" pill in layer-agnostic
mode too (sub-graph page — ProjectView passes entities without
`layer`). In that mode "All" is the umbrella over the named chips
below it, so root-bucket entities that no chip can drill into
inflate the total past anything the user can reach.

Restrict the new inclusion to layer mode (the WM/SWM/VM pages,
where "All" must match the layer tab badge). Pin both semantics
with an explicit test for each.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex review completed — no issues found.

@Jurij89 Jurij89 merged commit 76b86b9 into main May 27, 2026
36 checks passed
matic031 pushed a commit to KilianTrunk/dkg that referenced this pull request Jun 2, 2026
Brings forward 3 node-ui UI bug fixes that landed on main but hadn't
yet flowed into the release branch:

  - 902a618 fix(node-ui): entity tripleCount matches Triples tab
    (count type + multi-value + incoming) (OriginTrail#728)
  - 76b86b9 fix(node-ui): SubGraphBar "All" pill now matches layer
    tab badge (OriginTrail#725)
  - 387b0e0 fix(node-ui): WM Assertions tab surfaces sub-graph
    assertions (OriginTrail#706) (OriginTrail#710)

All three touch only node-ui files (UI + UI tests); no runtime / chain
/ publisher / agent surface area touched. Auto-merge with rc.12 was
clean — one file (`packages/node-ui/src/ui/api.ts`) merged
automatically with no conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant