Repository navigation
fix(stack): restore scope drift intervals after restart - #4961
Conversation
|
Each mounted stack scope now holds one registration that owns its stacked-PR policy, preflight circuit and scope state, so project open hands the exact handle to the delivery runtime and the review owner instead of registering the same scope key twice. A restarted daemon reads its newest durable drift receipts for the exact scope before the review owner publishes its first observation. Receipts bind through the canonical envelope trace (scope digest, drift kind, opening time), a foreign worktree's receipt is skipped, and only a still-open interval is rebuilt with its original trace so the next observation closes it instead of opening a duplicate. Refs #4436
737f984 to
bd9682f
Compare
|
No changeset applies here: this repository releases through release-please ( |
Restoration is now a mount transition. A registration that already published an observation returns `scope_already_live` and its live drift state is left untouched, so a configuration reload that rebuilds the review owner cannot replace a newer live interval with an older durable receipt the producer has not caught up with. `restore_open_drift_interval` refuses such a write with `ScopeAlreadyObserved`. The receipt scan also reduces each drift kind by its greatest event time instead of stopping at its first receipt. The observability port pages by insertion id and sorts only within a page, so a late-persisted close can precede a newer open interval; the old early exit could hide that open interval and leave it untracked after restart. Refs #4436
|
Fixed in 58147b6 (thread: configuration reload). Restoration is now a mount transition: Covered by |
|
Fixed in 58147b6 (thread: older receipt hides newer interval). Confirmed against the code you cited: New pin |
What this changes
#4436 — one lifetime-owned stack scope state, plus production restart restoration.
DaemonGitHubStackCoordinatorV1::register_scope(scope, stacked_pr_policy, circuit_policy)now writes the policy, circuit policy, current observation and drift intervals into the scope's singleScopeObservationStateand returns theGitHubStackScopeV1handle. The separateregister_circuit_policyis deleted.GitHubReviewRuntimeOwnerConfigV1; the review owner joins it instead of re-looking-up the scope key withretain_scope. The old block-scoped_stack_registrationis gone, so the policy registration no longer depends on another owner keeping the scope alive.observability::restore_github_stack_drift_intervalsreads this project's newest durable drift receipts through the canonicalObservabilityQueryPort(bounded: 64 events/page × 8 pages) and rebuilds a still-open interval only when the envelope trace binds the exact scope digest, drift kind and opening time.GitHubReviewRuntimeOwnerV1::refreshruns it once per mounted owner before it can publish a sample, so the next observation closes the original durable trace instead of opening a duplicate interval.restore_open_drift_intervaltakes the live handle and keeps the earlier opening time, so a late or repeated restore cannot rewrite newer live evidence or a successor registration.No manifest, lockfile, generated BUILD, or release-file change; no repin or
gen_buildsrun was needed.Evidence
Focused Bazel runs (all
--test_output=all, exact paths throughscripts/require-exact-test.shwhere pinned):github_stack_coordinator::retired_scope_registrations_release_all_stategithub_stack_coordinator::a_late_restore_cannot_rewrite_a_live_open_interval(assertsScopeAlreadyObserved, live interval unchanged)github_stack_drift_observability::restore_reduces_drift_kinds_by_event_time_across_unsorted_pagesgithub_stack_drift_observability::restart_restores_only_this_scope_open_drift_and_closes_its_original_tracegithub_stack_coordinator::scope_state_retires_after_the_last_mounted_owner_and_provider_readgithub_stack_coordinator::restarted_owner_refuses_pre_restart_reads_and_settles_restored_drift//crates/tracedecay-application:application_suite(full, uncached)//crates/tracedecay-agent-hosts:unit_teststack journeys (declared_stack_runtime_shares_native_preview…,checked_out_declared_stack_conflict…,expired_stack_notice_expansion…)bazel build //crates/tracedecay-cli:tracedecayand//crates/tracedecay:daemon_suiterustfmt_check_2024for application, agent-hosts, tracedecayReview fixes (
58147b6095)GitHubStackScopeV1::is_mount_fresh()gates it,restore_github_stack_drift_intervalsreturnsscope_already_livewithout reading or writing once an observation exists, andrestore_open_drift_intervalrefuses the write with the typedScopeAlreadyObservederror. A concurrent observation winning that transition is folded into the same typed outcome.event_time_microsacross the bounded pages instead of stopping at its first receipt, because the observability port pages by insertion id and sorts only within a page. Coverage isKnownonly when the scan reaches the end of the project's drift receipts.One full-suite run under peak parallel load showed a transient failure in
observability_runtime_contract::real_work_owner_receipts_converge_to_rollup; it passes in isolation and the following uncached full run is 102/102.The restart test drives the real registered project database and the real bounded observability producer, then restores through
RegisteredObservabilityPortV1into a fresh coordinator and asserts the persisted trace closes at the next observation.Pre-existing failures, proven at base
9d2d6c0a62by stashing this branchdaemon_suite:store_shutdown_checkpoint_test::{route_bind_eviction_cannot_retire_a_reopened_projects_owners, capacity_retirement_behind_a_parked_bind_eviction_cleanup_completes}(suite: 35 passed / 2 failed; each fails in isolation at base).application unit_test: 3pr_tracking::worktreesgit-index tests (615 passed / 3 failed at base).Unresolved #4436 criteria (Refs, not Closes)
GitHubReviewRuntimeOwnerV1::refreshand no mounted-runtime-drop journey test. The restore mechanics are pinned against the real store/coordinator, and the refresh call site is compile-verified, but journey-level acceptance remains open.#4229 grammar decision: no change
The decision rule requires a measured cost reduction beyond run-to-run spread and lacking demand or quality.
9,061,376 Bvs lite variant6,700,704 B(Δ2,360,672 B);tokensave-large-treesittersrlib15,460,664 Bis linked only by the full tier. The fastbuild CLI is662,556,384 Bwith debug info, so it makes no release-size claim.large-grammarsalso only helps if linker GC keeps the gain, which is unmeasured.crates/tracedecay-code-extraction/fixturesorbenchmark_dataexercises.cob/.f90/.bas/.quint/.lean.No set qualifies; defaults are unchanged and #4229 stays open with the remaining measurements named above.
Tracker audits (no tracker edits in this PR)
Refs #4436
Refs #4229