Skip to content

fix(tests): repair storage-cluster test drift from origin-vocab+clock-guard fixes - #3595

Merged
Sinity merged 12 commits into
masterfrom
feature/chore/id4n-fresh-triage
Aug 3, 2026
Merged

fix(tests): repair storage-cluster test drift from origin-vocab+clock-guard fixes#3595
Sinity merged 12 commits into
masterfrom
feature/chore/id4n-fresh-triage

Conversation

@Sinity

@Sinity Sinity commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Fresh triage of the storage-cluster test failures tracked by polylogue-id4n: fixes real bugs and stale test drift across raw_sessions column wiring, ChatGPT title-source threading, row_factory handling, and several fixture/snapshot/literal staleness issues from recent origin-vocab and clock-guard additions.

Problem

polylogue-id4n's original count (78 failures) predated PR #3500's full propagation and was known-stale. This branch reran the failing surface fresh, grouped failures by shared root cause, and fixed each cluster: a genuine raw_sessions column gap, a row_factory crash, ChatGPT parser title_source not being threaded through, several test fixtures asserting stale literals/snapshots against current production behavior, and the maintenance planner's phantom-debris test fixtures not producing real classifiable debris (a deeper bug than the row_factory fix alone addressed — see polylogue-9rdky).

Solution

  • polylogue/storage/repair.py, polylogue/storage/sqlite/queries/raw_writes.py: fix the row_factory crash and wire the missing raw_sessions column.
  • polylogue/sources/parsers/chatgpt.py: thread title_source through the ChatGPT parser.
  • tests/infra/storage_records.py: add DbFactory.mark_as_phantom_debris(native_id), mirroring the existing _seed phantom-artifact pattern, so planner-contract tests produce classifiable debris in the caller's own archive root rather than ambient config.
  • Remaining files: update snapshot/allowlist/literal drift (native_id_hint assertions, live-watcher fixture text, codex event-classification counts, lineage_validation DDL sync, JSONL fixture newlines) to match current production behavior rather than stale expectations.

Verification

  • devtools test tests/unit/maintenance/ tests/unit/storage/test_empty_session_repair_provenance.py — 254 passed.
  • mypy --strict on all touched files — clean.
  • devtools verify --all on this branch — 31 pre-existing failures remain (raw_authority_scale_proof, synthetic_semantics[antigravity], campaign_receipt_reconciliation, etc.), none in files this branch touches. Spot-checked 6 of them directly against origin/master's checkout — identical failures reproduce there. The 4 campaign_receipt_reconciliation failures are a worktree-environment artifact (missing gitignored fixture dir .agent/handoffs/external-agent-campaigns/2026-07-16-gpt-pro-wave, absent from any fresh worktree checkout by design), not a code regression.
  • devtools verify --quick (pre-push gate) — clean.

Ref polylogue-id4n

Summary by CodeRabbit

  • New Features
    • ChatGPT sessions now preserve whether titles came directly from the provider, improving title provenance.
    • CLI help now documents session-scope options and the compare command.
    • Codex reasoning entries are represented as separate thinking messages, including entries without summaries.
    • Codex continuation and unknown response items are handled more consistently.
  • Bug Fixes
    • Improved identification and maintenance of empty or phantom session artifacts.
    • Improved recognition of binary database artifacts during inspection.
  • Tests
    • Expanded coverage for ingestion, storage maintenance, CLI output, and security behavior.

Sinity and others added 11 commits August 3, 2026 01:01
…xtures

Fresh devtools verify --all triage on master (polylogue-id4n) found 86
unique failures. This batch fixes the clusters that were either genuine
bugs with an obvious correct fix or stale test literals/fixtures that
needed updating to match intentional production behavior:

- polylogue/storage/repair.py: _empty_session_debris_session_ids crashed
  with `TypeError: tuple indices must be integers or slices, not str`
  whenever called with a plain sqlite3.Connection (row_factory not
  sqlite3.Row) -- the exact shape open_readonly_connection() returns, so
  this also crashes the real `polylogue maintenance repair --target
  empty_sessions --preview` CLI path, not only tests. Sets row_factory
  defensively on entry and restores it on exit. Confirmed pre-existing,
  tracked as polylogue-9rdky; 10 planner tests still fail on a separate,
  deeper fixture-completeness gap (see bead update).

- tests/infra/storage_records.py + test_assertion_candidate_evidence_disclosure.py:
  SessionBuilder/_record_to_parsed_session and one hand-built ParsedSession
  set an explicit `title` without `title_source`, so
  archive_tiers/archive.py's has_real_title gate (title_source must be
  ORIGIN/HEURISTIC) always degraded them to the "N msgs" structural-label
  fallback. Every real parser sets both together; mirrors that here.
  Fixes 4 test_cli_output_schemas.py failures + the evidence-disclosure test.

- tests/unit/storage/test_blob_gc.py: 7 tests called time.time() directly
  in a `_backdate` helper, tripping the clock_guard. blob_gc.py's own age
  gate reads the real time.time() in production code (not
  frozen_clock-interceptable), so these genuinely need the real clock --
  opted out via `uses_real_clock` rather than introducing frozen_clock.

- tests/unit/core/test_enums.py, tests/unit/cli/test_command_aux_runtime.py,
  tests/unit/devtools/test_verify.py: snapshot-pin literals not updated for
  the claude-design-session Origin addition (#3422) and three new
  lab-policy verify steps (raw-payload-hash-purity,
  position-derived-identity, raw-authority-frontier-executability).

Verification: devtools test on all touched files, 204 passed / 10 failed
(the pre-existing planner fixture-completeness gap noted above).

Ref polylogue-id4n, polylogue-9rdky

Co-Authored-By: Claude <noreply@anthropic.com>
… drift

Second batch from the polylogue-id4n fresh triage. All test-only fixes are
verdict "test-update, not code-fix" -- production behavior changed
intentionally in each case and the change's own PR missed a sibling test
file exercising the same code path.

- polylogue/storage/sqlite/queries/raw_writes.py: the canonical raw_sessions
  writer's INSERT column list was missing revision_authority_evidence
  (added to the DDL by #3568 but never wired into the writer). Binds NULL
  -- the column is only ever populated later by a dedicated maintenance
  actuator's UPDATE, never at initial-write time. Fixes
  test_writer_insert_covers_every_live_raw_sessions_column, which exists
  specifically to catch this class of drift (its own docstring documents
  the "28-column" contract this restores).

- tests/unit/api/test_facade_contracts.py: test_archive_tiers_api_raw_artifacts_read_source_tier
  only patched archive_tiers/archive.py's datetime via frozen_clock_modules,
  but parsed_at is actually stamped by
  archive_tiers/revision_governance.py's _raw_parse_success_state (real
  datetime.now(UTC), unpatched). Adds that module to the marker.

- tests/unit/pipeline/test_branching.py: two independent stale fixtures.
  (1) #3484 requires structural evidence (matching cwd/git repository_url)
  for the codex legacy-continuation fallback; the PR updated its two direct
  test files but missed this one's _codex_continuation_payload fixture,
  which carried no cwd/git at all. (2) #3495 defaults every session query's
  SQL-level `root` filter to top-level-only unless the caller overrides it
  (intentionally applies to the SessionFilter Python API, not just CLI/MCP);
  a continuation/sidechain session is a child by definition and can never
  be root, so is_continuation()/is_sidechain() need an explicit
  is_root(False) override now. (test_neighbor_candidates.py's
  same-title-candidate failure turned out to share the earlier title_source
  fix's root cause and is already green.)

- tests/unit/storage/test_hermes_artifact_inspection.py: #3576 added a
  shared magic-byte chokepoint classifying a recognized-but-unclaimed
  binary payload (e.g. a generic SQLite lookalike) as RECOGNIZED_UNPARSED/
  binary_database instead of falling through to an incidental
  DECODE_FAILED/unknown. The PR updated its four direct test files but
  missed this sibling file's identical fixture shape.

- tests/unit/storage/test_bulk_delete_guarded.py: manually-seeded
  delegation_facts fixture row used mapping_state='mapped', which has never
  been a valid DelegationMappingState value (resolved/unresolved/edge_only/
  quarantined) -- silently accepted before #3451 wired a real CHECK
  constraint via literal_check, now correctly rejected. Fixed to 'resolved'.

- tests/unit/core/test_paths.py, tests/unit/core/test_query_fields.py:
  allowlist/coverage tests not updated for two legitimate new additions
  (api_auth_token_path/claude_code_todos_path path-layout functions;
  with_unit_windows, an internal with-projection sub-detail parallel to the
  already-internal with_unit_fields).

Verification: devtools test on all touched files, all green.

Ref polylogue-id4n
…terals

Two more stale-literal fixes from the polylogue-id4n triage, both
"test-update, not code-fix" against intentional production changes whose
PR missed this sibling test file:

- test_codex_event_stream_contract.py: #3567 routes an unrecognized
  response_item inner type to a distinct codex_unclassified_response_item
  bucket instead of passing its raw wire token through verbatim (matching
  the claude_attachment_unclassified precedent). The event is still
  surfaced, just under the shared bucket name.

- test_dispatch_payloads.py: #3447 (polylogue-vf9x) started materializing
  every Codex `reasoning` response_item as its own THINKING-block message,
  even one with empty summary/content (block text=None, so the fact that
  the model reasoned survives). The long-rollout fixture's per-turn message
  count was never updated to include the +1 reasoning message per turn
  (120 -> 140 across 20 turns).

Verification: devtools test on both files, all green.

Ref polylogue-id4n
…lout)

test_live_batch_processor_records_durable_attempt's source_path fixture
was session_meta-only (no message content), the same fixture-staleness
class #3572 already fixed in test_raw_authority_ledger.py and
polylogue-h7y0j already tracks for the raw-authority scale-proof
generator: PR #3497's require_positive_conversational_evidence() gate
correctly refuses a session whose sole message carries no real content,
so this fixture always materialized zero sessions (succeeded_file_count
0, not the asserted 1). Adds a real user message record.

(test_end_to_end_hidden_root_file_creation_triggers_ingest flickered
failed once during iteration on this file -- confirmed via git stash
and repeat runs to be pre-existing host-timing flakiness in a real
asyncio.sleep-driven filesystem-watcher test, unrelated to this change;
not touched.)

Verification: devtools test tests/unit/sources/test_live_watcher.py --
92 passed.

Ref polylogue-id4n
…bytes

#3539 (polylogue-u19l) retired splicing a synthetic session_meta header
into a Codex append-mode capture's payload before hashing/storing it --
the stored raw blob must stay a literal byte-slice of the live file for
live-source byte-identity re-verification to work. Recovered identity now
flows as a sidecar hint (_AppendPlan.native_id_hint, applied as the
parser's fallback_id at replay time) instead. The PR updated
test_live_batch_support.py but missed this sibling test, which still
asserted the old spliced-header shape.

Verification: devtools test tests/unit/sources/test_live_catchup_planning.py
-- 20 passed.

Ref polylogue-id4n
…tion

The test's minimal, hand-rolled sessions/messages/blocks schema (not the
real archive DDL) was missing three columns that read_archive_session_envelope
now selects: sessions.reported_cost_usd (#3446, cost wiring),
messages.stop_reason, and blocks.tool_result_outcome_unknown_reason. Every
prefix-sharing composed-read sample hit `sqlite3.OperationalError: no such
column`, caught by _sample_prefix_sharing's broad except and surfaced as
"1 sampled prefix-sharing composed reads failed" / composed_messages=None
/ external_counts_citable=False -- masking the actual DB error behind a
generic report-level failure reason.

This drift had gone undetected because devtools/lineage_validation.py
itself hasn't changed since it was added (#2534); testmon-selected runs
never had a reason to re-run this file after later columns were added
elsewhere, so it only surfaced on this fresh, non-testmon full run.

Verification: devtools test tests/unit/devtools/test_lineage_validation.py
-- 5 passed.

Ref polylogue-id4n
…nt additions

- test_daemon_http_security.py: `polylogue ops api token show` (#3488/#3549)
  is a new, deliberate "print the daemon API bearer token to its own
  operator" CLI command, same intentional pattern as the pre-existing
  browser-capture pairing token_show the scanner already allowlists. Adds
  the new (file, function, sink) tuple.
- test_help_snapshots.py: regenerated via --snapshot-update after
  confirming the diff is purely additive (new --root/--no-root help text
  from #3495, new `compare` command in "Other commands").
- test_render_quality_reference.py: #3404 (2026-07-30) reworded the
  Closure Matrix section's guidance text; the test's exact-string
  assertion still checked the deleted phrasing.

Verification: devtools test on all three files, all green.

Ref polylogue-id4n
Three fixtures built their synthetic Codex JSONL payload with an escaped
double-backslash (source `\\n`), which Python evaluates to the two-character
string backslash+n, not an actual newline byte. Every one of these payloads
was therefore a single malformed line concatenating two JSON objects, which
fails to parse at all -- "no messages, no positive conversational evidence"
(PR #3497's gate correctly refusing content with zero parseable structure,
not the actual bug). Two of the three tests assert a materialized session
count and failed; the third (test_rebuild_index_persists_durable_pass_receipt_alongside_transaction)
never checks session counts so the same latent bug didn't surface there,
but is fixed for consistency.

Verification: devtools test tests/unit/cli/test_archive_maintenance_cli.py
-- 58 passed.

Ref polylogue-id4n
The ChatGPT parser has never set ParsedSession.title_source, even when it
has a genuine provider title (payload["title"]/["name"]). Every other
parser that can produce a real title sets title_source alongside it
(drive.py, claude/ai_parser.py, claude/code_parser.py) -- ChatGPT was the
one omission.

This was silent until #3421 (fix(storage): stop title_source=unknown from
defeating the structural label) made archive_tiers/archive.py's
has_real_title gate require title_source to be ORIGIN/HEURISTIC. Since
then, every ChatGPT-origin session -- titled or not -- has silently
degraded to the structural "N msgs" fallback label at read time, discarding
the genuine title `sessions.title` already carries. Found via a fresh
devtools verify --all: tests/unit/cli/test_plain_cli_snapshots.py's
"cli-mixed" real-pipeline-seeded fixture (2 chatgpt-export sessions with
real payload titles) rendered "7 msgs"/"5 msgs" instead of their actual
titles.

Fix mirrors drive.py's pattern exactly: title_source=ORIGIN only when the
payload carries a real title/name; the bare native-id fallback this parser
falls back to when neither is present must NOT count as title evidence --
exactly the "worse than the UUID it replaces" case the whole title_source
system exists to catch.

Verification: devtools test tests/unit/sources/test_parsers_chatgpt.py
tests/unit/sources/test_dispatch_payloads.py -- 143 passed.

Ref polylogue-id4n
…anges

All drift here traced to real, intentional, already-merged behavior
changes -- none papered over without verifying the responsible commit:

- token role-split (in=191/out=0 -> in=100/out=91, total conserved): #3511
  (fix(cost): role-split estimate fallback tokens) fixed the word-count
  cost-estimation fallback to attribute an assistant-role message's
  estimated tokens to output_tokens instead of dumping every role's
  estimate into input_tokens. Traced by dumping this fixture's raw
  messages table (all real input_tokens/output_tokens are 0 -- this
  archive's every "cli-mixed" session cost figure is the heuristic
  word-count estimate, confirming the split is the #3511 fix, not new
  drift).
- unidentified_artifacts (status output): new counter field, already
  wired in polylogue/cli/commands/status.py.
- total_unit: "top-level sessions" (read --all total): #3495's new
  root-only-by-default session-query unit label.
- index.db/embeddings.db user_version bumps (20/57): real schema
  evolution across recent migrations, not test-only drift.

Verification: devtools test tests/unit/cli/test_plain_cli_snapshots.py
tests/unit/cli/test_cli_output_schemas.py -- 56 passed.

Ref polylogue-id4n
…land

Completes polylogue-9rdky properly instead of leaving the residual gap as
a note: the row_factory crash fix alone left all 10 planner tests failing
on a second, deeper problem -- their "empty" sessions had no raw_id at all
(raw_id IS NULL), which count_empty_sessions_sync's classifier gate
(_raw_artifact_positively_fails_classification) treats as "no evidence
either way" and therefore never counts as debt. affected_rows read 0
where 1-3 was expected.

Adds DbFactory.mark_as_phantom_debris(native_id) to tests/infra/storage_records.py,
mirroring test_empty_session_repair_provenance.py's existing `_seed` helper
pattern (an agent-*.meta.json-shaped phantom raw artifact, the exact shape
the classifier positively refuses): writes the phantom blob through a
BlobStore scoped to the factory's OWN archive root (self.db_path.parent),
never ambient POLYLOGUE_ARCHIVE_ROOT/blob_store_root() -- test_planner_contract.py's
two callers deliberately seed a "caller" archive root distinct from the
ambient fixture root to prove config-supplied paths win over ambient
defaults, so the phantom blob must land in the same archive the classifier
will actually read back from, not wherever ambient config happens to point.
Also asserts the raw_id UPDATE actually touched exactly one row instead of
silently no-oping on a native_id mismatch (SessionBuilder always stores
native_id as f"ext-{id}", not the bare id callers pass to create_session --
caught this the hard way via a first attempt that updated zero rows).

Verification: devtools test tests/unit/maintenance/ tests/unit/storage/test_empty_session_repair_provenance.py
-- 254 passed. mypy --strict on all three touched files -- clean.

Ref polylogue-id4n, polylogue-9rdky
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3560a1e4-74cb-487a-ad36-3816b0c18504

📥 Commits

Reviewing files that changed from the base of the PR and between d11c51a and 2d1335f.

📒 Files selected for processing (2)
  • tests/unit/sources/test_dispatch_payloads.py
  • tests/unit/sources/test_live_catchup_planning.py
📝 Walkthrough

Walkthrough

The changes preserve parsed title provenance, harden SQLite repair state handling, initialize raw-session evidence fields, add phantom-debris test setup, and update Codex, CLI, storage, security, and validation test contracts.

Changes

Parser, storage, and contract updates

Layer / File(s) Summary
Provider title provenance
polylogue/sources/parsers/chatgpt.py, tests/infra/storage_records.py, tests/unit/api/test_assertion_candidate_evidence_disclosure.py
ChatGPT sessions now record TitleSource.ORIGIN only for explicit provider titles. Test session construction uses the same provenance.
Raw artifact maintenance
polylogue/storage/repair.py, polylogue/storage/sqlite/queries/raw_writes.py, tests/infra/storage_records.py, tests/unit/maintenance/*, tests/unit/storage/*, tests/unit/api/test_facade_contracts.py
Repair temporarily uses named SQLite rows and restores the original row factory. New raw sessions bind null revision evidence. Maintenance fixtures create phantom artifacts and update related storage expectations.
Codex ingest and branching contracts
tests/unit/pipeline/test_branching.py, tests/unit/sources/test_codex_event_stream_contract.py, tests/unit/sources/test_dispatch_payloads.py, tests/unit/sources/test_live_catchup_planning.py, tests/unit/sources/test_live_watcher.py
Tests now cover structural continuation metadata, non-root queries, shared unknown-event classification, surfaced reasoning messages, literal live-file payloads, and metadata-plus-message ingest.
CLI and public contract expectations
tests/unit/cli/__snapshots__/*, tests/unit/cli/test_archive_maintenance_cli.py, tests/unit/cli/test_command_aux_runtime.py, tests/unit/core/*
Snapshots and contract tests reflect new CLI commands and filters, updated report values, new origins and exports, internal query fields, and actual JSONL separators.
Validation and fixture alignment
tests/unit/daemon/test_daemon_http_security.py, tests/unit/devtools/*
Validation fixtures and assertions now include intentional token output, cost and stop-reason columns, block outcome reasons, revised guidance, and additional policy commands.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 51.85% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies a test-focused fix for storage-cluster drift caused by origin vocabulary and clock-guard changes.
Description check ✅ Passed The description covers the summary, problem, solution, verification, changelog decision, and remaining verification risks with specific details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/chore/id4n-fresh-triage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sinity added a commit that referenced this pull request Aug 3, 2026
Co-Authored-By: Claude <noreply@anthropic.com>

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/sources/test_dispatch_payloads.py`:
- Around line 720-727: Strengthen the assertions in the per-turn dispatch
payload test around the reasoning response items so it directly verifies that
each turn produces a THINKING-block message, including the reasoning record with
an empty summary and no content. Use the parsed message types or THINKING-block
count rather than relying only on the aggregate total_messages assertion, while
preserving the existing total-count check if useful.

In `@tests/unit/sources/test_live_catchup_planning.py`:
- Around line 297-304: Strengthen the assertions for plan.payload in the live
catch-up planning test to verify it exactly matches the expected append byte
slice from the source fixture, rather than checking for selected substrings.
Keep the native_id_hint assertion and remove the insufficient session_meta/new
substring checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 419ea145-837c-4cd8-9a45-e09dfdd3272f

📥 Commits

Reviewing files that changed from the base of the PR and between c8710f7 and d11c51a.

📒 Files selected for processing (27)
  • polylogue/sources/parsers/chatgpt.py
  • polylogue/storage/repair.py
  • polylogue/storage/sqlite/queries/raw_writes.py
  • tests/infra/storage_records.py
  • tests/unit/api/test_assertion_candidate_evidence_disclosure.py
  • tests/unit/api/test_facade_contracts.py
  • tests/unit/cli/__snapshots__/test_help_snapshots.ambr
  • tests/unit/cli/__snapshots__/test_plain_cli_snapshots.ambr
  • tests/unit/cli/test_archive_maintenance_cli.py
  • tests/unit/cli/test_command_aux_runtime.py
  • tests/unit/core/test_enums.py
  • tests/unit/core/test_paths.py
  • tests/unit/core/test_query_fields.py
  • tests/unit/daemon/test_daemon_http_security.py
  • tests/unit/devtools/test_lineage_validation.py
  • tests/unit/devtools/test_render_quality_reference.py
  • tests/unit/devtools/test_verify.py
  • tests/unit/maintenance/test_planner_contract.py
  • tests/unit/maintenance/test_planner_filter_narrowing.py
  • tests/unit/pipeline/test_branching.py
  • tests/unit/sources/test_codex_event_stream_contract.py
  • tests/unit/sources/test_dispatch_payloads.py
  • tests/unit/sources/test_live_catchup_planning.py
  • tests/unit/sources/test_live_watcher.py
  • tests/unit/storage/test_blob_gc.py
  • tests/unit/storage/test_bulk_delete_guarded.py
  • tests/unit/storage/test_hermes_artifact_inspection.py

Comment thread tests/unit/sources/test_dispatch_payloads.py
Comment thread tests/unit/sources/test_live_catchup_planning.py Outdated
Replace an aggregate message-count-only check with a direct assertion on
THINKING-block presence/shape, and replace substring checks on an append
payload with an exact byte-slice equality check against the source file's
own bytes (the property #3539/polylogue-u19l actually guarantees).

Ref polylogue-id4n
@Sinity

Sinity commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Both actionable comments addressed in 2d1335f: THINKING-block presence/shape now asserted directly (not just the aggregate count), and the append-payload check is now an exact byte-slice equality against the source file rather than substring checks.

@Sinity
Sinity merged commit 8ed4f91 into master Aug 3, 2026
3 checks passed
@Sinity
Sinity deleted the feature/chore/id4n-fresh-triage branch August 3, 2026 01:54
Sinity added a commit that referenced this pull request Aug 3, 2026
Co-Authored-By: Claude <noreply@anthropic.com>
Sinity added a commit that referenced this pull request Aug 19, 2026
…gbm-quiet, 7qw4) (#4006)

## Summary

Retires the four mechanical rows of the WS-B known-red/false-green
ledger
(`.agent/campaigns/2026-08-overhaul/ws-b-suite-health.md`): uxrim,
bwo2l,
vqt48, and 7qw4 were all already satisfied on master before this branch
was
cut; the one row that needed real work was polylogue-ndgbm's quiet
component (Codex query-cardinality oracle's fixture never emitted a
`message`-shaped record, so the parser's admission gate refused every
payload and the module fixture errored at setup), which this PR fixes
and
whose two associated xfail markers it removes.

## Problem

The ledger recorded five findings as known-red or false-green test debt,
each with a RECIPE and file:line anchors, dispatched here as a themed
sweep.

## Solution

- **uxrim** (`tests/unit/api/test_facade_contracts.py:4789`): the recipe
  asked to extend the `frozen_clock_modules` marker to also cover
  `revision_governance`. Already done — commit 8ed4f91 (PR #3595,
  2026-08-03) landed exactly that extension. No diff needed.
- **7qw4** (`tests/unit/storage/test_store_ops.py`): the recipe asked to
rewrite the test to call the production `aggregate_message_stats` async
  fn and delete a test-local shadow reimplementation. Already done —
commits from PR #3729 (call the repository path) and PR #3813 (assert on
public `origins`) landed this; no shadow function remains in the file.
No
  diff needed.
- **bwo2l + vqt48** (`tests/unit/cli/test_archive_maintenance_cli.py`,
  `tests/unit/sources/test_live_watcher.py`,
`tests/unit/sources/test_live_batch_support.py`): the recipe asked to
give
  refused codex fixtures real conversational content. Already done — the
9ykn positive-evidence-gate fixes landed across several prior PRs
(visible
  in `git log --grep`: #3555, #3572, #3600, #3642, #3841). All 138 + 259
  tests pass.
- **ndgbm quiet component** (`tests/infra/query_manifest_oracle.py`,
`tests/unit/cli/test_query_composition_laws.py`): the actual fix in this
  PR. `QueryCardinalitySession.wire_records()` emitted only
  `function_call`/`function_call_output` response_items — zero
  `message`-shaped records — so `codex.is_supported_session_stream()`
  (`has_message` never set) refused every payload before ingest and the
  module-scoped fixture errored at setup before either test could run.
Added one planted user/assistant message-pair response_item per session
(same wire shape landed for the bwo2l/vqt48 fixtures), which admits the
stream; action-identity assertions are unaffected because they only
count
  tool rows.

  Removing the two xfail markers this unblocks surfaced two further
pre-existing issues that had never been reachable before (the tests
always
  errored at setup), fixed in the same commit:
- The naive-duplicate-id-join mutation test's hand-rolled `actions` view
    predates the production view's `result_state` CASE projection
    (polylogue-cuxz.5, `archive_tiers/index.py:1040`) and crashed with
`sqlite3.OperationalError: no such column: a.result_state` instead of
producing the comparably-wrong row count the test actually asserts on.
    Added the same CASE projection to the test's naive view.
- `find ... then delete --yes --all` has no non-daemon route — it
refuses
outright when the daemon does not answer the `/prepare` call. Added a
daemon-delete stand-in patch on `_submit_daemon_mutation`, mirroring the
    existing pattern in

`test_verb_cardinality.py::TestDeleteCardinalityLargeNonMocked._daemon_delete_route`
    (does the real delete through `ArchiveStore`, just skips the daemon
    process).
  - `_copy_archive`'s plain `shutil.copytree` left the durable bootstrap
    marker bound to the *original* archive root path
(`durable_identity_digest`), so the first write-mode
`ArchiveStore.open_existing`
    at the copied path raised `DurableChangeTrainError: fresh durable
bootstrap marker durable identity mismatch`. Re-bind the marker after
copy, mirroring
`tests/infra/workload_artifacts.py::clone_seeded_archive`.

**ndgbm residual (not closed by this PR):** the bead also names a
second,
separate symptom — the 64-seed process-pool death only reproduces beside
a
saturated 10-worker gate (confirmed load-only: quiet re-run
20260818T231534Z
was green in 43s). That's a load-robustness question the dispatch prompt
asked to coordinate with WS-A's e98k cgroup-mmap-budget findings. I
could not
type this as a `partial` disposition in the machine-readable pr-scope
carrier below: the validator requires a **pre-existing Beads dependency
edge** (`blocks`/`discovered-from`/`relates-to`/`supersedes`) between
ndgbm
and its named successor before it will accept the disposition, and no
such
edge exists between polylogue-ndgbm and polylogue-e98k today. Per the
lane
contract I do not invoke `bd` from a worktree, so I did not create that
link. **Coordinator action needed:** link `polylogue-ndgbm` →
`polylogue-e98k` (or a dedicated new successor) via `bd dep add` (or
equivalent) before ndgbm can be typed `partial` in a carrier; until then
the
bead should stay open with its residual noted in its own notes (already
present).

## Verification

- `devtools test tests/unit/api/test_facade_contracts.py -k
raw_artifacts_read_source_tier` → 1 passed (uxrim, unchanged/confirmed)
- `devtools test tests/unit/cli/test_archive_maintenance_cli.py` → 138
passed (bwo2l, unchanged/confirmed)
- `devtools test tests/unit/sources/test_live_watcher.py
tests/unit/sources/test_live_batch_support.py` → 259 passed (vqt48,
unchanged/confirmed)
- `devtools test tests/unit/storage/test_store_ops.py -k
aggregate_message_stats` → 1 passed (7qw4, unchanged/confirmed);
mutation red-check locally re-applied AG1 (role-swap on the unfiltered
`role_row` query) and AG2 (`words_approx = 0`) against
`polylogue/storage/sqlite/queries/stats.py`, both now fail (`assert 1 ==
2`, `assert 0 == 9`), reverted before commit — no diff shipped for this
row
- `devtools test tests/unit/cli/test_query_composition_laws.py` → 2
passed, 0 xfail (ndgbm quiet component: red→green; both `-p no:testmon`
and cached runs confirmed)
- `devtools verify --quick` → exit 0 (format + lint + mypy + `render all
--check`; no `out of sync` in output)

All four rows were verified in the context that was failing: each
command
above is the exact standalone-context command named in the dispatch
recipe,
run directly (not nested inside a broader suite run).

## Bead disposition matrix

| Bead | Disposition | Evidence | Notes |
| --- | --- | --- | --- |
| polylogue-uxrim | SATISFIED | test pass + commit 8ed4f91 | already
fixed on master, PR #3595 |
| polylogue-bwo2l | SATISFIED | test pass (138/138) | already fixed on
master |
| polylogue-vqt48 | SATISFIED | test pass (259/259) | already fixed on
master |
| polylogue-7qw4 | SATISFIED | test pass + mutation red-check | already
fixed on master (PR #3729, #3813) |
| polylogue-ndgbm | PARTIAL | test pass (2/2, no xfail) + diff | quiet
component fixed this PR; load-only pool-death residual stays open on the
bead — **not represented in the typed carrier below** (see Solution
section: needs a coordinator-created Beads link to type as `partial`) |

<!-- polylogue-pr-scope:v2
{
  "assigned_beads": [
    "polylogue-uxrim",
    "polylogue-bwo2l",
    "polylogue-vqt48",
    "polylogue-7qw4"
  ],
  "dispositions": [
    {
      "bead_id": "polylogue-uxrim",
      "disposition": "satisfied",
      "evidence": [
        {
          "kind": "test",
"ref":
"tests/unit/api/test_facade_contracts.py::test_archive_tiers_api_raw_artifacts_read_source_tier"
        },
        {
          "kind": "commit",
          "ref": "8ed4f9101813aa142bc915e9c70ef439b86a100d"
        }
      ],
      "successors": []
    },
    {
      "bead_id": "polylogue-bwo2l",
      "disposition": "satisfied",
      "evidence": [
        {
          "kind": "test",
          "ref": "tests/unit/cli/test_archive_maintenance_cli.py"
        }
      ],
      "successors": []
    },
    {
      "bead_id": "polylogue-vqt48",
      "disposition": "satisfied",
      "evidence": [
        {
          "kind": "test",
          "ref": "tests/unit/sources/test_live_watcher.py"
        },
        {
          "kind": "test",
          "ref": "tests/unit/sources/test_live_batch_support.py"
        }
      ],
      "successors": []
    },
    {
      "bead_id": "polylogue-7qw4",
      "disposition": "satisfied",
      "evidence": [
        {
          "kind": "test",
"ref":
"tests/unit/storage/test_store_ops.py::test_aggregate_message_stats_reports_public_contract"
        }
      ],
      "successors": []
    }
  ],
  "mutated_beads": [],
"scope_digest":
"e397dd57058877a651382c5cf8f681b4cffabc7aae67e285f7192b2c62c787ad",
  "scope_kind": "bead",
  "version": 2
}
-->

Ref polylogue-uxrim, polylogue-bwo2l, polylogue-vqt48, polylogue-ndgbm,
polylogue-7qw4

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01HWcPJJJvuF25CqVwTFgSQC

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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