Skip to content

fix(reindex): restore source-authoritative acceptance - #3949

Merged
Sinity merged 11 commits into
masterfrom
feature/fix/suite-durable-fixtures
Aug 12, 2026
Merged

fix(reindex): restore source-authoritative acceptance#3949
Sinity merged 11 commits into
masterfrom
feature/fix/suite-durable-fixtures

Conversation

@Sinity

@Sinity Sinity commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

Restore source-authoritative reindex acceptance across retained-raw replay, logical source coverage, convergence backlog accounting, daemon maintenance probing, and campaign fixtures. This update also closes the exact-head review findings for durable cohorts, receipt source semantics, terminal frozen replay evidence, seeded artifact identity, and seed-testmon shard policy.

Problem

Source/index coverage recognized valid byte-supersession receipts without binding the receipt to its acquisition coordinate. Retained membership aliases could split a logical cohort across coverage, convergence, and sampling. Frozen replay still dispatched typed terminal non-session evidence, while seeded artifacts omitted emitter behavior and generated seed-testmon shards escaped broad-run workspace policy.

Solution

The authority layer now owns one canonical, membership-aware cohort expression used by coverage, convergence freshness, and schema sampling. Byte-duplicate planning and receipt verification require matching origin, source path, and source index. Replay census rows carry durable terminal non-session evidence so historical and frozen paths account for those raws without parser dispatch. The lowering fingerprint includes sources/emitter.py, and generated seed-testmon shard labels use the broad-run basetemp policy.

Verification

  • Focused source-authority, replay, workload, source, and harness selection: 386 passed, 1 skipped in 149.24s. The only failure was a test-only assertion against a nonexistent census field; its corrected exact node passed in 1.58s.
  • devtools verify --quick: all 25 steps succeeded in 195.73s at edfcf9812.
  • The pre-push quick baseline also completed before publishing exact head edfcf9812.

Anti-vacuity: a receipt with identical bytes but a different source path remains an untyped source error. Provider-wire and public-origin aliases resolve to one retained-membership cohort in both coverage and sampling. Typed terminal corrupt evidence is censused without entering parser replay, an emitter mutation changes the seeded artifact key, and a generated seed-testmon shard receives broad-run policy.

Current exact head: edfcf9812eac632d4721df63bdc59abd26fa18a8.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The pull request changes managed pytest storage and resource selection, adds cgroup-aware budgeting, improves event tracking, updates stale basetemp cleanup, revises archive replay and logical-head governance, adds source-semantics archive identity, and updates daemon and archive integration paths.

Pytest runtime

Layer / File(s) Summary
Memory policy and storage selection
polylogue/core/metrics.py, devtools/verify_runs.py
Runtime policy uses cgroup headroom, measured memory envelopes, worker counts, suite mode, and predicted basetemp demand to select scratch or tmpfs storage.
Pytest orchestration and events
devtools/verify.py, devtools/verify_slos.py, devtools/run_tests.py
Managed pytest and benchmark subprocesses receive computed runtime settings, repository-rooted artifact paths, and configurable event sources.
Basetemp cleanup and guidance
tests/conftest.py, tests/unit/test_pytest_temp_policy.py, CLAUDE.md, TESTING.md
Bare pytest runs use scratch storage. Ownership markers include process start identity. Stale cleanup handles read-only trees and symlinks.
Runtime policy tests
tests/unit/devtools/test_verify.py, tests/unit/devtools/test_run_tests.py, tests/unit/devtools/test_slo_catalog.py, tests/unit/core/test_metrics_cgroup_memory_limits.py
Tests cover worker parsing, resource admission, storage placement, benchmark wiring, cgroup limits, event paths, and progress monitoring.

Archive governance

Layer / File(s) Summary
Logical heads and coverage
polylogue/maintenance/archive_verification.py, polylogue/schemas/sampling_db.py
Logical-head grouping prioritizes logical_source_key. Valid byte-supersession receipts are included in evidence and excluded from blocking gaps.
Replay-safe enrichment
polylogue/sources/revision_backfill.py, polylogue/storage/sqlite/archive_tiers/revision_governance.py
Replay uses persisted sidecars and hook titles without mutable source reads. Non-session artifacts receive empty durable identity sets.
Source semantics and event identity
polylogue/sources/emitter.py, polylogue/sources/assembly_chatgpt.py, tests/infra/workload_artifacts.py
Repository-identity events are no longer emitted. Seeded archive keys and manifests include source-semantics fingerprints.
Governance validation
tests/unit/maintenance/test_archive_verification.py, tests/unit/storage/test_revision_replay.py, tests/infra/pathology_zoo.py, tests/infra/reindex_campaign.py
Tests cover failure lifecycle classification, logical-source reacquisition, supersession receipts, terminal corrupt input, and historical evidence backfill.

Archive operations

Layer / File(s) Summary
Archive bootstrap
devtools/campaign_archive_location.py, devtools/scale_regression_probe.py, tests/unit/api/test_operation_executor_routes.py, tests/unit/devtools/test_index_fast_forward.py, tests/unit/operations/test_mutation_actuators.py
Archive acquisition creates secure directories before ownership handling. Setup paths use initialize_active_archive_root.
Degraded daemon probing
polylogue/daemon_client.py, polylogue/daemon/bulk_rebuild.py, tests/unit/cli/test_daemon_client.py
Health requests support accepted status sets. Probes can explicitly accept matching 503 responses.
Production canary and ownership tests
polylogue/maintenance/reindex_canary.py, tests/unit/maintenance/test_reindex_canary.py, tests/unit/maintenance/test_reindex_campaign.py, tests/unit/daemon/test_bulk_rebuild_ownership.py
Canary execution uses production daemon routes. Ownership tests verify rejection while an archive is held and release after resolution.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • Sinity/polylogue#3948: Overlaps directly with pytest tmpfs budgeting, cgroup headroom, managed scratch policy, and event supervision.
  • Sinity/polylogue#3940: Overlaps with pytest worker handling, basetemp policy, and xdist stall detection.
  • Sinity/polylogue#2689: Overlaps with revision backfill replay and census behavior.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.93% 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
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.
Title check ✅ Passed The title clearly identifies the main change: restoring source-authoritative acceptance for reindex operations.
Description check ✅ Passed The description covers the required summary, problem, solution, verification, and scope details with clear evidence; omitted Changelog and Risks sections are non-critical.
✨ 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/fix/suite-durable-fixtures

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.

@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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
polylogue/maintenance/archive_verification.py (1)

2403-2420: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Exclude valid supersession receipts from the convergence backlog.

_check_source_index_coverage_at_index_path treats a validated supersession receipt as covered. _unindexed_backlog_gap does not validate or exclude that receipt type.

A valid unindexed byte duplicate will therefore produce a nonzero I6 gap. The convergence check can then return WARNING or ERROR even though I1 reports no actionable gap.

Apply the same receipt, blob, and indexed-twin validation before this query counts a head. Add a regression test that a valid receipt produces unindexed_backlog_gap == 0.

🤖 Prompt for 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.

In `@polylogue/maintenance/archive_verification.py` around lines 2403 - 2420,
Update _unindexed_backlog_gap to validate and exclude valid supersession
receipts using the same receipt, blob, and indexed-twin checks as
_check_source_index_coverage_at_index_path before counting a head. Preserve
counting for genuinely unindexed duplicates, and add a regression test asserting
a valid supersession receipt yields unindexed_backlog_gap == 0.
tests/unit/devtools/test_verify.py (1)

324-339: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Two tests exercise the real basetemp placement resolver without isolating it. Both sites let resolve_pytest_basetemp_root probe real host paths and real free space, so the result depends on whether /realm/tmp is mounted and on the actual free space of the referenced directory. The module already provides _patch_basetemp_roots and _patch_resource_capacity for exactly this purpose.

  • tests/unit/devtools/test_verify.py#L324-L339: call _patch_basetemp_roots(monkeypatch, tmp_path, realm_mounted=True) and assert POLYLOGUE_PYTEST_BASETEMP_ROOT against the returned scratch path instead of the module constant.
  • tests/unit/devtools/test_verify.py#L2297-L2316: create the nvme_root directory or patch verify_runs._fs_usage so the configured root clears the headroom preflight and _run does not return 125.
🤖 Prompt for 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.

In `@tests/unit/devtools/test_verify.py` around lines 324 - 339, Isolate both
tests from real basetemp placement and filesystem capacity. In
tests/unit/devtools/test_verify.py lines 324-339, call
_patch_basetemp_roots(monkeypatch, tmp_path, realm_mounted=True) and assert the
environment value against its returned scratch path rather than
verify_runs.DEFAULT_PYTEST_BASETEMP_ROOT; in lines 2297-2316, create the
nvme_root directory or patch verify_runs._fs_usage so the configured root passes
headroom preflight and _run does not return 125.
🤖 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 `@CLAUDE.md`:
- Around line 512-519: Update the pytest scratch-space documentation near the
focused-run description to state that bare pytest invocations without
POLYLOGUE_VERIFY_RUN_ID or an explicit basetemp root force
POLYLOGUE_PYTEST_TMPFS=0 and use the NVMe default. Clarify that bounded /dev/shm
tmpfs applies only to managed devtools test/verify runs when the effective
budget permits it.

In `@devtools/verify.py`:
- Around line 2199-2208: Define shared constants for the broad pytest labels and
reuse them in both build_verify_steps and _pytest_uses_full_suite_basetemp.
Replace duplicated label literals, including the labels currently checked by the
startswith tuple, so renaming a broad step updates both resource-admission paths
consistently.

In `@polylogue/daemon_client.py`:
- Around line 100-104: The health probe in polylogue/daemon_client.py lines
100-104 must retain the response status and, when accept_degraded is true,
accept HTTP 503 only if the typed lifecycle field indicates the supported
degraded state; preserve normal HTTP 200 acceptance and reject other 503 states.
In tests/unit/cli/test_daemon_client.py lines 116-164, add a matching
non-degraded 503 fixture and assert that accept_degraded=True rejects it.

In `@tests/unit/devtools/test_run_tests.py`:
- Around line 36-50: Strengthen
test_build_pytest_cmd_forwards_all_xdist_worker_spellings by asserting that the
generated command contains exactly one worker-count flag for each selection,
preventing _worker_args from adding a conflicting default such as “-n 0”. Retain
the existing assertions that every supplied argument is forwarded.

In `@tests/unit/devtools/test_verify.py`:
- Around line 1692-1709: Update
test_production_pytest_commands_reserve_every_xdist_spelling to remove
PYTEST_XDIST_AUTO_NUM_WORKERS from os.environ before exercising the three auto
worker-argument cases, ensuring _pytest_command_concurrency uses the CPU-count
fallback independently of the host environment while leaving the other parameter
cases unchanged.

---

Outside diff comments:
In `@polylogue/maintenance/archive_verification.py`:
- Around line 2403-2420: Update _unindexed_backlog_gap to validate and exclude
valid supersession receipts using the same receipt, blob, and indexed-twin
checks as _check_source_index_coverage_at_index_path before counting a head.
Preserve counting for genuinely unindexed duplicates, and add a regression test
asserting a valid supersession receipt yields unindexed_backlog_gap == 0.

In `@tests/unit/devtools/test_verify.py`:
- Around line 324-339: Isolate both tests from real basetemp placement and
filesystem capacity. In tests/unit/devtools/test_verify.py lines 324-339, call
_patch_basetemp_roots(monkeypatch, tmp_path, realm_mounted=True) and assert the
environment value against its returned scratch path rather than
verify_runs.DEFAULT_PYTEST_BASETEMP_ROOT; in lines 2297-2316, create the
nvme_root directory or patch verify_runs._fs_usage so the configured root passes
headroom preflight and _run does not return 125.
🪄 Autofix

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: 9562f077-520f-4eeb-9bcf-b1ca14b6287b

📥 Commits

Reviewing files that changed from the base of the PR and between 9510463 and a6080a5.

📒 Files selected for processing (39)
  • CLAUDE.md
  • TESTING.md
  • devtools/campaign_archive_location.py
  • devtools/run_tests.py
  • devtools/scale_regression_probe.py
  • devtools/verify.py
  • devtools/verify_runs.py
  • devtools/verify_slos.py
  • polylogue/core/metrics.py
  • polylogue/daemon/bulk_rebuild.py
  • polylogue/daemon_client.py
  • polylogue/maintenance/archive_verification.py
  • polylogue/maintenance/reindex_canary.py
  • polylogue/schemas/sampling_db.py
  • polylogue/sources/assembly_chatgpt.py
  • polylogue/sources/emitter.py
  • polylogue/sources/revision_backfill.py
  • polylogue/storage/sqlite/archive_tiers/revision_governance.py
  • tests/conftest.py
  • tests/infra/pathology_zoo.py
  • tests/infra/reindex_campaign.py
  • tests/infra/workload_artifacts.py
  • tests/unit/api/test_operation_executor_routes.py
  • tests/unit/cli/test_daemon_client.py
  • tests/unit/core/test_metrics_cgroup_memory_limits.py
  • tests/unit/core/test_schema_generation.py
  • tests/unit/daemon/test_bulk_rebuild_ownership.py
  • tests/unit/devtools/test_index_fast_forward.py
  • tests/unit/devtools/test_run_tests.py
  • tests/unit/devtools/test_slo_catalog.py
  • tests/unit/devtools/test_verify.py
  • tests/unit/infra/test_workload_artifacts.py
  • tests/unit/maintenance/test_archive_verification.py
  • tests/unit/maintenance/test_reindex_campaign.py
  • tests/unit/maintenance/test_reindex_canary.py
  • tests/unit/operations/test_mutation_actuators.py
  • tests/unit/sources/test_source_laws.py
  • tests/unit/storage/test_revision_replay.py
  • tests/unit/test_pytest_temp_policy.py
💤 Files with no reviewable changes (2)
  • polylogue/maintenance/reindex_canary.py
  • tests/unit/maintenance/test_reindex_canary.py

Comment thread CLAUDE.md Outdated
Comment thread devtools/verify.py Outdated
Comment thread polylogue/daemon_client.py Outdated
Comment thread tests/unit/devtools/test_run_tests.py
Comment thread tests/unit/devtools/test_verify.py

@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: a6080a5b2e

ℹ️ 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 thread devtools/verify_runs.py
Comment thread polylogue/maintenance/archive_verification.py
Comment thread polylogue/maintenance/archive_verification.py Outdated
@Sinity
Sinity force-pushed the feature/fix/suite-durable-fixtures branch from a6080a5 to 81da9e9 Compare August 11, 2026 17:07
@Sinity

Sinity commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head 81da9e9e706319f6c311f018cd55ca7b33b8fca6, rebased after #3948 with the superseded tmpfs history removed. Focus on source/index authority, supersession-receipt validity, typed degraded maintenance probing, and anti-vacuity of the production-route tests.

@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: 81da9e9e70

ℹ️ 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 thread tests/unit/maintenance/test_archive_verification.py
Sinity added 6 commits August 11, 2026 19:45
Route stale multi-tier fixtures through the owned active-root bootstrap. Preserve the fast-forward test generation layout after bootstrap, and allow campaign ownership acquisition to create a documented fresh output directory before its descriptor is locked.
Seed test-owned external evidence and run the schema-inference gate before ownership assertions. The ownership tests isolate source admission because the minimal gate corpus intentionally has no replay census.
Cached real-pipeline archives were keyed by Git HEAD and a short recipe file list. Dirty worktree parser changes could therefore reuse stale archives and produce order-dependent fingerprint failures. Include the actual parser and lowering semantic digest in cache identity and manifest provenance.
Retained-raw replay now reapplies only frozen source-tier enrichment, including every spill fallback, so candidate hashes and titles do not depend on cache order or ambient files. Source coverage, typed failure dispositions, pathology fixtures, degraded daemon discovery, and candidate campaign checks now exercise the same authority boundaries used by the production rebuild.
Problem: convergence freshness and source/index coverage could classify durable revision evidence differently. A retired raw lost its raw-level cohort key, and an unsafe configured tmpfs root remained selected after policy disabled tmpfs.\n\nWhat changed: share the durable logical-cohort and content-bound supersession rules across both verification paths, preserve the sole retained membership identity, reroute unsafe configured tmpfs roots to scratch, and pin the receipt-removal and shared-raw counterexamples.\n\nCompatibility: existing multi-membership raw acquisitions retain their native/path fallback because no single membership identity is authoritative.
@Sinity
Sinity force-pushed the feature/fix/suite-durable-fixtures branch from 81da9e9 to 124989c Compare August 11, 2026 17:50
@Sinity

Sinity commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head 124989c4dd50e4eee01298492b30c84825369ffa. Focus on shared content-bound supersession evidence across coverage and convergence, retained-membership cohort grouping, receipt-removal anti-vacuity, and configured tmpfs-root rerouting.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 124989c4dd

ℹ️ 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".

Sinity added 2 commits August 12, 2026 21:33
…urable-fixtures

# Conflicts:
#	devtools/verify.py
…urable-fixtures

# Conflicts:
#	tests/unit/sources/test_source_laws.py

@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: 3817f13520

ℹ️ 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 thread devtools/verify.py Outdated
Comment thread polylogue/schemas/sampling_db.py Outdated
Comment thread polylogue/storage/sqlite/archive_tiers/revision_governance.py
@Sinity

Sinity commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head 3817f135209639d586eaac423933095933d0b9cb after integrating current master. Focus on source-authoritative revision membership, valid byte-supersession receipts, retained-raw replay enrichment, daemon degraded probing, and the source-semantics fingerprint. Report only actionable defects.

@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: 3817f13520

ℹ️ 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 thread polylogue/maintenance/archive_verification.py
Comment thread tests/infra/workload_artifacts.py
Comment thread polylogue/maintenance/archive_verification.py Outdated
Sinity added 3 commits August 12, 2026 22:37
Bind byte-duplicate supersession to the source coordinate that can affect replay, and share canonical provider/origin cohort identity across verification and schema sampling.
Honor durable non-session evidence during the historical and frozen replay census so malformed terminal artifacts are accounted for without parser dispatch.
Classify generated seed-testmon shards as broad pytest runs and include session-emitter behavior in seeded artifact source semantics.
@Sinity

Sinity commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review\n\nPlease review exact head edfcf98. The addressed areas are source-authority cohorting, receipt semantics, frozen replay, seeded artifact identity, and seed-testmon shard policy.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: edfcf9812e

ℹ️ 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".

@Sinity
Sinity merged commit 931f82a into master Aug 12, 2026
3 checks passed
@Sinity
Sinity deleted the feature/fix/suite-durable-fixtures branch August 12, 2026 21:26
Sinity added a commit that referenced this pull request Aug 17, 2026
polylogue-9kj24: PR #3949 narrowed plan_byte_duplicate_supersession to require
a twin sharing (origin, source_path, source_index), but raw_artifacts carries a
UNIQUE index on exactly that triple. The only duplicate class the planner still
recognises is one the schema prevents from existing, which leaves four tests red
against the pre-#3949 cross-path semantics. Needs a product decision rather than
a test edit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HWcPJJJvuF25CqVwTFgSQC
Sinity added a commit that referenced this pull request Aug 17, 2026
#3949 narrowed plan_byte_duplicate_supersession's twin match to require an
identical (origin, source_path, source_index), which made the class it detects
unreachable: raw_artifacts carries a UNIQUE index on exactly that triple for
every non-deferred artifact kind, so two raws sharing one coordinate cannot both
exist. The duplicates that do exist -- polylogue-vzn6 measures them at ~46% of
stored blob bytes -- are identical bytes acquired at different paths, e.g. the
same export re-downloaded.

Origin equality is kept so a codex raw cannot supersede a chatgpt one. The real
safety gate was always the next step, which only counts a twin that is already
materialized in index.db.

Also fixes the stale-observation refresh case: inspect_raw_artifact keys the
observation id on the origin, the test seeded it from the provider, so the
refresh missed the seeded row and inserted a second observation for the same
source identity -- rejected by that same UNIQUE index.

And allowlists _handle_cli_delete_authorize in the token-logging scanner. It
returns a single-use authorization to the authenticated CLI caller that must
present it back to /api/cli/delete; handing the token to its rightful owner is
the endpoint's purpose, the same shape as the pairing-redemption entry above it.

Verification: devtools test tests/unit/core/test_verification.py
tests/unit/storage/test_raw_byte_duplicate_supersession.py
tests/unit/storage/test_raw_authority_artifact_census.py -> 38 passed (5
previously failed). tests/unit/daemon/test_daemon_http_security.py -> 576 passed
(1 previously failed). mypy --strict clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HWcPJJJvuF25CqVwTFgSQC
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