fix(#5915 J2 slice-2): segment-set-aware dashboard existence/freshness gates#5925
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The last flat-
graph.fb-only existence/freshness gates — 5 dashboard sites — made segment-set-aware viagraph.CurrentGraphDescriptor(existence) /graph.CurrentGraphMtime(freshness), preservinggraph.jsonfallbacks and single-file parity. Completes the #5915 J2 gate sweep. Latent untilGRAFEL_STREAM_SEGMENTSon; needed before the flip.Sites
store.goaggregateGroupStats— both fallback mtime branches.ref_helper.goknownRefsForGroup+allRefsForRepo— existence (json fallback kept).graphstate.gostatGraphMtime— freshness (NOT the :620-674 merge-hook/reader-open).handlers_v2_refs.gohandleV2GroupRefs+handlers_ref_endpoints.gohandleGroupRefs— existence+freshness.Verification (independent adversarial review — APPROVE)
os.Stat(CurrentGraphPath)(1s drift → RED).graph.jsonfallback proven preserved (removing it → json-onlyTestHandleGroupRefs_OK/TestKnownRefsForGroup_GenOnlyRefIncludedRED).quiesceGraphCache.Follow-up (out of scope → #5924)
graphstate.go:674(dr.Readeropen) +v2_group_settings.go:267repoGitMetaopen 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