Repository navigation
test(server): prove audit_log.trace_id is populated from the caller's traceparent (#840) - #841
Merged
Merged
Conversation
… traceparent The column is the JOIN KEY to the span store and no gate at any level proved it is ever populated. One assertion per state it can be in: a request carrying traceparent writes its trace id; a headerless request writes a fresh root id (traced is not untraced); a write with no request behind it writes NULL, permanently and on purpose. Runs under capture_spans on a current-thread runtime so request spans record on the polling thread — without a subscriber case 1 would pass vacuously.
… traceparent The column is the JOIN KEY to the span store and no gate at any level proved it is ever populated. One assertion per state it can be in: a request carrying traceparent writes its trace id; a headerless request writes a fresh root id (traced is not untraced); a write with no request behind it writes NULL, permanently and on purpose. The first version installed the recorder thread-locally via capture_spans and passed alone but flapped in the pg shard — callsite interest is cached process-wide, and a callsite first hit on an unsubscribed thread caches "never interested" for every thread. er_obs::testing gains global_recorder(): a once-per-process global default plus rebuild_interest_cache, so no thread can ever evaluate the none dispatch. The test's anti-vacuity assertion (the recorder saw the traced request's span) runs before the ledger assertions, so a recording regression names itself instead of surfacing as a bare trace_id: null.
athvin
marked this pull request as ready for review
November 8, 2026 07:07
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.
Closes #840
What
Why
Proof
Risk & rollback
Post-merge ledger
Closed by: agent · session
01a1b892-4cde-7a53-bb3e-9ed2e764acdconMac· 2026-11-08T07:40:00Zmainis green with this change on it — merge SHAdc394ccd; its ownrustpush run was cancelled by the next merge landing on top, so the proof is the later-head rule:7fdf5b32(child ofdc394ccd) has rust 42458642997, frontend 42458643044, infra 42458643036, devcontainer 42458642983, images 42458643027, deploy 42458919308 — all success.imagesbuilt — 42457534130 success on the merge SHA (rebuilt on theer-obssource touch; the changed module istest-support-gated, so the runtime payload is unchanged).deployconverged — process-emitted line, not the workflow conclusion:2026-11-08T07:14:00Z INFO er-server listening addr=0.0.0.0:8000in/er/dev/containersfrom the pod the deploy (42457784287) rolled out; deploy itself success at 07:15:26Z.deploysuccess (above);driftlast scheduled 2026-11-07 success;kindnightly green 2026-11-07 + dispatch-verified 2026-11-08 (this session's The kind probe has never passed in CI — land the first green run and re-decide its gate status #655);Agentic Maintenanceintermittently red pre-existing, scheduled, unrelated.Donethrough the automation rather than by hand —gh project item-list 2 --owner athvin: gate: prove audit_log.trace_id is populated — pg_orgs.rs phase (from #660) #840 atDone; the issue closed on merge.er-obs/src/testing.rsonglobal_recorder(), the API this PR added precisely so the next test does not rediscover it.Specific to this change
Context — plan, discoveries, measurements, files
Plan
pg_orgs.rsgainsaudit_rows_carry_the_requests_trace_id: one assertion per stateaudit_log.trace_idcan be in — (a) request withtraceparent→ the caller's trace id; (b) request without → a fresh non-null root id; (c) a write with no request behind it → NULL.er_obs::testing::global_recorder()— a once-per-process global recording subscriber +rebuild_interest_cache(), because the thread-localcapture_spanscomposition flapped under the concurrent pg shard (see Discoveries).make checkgreen; the failing CI leg (pg m-zshard) reproduced locally and re-run green 4/4.Discoveries
capture_spansinstalls a thread-local subscriber; callsite interest is cached process-wide, and in the 32-test shard a callsite first hit on an unsubscribed thread caches "never interested" for every thread. Observed ascaptured=0spans (case 1 null) in two runs and a missing second request span (case 2 null) in a third. The global recorder makes the none dispatch unreachable after install, closing the race. Verified: shard green 4/4 locally after the fix.pg_serial.rscounts#[tokio::test]attributes per file and this file's one is taken — so the test is a plain#[test]driving a current-thread runtime.telemetry_trace_continuation.rs) locks the exported span; this test closes the loop into the ledger (the JOIN KEY column itself).Files
rust/crates/er-obs/src/testing.rs—global_recorder()+GlobalRecorder, andto_capturedfactored out ofcapture_spans.rust/crates/er-server/tests/pg_orgs.rs— the new test (request phase + assertion phase).