Skip to content

fix: harden dashboard shutdown and response-handle evidence - #4989

Merged
ScriptedAlchemy merged 3 commits into
masterfrom
fix/response-handle-evidence-audit
Nov 28, 2026
Merged

ScriptedAlchemy merged 3 commits into
masterfrom
fix/response-handle-evidence-audit

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Why

Audit follow-up to #4979, which merged while this review was in progress.

The inventory test used a single timing sample as an acceptance gate, so scheduler delays could fail it without a payload-reading regression. Its Unicode fixture also divided repetitions by seven although é🦀 occupies six UTF-8 bytes: the reported 8 MiB inventory/publish/replay fixture was approximately 6.86 MiB.

Changes

  • Construct exactly 8 MiB of Unicode content and assert its byte length.
  • Check inventory metadata deterministically. Corrupt the stored payload to invalid UTF-8, prove content lookup fails, and prove inventory still returns the exact metadata.
  • Assert each measured expiry sweep removes one record before comparing SQLite VM-step counts.
  • Retain timings as measurements and distinguish VM work from disk I/O. The inventory check establishes that valid payload text is unnecessary; it does not measure SQLite payload-page I/O.
  • Remove the unsupported claim that measuring the existing lookup proves alternative SQL slicing is slower.

Production response-handle behavior is unchanged. The commit-gate rollback and zero-row replay checks remain in place. The earlier expiry/lookup experiments used actual 8 MiB ASCII payloads; the Unicode size correction applies to inventory, fresh publication, and replay.

Dashboard shutdown and fixture isolation

CI exposed a settings PATCH timeout followed by two dashboard shutdown tests finding unexpected global state. The HTTP journey reported its assertion-worker panic before stopping its dashboard, and the two test groups used separate locks for the same manager.

  • Save the HTTP worker result, explicitly stop the fixture's dashboard, and finish harness shutdown before propagating either failure. A TCP connection check proves the listener closed.
  • Use one shared test lock across both groups.
  • Keep cleanup explicit in the unique-root HTTP fixture; the generic composition harness does not infer ownership from project roots.
  • Preserve the original settings assertions and four-second HTTP timeout.

Review also found an independent production race: an old stop operation could re-read the manager after suspension, follow a newly started dashboard at the same root, and abort or join that replacement. Shutdown now captures the original task authority, completion signal, and address under the initial lock. It waits for, aborts, and joins that task only, and removes the manager entry only if it still names the captured task.

A deterministic regression suspends stop A, completes and reaps A, installs live replacement B, then proves the old stop completes without following or stopping B. It uses task identity and explicit polling, with no sleeps or widened deadlines. Already-signalled completion still takes priority over an expired deadline.

The original PATCH timeout's wait boundary was not captured, so its latency cause is unproven. The same HTTP journey and the two shutdown tests passed on the later #4984 CI head without these dashboard changes; that does not establish that the timeout cannot recur. The cleanup and task-ownership fixes address independently demonstrated defects.

Validation

  • Independent source review covered response-handle SQL/value conversion and transaction semantics, dashboard task identity, concurrent Start/Stop joins, and the replacement regression.

  • Pinned Rust 1.100.0 formatting and git diff --check pass.

  • Local bazel test //crates/tracedecay-global-db:unit_test --test_arg=response_handle --test_output=all passed: 18 tests, 0 failures, including all four store-cost tests. That response-handle source is byte-identical to this PR.

  • The first hosted run passed the full global-db target and 180 of 181 Linux targets; its main daemon failures motivated the fixture investigation above.

  • The final dashboard correction could not execute locally because linking the full daemon test binary exceeded this host's memory; no local dashboard-test pass is claimed.

  • Hosted Linux CI on 3b89e4fc264a8601dd8339e51f7d9cd9d5567b5a passed all 181 Bazel test targets (70 executed, 111 cached), and Clippy passed. The main daemon unit target, daemon suite, CLI core suite, dashboard API suite and runtime acceptance suite executed successfully. The retained runtime acceptance log reports 142 passed, 0 failed.

  • CI retains the successful main-unit target result, rather than individual successful case logs, so the replacement-task regression and HTTP fixture have full-suite evidence. The original four-second PATCH deadline is unchanged, and this pass does not establish the cause of the earlier timeout.

  • Windows CI on the same head passed the full workspace build/type-check and the focused addon-lock upgrade-refusal test. The workflow used native=none, so its broader Windows native-test step was skipped.

@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3b89e4f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@ScriptedAlchemy ScriptedAlchemy changed the title test(response-handles): make large-handle evidence deterministic test: harden response-handle evidence and dashboard teardown Nov 27, 2026
@ScriptedAlchemy
ScriptedAlchemy marked this pull request as draft November 27, 2026 04:17
Capture the task authority before waiting so a concurrent start cannot redirect an old stop to its replacement. Keep HTTP fixture cleanup explicit and share the manager test lock.
@ScriptedAlchemy ScriptedAlchemy changed the title test: harden response-handle evidence and dashboard teardown fix: harden dashboard shutdown and response-handle evidence Nov 27, 2026
@ScriptedAlchemy
ScriptedAlchemy marked this pull request as ready for review November 27, 2026 04:33
@ScriptedAlchemy
ScriptedAlchemy merged commit 3071e28 into master Nov 28, 2026
21 of 30 checks passed
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