Skip to content

simplify(sessions): delete the test-only transcript upsert port - #2752

Merged
ScriptedAlchemy merged 1 commit into
masterfrom
fleet/legacy-api-sweep-transcript-upsert
Sep 30, 2026
Merged

ScriptedAlchemy merged 1 commit into
masterfrom
fleet/legacy-api-sweep-transcript-upsert

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

What

Production transcript ingest only advances cursors through TranscriptWriteBatch::advance_offset; session and message rows arrive through observation admission and projection (since #2748/#2730). The whole Upsert write side was reachable only from tests, i.e. a test-only production port. This deletes it and migrates every test caller.

Deleted (no non-test callers, confirmed with rg plus an all-targets clippy build):

  • TranscriptWriteBatch::upsert / upsert_with_cursor, TranscriptWriteKind (the batch now carries only the offset pair), and their unit tests
  • the Upsert arm of GlobalDbTranscriptStore::persist_batch
  • RegisteredGlobalDb::{upsert_transcript_batch, persist_transcript_batch_result, persist_transcript_batch_with_git_evidence_result} and the SessionStoreAccess chain behind them (upsert_transcript_batches_inner, batch message staging, write-time timestamp normalization, in-batch Codex goal reconciliation), TranscriptGitEvidence, TranscriptBatch
  • TranscriptStoreError::{InvalidTranscriptPath, MissingTranscriptPath, MessageIdentityMismatch} and their ingest failure codes (only Upsert could produce them)
  • test helpers upsert_transcript_batch_for_test (project test_support, dashboard test runtime), the unused global-db harness upsert_session_message_for_test, and set_parse_offset_insert_failure_for_test
  • the stale merge_session_metadata comment

Migration

Fixture seeding goes through the existing primitives upsert_session + lcm_ingest_raw_message (no new port):

  • seed_session_messages_for_test(scope, session, messages) -> Result<Vec<i64>> replaces upsert_transcript_batch_for_test (the dropped cursor key/offset args were never read back by any caller)
  • upsert_session_message_for_test now returns Result<()> instead of Ok(false) on a swallowed write failure
  • direct RegisteredGlobalDb callers (session-runtime lcm_effects, retained profile, temporal worker, daemon retention, automation fixtures) ingest raw messages directly

Tests deleted because they only protected the Upsert write: six session_suite::transcript_store full-batch tests (restart/replay, rollback, invalid batch, stale CAS, concurrent full batches, summary metadata survive-persist), the store-crate Upsert validation tests, the staging-attribution unit test, and the lcm_dag re-seed that asserted write-time microsecond-to-second normalization. The three advance_offset tests stay. The profile-scope Git-evidence refusal test now exercises the production span writer (record_span_observation) instead of the deleted transcript Git-evidence path.

Proof

This is a behavior-preserving deletion (simplify). It adds no behavior, so there is no new test that fails on master; the evidence is that every suite covering the remaining path passes.

Tests (non-zero counts):

  • libs: tracedecay-store 72, tracedecay-sessions 522, tracedecay-session-memory 303, tracedecay-session-runtime 129, tracedecay-global-db 389 (+1 pre-existing failure, see below)
  • tracedecay: session_suite 435, dashboard_api_test 78, automation_runner_test 171, transcript_ingest_suite 180, mcp_suite (git_correlation_test, mcp_handler_test::lcm_test) 30, hooks_lsp_suite hint_settlement 3, lib (daemon::scheduler, mcp::server::host_admission_tests) 43
  • tracedecay-cli core_cli_suite (two migrated session tests) 2
  • after rebase on fix(daemon): close stores in one teardown, drop capacity retry #2751: tracedecay lib 51, session_suite (lcm_/transcript_store) 186
  • cargo clippy -p tracedecay-store -p tracedecay-sessions -p tracedecay-global-db -p tracedecay-session-memory -p tracedecay-project -p tracedecay-session-runtime -p tracedecay -p tracedecay-cli --all-targets --features ... -- -D warnings: clean
  • cargo fmt --all -- --check: clean
  • cargo check --workspace --all-targets --target x86_64-pc-windows-gnu --features tracedecay/test-transport,tracedecay/test-helpers,tracedecay-cli/test-transport: 0 errors (warnings are pre-existing cfg(windows) ones in untouched crates)

Pre-existing, not caused by this PR: tracedecay-global-db observation_collision_tests::vibe_jsonl_eof_refusal_survives_retention_generation_and_restart_without_rework fails identically on origin/master 411312b (same panic at observation_collision_tests.rs:2730), tracked in #2740.

Runtime journey on the built debug CLI (isolated HOME/TRACEDECAY_DATA_DIR, one daemon under systemd-run --user --scope -p MemoryMax=6G -p MemorySwapMax=1G, a Claude transcript bound to a scratch git project):

$ tracedecay init
initialized .../journey/project; daemon code-index reconciliation requested
$ tracedecay sessions import --project-path .
session import scheduled (session-sync.f82c16d6...); historical catch-up has remaining work 2
$ tracedecay sessions search "billing pipeline"
[claude] proj_1b1d853e1c2d8243 user: Investigate the billing pipeline regression
[claude] proj_1b1d853e1c2d8243 assistant: The billing pipeline regression is fixed.
# append a third message, re-import
$ tracedecay sessions search "invoice reconciliation"
[claude] proj_1b1d853e1c2d8243 user: Now audit the invoice reconciliation cursor
# re-import unchanged, then count all messages
$ tracedecay sessions search "journey OR billing OR invoice OR regression" | grep -c '^\[claude\]'
3

Ripwire: --quality-delta exit 0 (remaining rows are small constructor/wrapper shape clones and churn, no gating finding caused by this change); --edit-check on TranscriptWriteBatch, TranscriptWriteBatch::into_parts, TranscriptStoreError, persist_batch, upsert_session_message_for_test, seed_session_messages_for_test: incompatible=0.

Production transcript ingest only advances cursors through
TranscriptWriteBatch::advance_offset; session and message rows arrive
through observation admission and projection. The Upsert write kind and
its global-db/session-store chain (upsert_transcript_batch,
persist_transcript_batch_result, the Git-evidence variant, batch message
staging, write-time timestamp normalization) were reachable only from
tests.

Delete that chain, the unreachable TranscriptStoreError variants and
their ingest failure codes, TranscriptBatch, and TranscriptGitEvidence.
TranscriptWriteBatch now carries only the offset pair.

Fixture helpers seed session rows plus raw LCM messages through the
existing upsert_session and lcm_ingest_raw_message primitives and return
typed errors instead of a swallowed false. Tests that only protected the
Upsert write (restart/replay, rollback, identity validation, full-batch
CAS, write-time microsecond normalization) are removed; the
profile-scope Git-evidence refusal now exercises the production span
writer.
@changeset-bot

changeset-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 75ffb4e

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

@ScriptedAlchemy
ScriptedAlchemy merged commit e46da9e into master Sep 30, 2026
5 of 7 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the fleet/legacy-api-sweep-transcript-upsert branch September 30, 2026 07:57
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