Skip to content

fix(#5915 J2 slice-2): segment-set-aware dashboard existence/freshness gates#5925

Merged
cajasmota merged 5 commits into
mainfrom
worktree-agent-aa257c9a83fe6b661
Jul 22, 2026
Merged

fix(#5915 J2 slice-2): segment-set-aware dashboard existence/freshness gates#5925
cajasmota merged 5 commits into
mainfrom
worktree-agent-aa257c9a83fe6b661

Conversation

@cajasmota

Copy link
Copy Markdown
Owner

What

The last flat-graph.fb-only existence/freshness gates — 5 dashboard sites — made segment-set-aware via graph.CurrentGraphDescriptor (existence) / graph.CurrentGraphMtime (freshness), preserving graph.json fallbacks and single-file parity. Completes the #5915 J2 gate sweep. Latent until GRAFEL_STREAM_SEGMENTS on; needed before the flip.

Sites

  • store.go aggregateGroupStats — both fallback mtime branches.
  • ref_helper.go knownRefsForGroup + allRefsForRepo — existence (json fallback kept).
  • graphstate.go statGraphMtime — freshness (NOT the :620-674 merge-hook/reader-open).
  • handlers_v2_refs.go handleV2GroupRefs + handlers_ref_endpoints.go handleGroupRefs — existence+freshness.

Verification (independent adversarial review — APPROVE)

  • Each of the 5 gates proven load-bearing (per-site revert → its segment-set test RED).
  • Single-file mtime byte-parity: nanosecond-identical to old os.Stat(CurrentGraphPath) (1s drift → RED).
  • graph.json fallback proven preserved (removing it → json-only TestHandleGroupRefs_OK / TestKnownRefsForGroup_GenOnlyRefIncluded RED).
  • Absent parity; Windows teardown via quiesceGraphCache.

Follow-up (out of scope → #5924)

graphstate.go:674 (dr.Reader open) + v2_group_settings.go:267 repoGitMeta open the flat path to build a reader / read git header fields — segment-sets degrade (Doc fallback / zero git-metadata). Tracked in #5924, to land with #5912.

Refs #5915

🤖 Generated with Claude Code

jcajasmc added 5 commits July 23, 2026 02:28
…pStats (#5915 J2 slice-2)

aggregateGroupStats' "no sidecar, header unreadable" mtime fallback used
os.Stat(graph.CurrentGraphPath(stateDir)), which only ever resolves the
flat graph.fb path -- always absent for a SEGMENT-SET repo (graph.<gen>/
dir + manifest.json). Route both fallback branches through
graph.CurrentGraphMtime, which is segment-set aware. Adds the shared
writeDashboardSegmentSetFixture test builder reused by the sibling sites.

TDD: TestAggregateGroupStats_SegmentSetUnreadableHeader is RED before this
fix (lastIndexed reads zero), GREEN after.
 J2 slice-2)

knownRefsForGroup and allRefsForRepo gated ref presence on
os.Stat(graph.CurrentGraphPath(refDir)) + a graph.json fallback -- the
first stat only ever resolves a flat graph.fb path, so a SEGMENT-SET-only
ref (graph.<gen>/ dir + manifest.json, no flat .fb, no graph.json) was
silently dropped (400 on ?ref=<branch>). Switch the existence check to
graph.CurrentGraphDescriptor(...).Kind != graph.GraphAbsent, keeping the
graph.json fallback for parity with json-only ref dirs.

TDD: TestKnownRefsForGroup_SegmentSetRefIncluded and
TestAllRefsForRepo_SegmentSetRefIncluded are RED before this fix, GREEN
after.
 J2 slice-2)

statGraphMtime (the freshness signal behind DashGroup.diskUnchanged's
mtime-keyed cache, #50) fell back through
os.Stat(graph.CurrentGraphPath(stateDir)) then graph.json, always missing
a SEGMENT-SET repo's manifest.json. Route the primary check through
graph.CurrentGraphMtime, preserving the graph.json fallback and
single-file/absent parity.

Does NOT touch the flows.MergeInto/description merge hooks or the
fbreader.Open(graph.CurrentGraphPath(stateDir)) zero-copy Reader open
further down loadGroupUncached (~line 674) -- that is a reader
construction, not an existence/freshness gate, and out of this slice's
scope (see final report).

TDD: TestStatGraphMtime_SegmentSet is RED before this fix (zero time),
GREEN after; TestStatGraphMtime_SingleFileParity/_Absent guard parity.
#5915 J2 slice-2)

handleV2GroupRefs gated each ref slot's presence + indexed_at on
os.Stat(graph.CurrentGraphPath(refDir)) -- only ever a flat .fb path, so a
SEGMENT-SET ref slot was skipped entirely ("graph was never written").
Replace with graph.CurrentGraphMtime(refDir), which resolves both
existence and freshness (manifest.json mtime) in one call and is
byte-identical to the old os.Stat().ModTime() for the single-file/legacy
case.

TDD: TestHandleV2GroupRefs_SegmentSetRef is RED before this fix (ref
missing from the response), GREEN after.
…f_endpoints.go (#5915 J2 slice-2)

handleGroupRefs' per-ref aggregation gated presence + mtime on
os.Stat(graph.CurrentGraphPath(refDir)) with a graph.json fallback -- the
first stat only ever resolves a flat .fb path, so a SEGMENT-SET-only ref
was dropped from the aggregate entirely. Route the primary check through
graph.CurrentGraphMtime(refDir), keeping the graph.json fallback.

TDD: TestHandleGroupRefs_SegmentSetRefIncluded is RED before this fix (ref
missing from the response), GREEN after.
@cajasmota
cajasmota merged commit 434052e into main Jul 22, 2026
@cajasmota
cajasmota deleted the worktree-agent-aa257c9a83fe6b661 branch July 22, 2026 18:39
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.

2 participants