Skip to content

test(exact-sql): pin the split begin/lock spans - #713

Closed
ScriptedAlchemy wants to merge 4 commits into
codex/tracedecay-total-redesign-plan-reopenedfrom
claude/perf-split-exact-sql-span
Closed

test(exact-sql): pin the split begin/lock spans#713
ScriptedAlchemy wants to merge 4 commits into
codex/tracedecay-total-redesign-plan-reopenedfrom
claude/perf-split-exact-sql-span

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Reopened against codex/tracedecay-total-redesign-plan-reopened. The span split already existed in perf(exact-sql): separate dispatch and lock timing — my brief was stale. This adds only the missing falsifiable test proving rusqlite.exact_sql.begin_immediate and rusqlite.exact_sql.write_lock are recorded and distinct, driven through a real hotpath guard and asserted from parsed JSON, never on elapsed time.

ScriptedAlchemy and others added 4 commits August 24, 2026 03:26
perf(observation) added an ObservationApplicationError variant and a
HostAdmissionOutcome field without updating their consumers, and the
hooks crate extraction left the observation benchmark reading fields it
can no longer see. The pushed branch therefore does not compile, so
every branch cut from it fails before its own work is built.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
perf(exact-sql): separate dispatch and lock timing (8bb12ad, already on
this branch) already split the caller round trip
(rusqlite.exact_sql.begin_immediate) from the worker's own SQLite lock
acquisition (rusqlite.exact_sql.write_lock) and documented what each half
measures. This adds the falsifiable proof that requirement asked for: a
Hotpath-feature-gated test that drives a real begin_immediate() through a
real writer thread, reads back the emitted JSON report, and asserts both
span names are recorded with call counts >= 1 and are distinct labels.
Never asserts on elapsed time, since these timings swing double digits
run over run.

Verified against current code:
- rusqlite.exact_sql.begin_immediate (exact_sql/mod.rs) wraps the whole
  caller round trip: try_send + response.recv() blocking on the writer's
  reply channel, including the worker's own lock acquisition.
- rusqlite.exact_sql.write_lock (exact_sql/command.rs,
  begin_transaction_with_busy_retry) measures only the worker-side busy
  retry loop that takes SQLite's write lock, on the worker thread, inside
  run_writer_command.
- The bare rusqlite.begin_immediate name now appears exactly once, in
  writer/worker/mod.rs's run_incremental_vacuum -- an unrelated maintenance
  path that begins its own transaction directly on the already-dequeued
  worker thread (no channel wait folded in there).

No writer scheduling, select_auxiliary_work, prefer_auxiliary, or
drain_fair behavior touched. New test module is hotpath-feature-gated so
the default build is unaffected.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bed9ac6

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bed9ac6006

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +33 to +35
unsafe {
std::env::remove_var("HOTPATH_OUTPUT_FORMAT");
std::env::remove_var("HOTPATH_OUTPUT_PATH");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Pin the Hotpath report section selector

When feature-enabled tests run with an ambient HOTPATH_REPORT that excludes functions-timing (for example, a profiling invocation selecting only threads), clearing only the format and path leaves that selector active, so the JSON lacks functions_timing.data and this test panics even though both spans are correct. Clear or explicitly override the report selector as well, while restoring any prior environment afterward, to keep the test isolated.

AGENTS.md reference: AGENTS.md:L115-L117

Useful? React with 👍 / 👎.

Comment on lines +189 to +190
#[cfg(feature = "hotpath")]
mod hotpath_spans;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Run the feature-gated regression test in PR CI

In the inspected PR workflow, .github/workflows/ci.yml:224-225 runs workspace tests without hotpath, while lines 240-243 only run cargo check with that feature. Consequently this module is excluded from every PR test run, and a span rename or report-shape regression can merge green before first being exercised by the all-features release workflow; add this narrow test to a feature-enabled PR lane.

AGENTS.md reference: AGENTS.md:L126-L128

Useful? React with 👍 / 👎.

Comment on lines +182 to +185
/// Readiness counters the root-crate observation benchmark folds. The
/// struct moved into this crate, so its `pub(crate)` fields are no longer
/// reachable from there; these expose exactly the five it reads.
pub fn source_event(&self) -> &str {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep benchmark-only accessors out of the public API

These new pub getters are used only by baseline::validate_hook_telemetry_readiness, whose sole caller is the benchmark test module; production benchmark paths continue to serialize the aggregate without these methods. This creates a test-only production API even though the previous JSON assertions already checked the same fields, so retain serialization-based validation or expose access only when a real production contract needs it.

AGENTS.md reference: AGENTS.md:L82-L84

Useful? React with 👍 / 👎.

@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Closing after review. The feature-gated test is not exercised in PR CI, inherits ambient HOTPATH_REPORT state, and adds benchmark-only public accessors. The production span split already exists in PR 707.

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