Skip to content

refactor: shrink devtools and split archive query reads - #4060

Merged
Sinity merged 92 commits into
masterfrom
feature/overhaul/integration-batch
Aug 22, 2026
Merged

refactor: shrink devtools and split archive query reads#4060
Sinity merged 92 commits into
masterfrom
feature/overhaul/integration-batch

Conversation

@Sinity

@Sinity Sinity commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Summary

Shrink duplicated developer tooling and split archive query reads on feature/overhaul/integration-batch. This branch contains the accepted timestamp-authority and public-origin projection chains in addition to the earlier integration batch.

Problem

The branch previously carried a self-contained PR carrier even though it includes work that overlaps open Beads. That made the GitHub summary weaker than the authoritative tracker and obscured which remaining work is intentionally outside this merge.

Solution

  • Split terminal archive query reads from ArchiveStore while retaining the public delegates and row-type compatibility.
  • Consolidate MCP, CLI, user-tier, and convergence test setup without dropping behavioral coverage.
  • Remove retired devtools proof surfaces and unreachable production modules.
  • Add ordered workspace-lane integration with explicit target, Git-state, conflict, and timeout handling.
  • Add provenance-checked pre-push quick-receipt reuse with safe fallback to fresh verification.
  • Preserve replay cursor continuity and operation-state compatibility across resumable runs.
  • Repair timestamp authority across acquisition, live admission, replay, and raw revision paths.
  • Derive public origin filters and discovery projections from OriginSpec across CLI, DSL, MCP, and completion.
  • Preserve async admission through executor completion and merge delegation evidence deterministically.

Verification

Focused managed tests were run for the touched storage, query, devtools, replay, MCP, source, admission, timestamp, and origin surfaces. The exact branch head also passed devtools verify --quick. These checks do not claim a complete-corpus run; devtools verify --all was not run.

Bead disposition

Bead or workstream Disposition Evidence Remaining scope
Replay continuity and cursor persistence Partial Focused replay and maintenance tests on the exact branch Continue campaign acceptance and live-proof work through the authoritative Beads graph
Archive query-read split Satisfied for this PR Focused archive query/storage tests and quick verification None in this PR
Public origin projections Satisfied for this PR Origin, query, CLI, MCP, completion, and discovery focused tests None in this PR
Timestamp authority Satisfied for this PR Acquisition, replay, raw-admission, and revision focused tests None in this PR
Native reindex campaign control Not claimed Current Beads status is open after independent re-review Complete the remaining provenance, formula, census, DAG, and malformed-input contracts in its owning workstream
Other open maintenance and blob-retirement Beads Not claimed Current Beads status remains authoritative Continue their independent acceptance and documentation work; this PR does not close them

The branch is a coherent integration batch, but it does not claim completion of the native reindex campaign or unrelated open Beads. The current Beads export is the authority for those residual scopes.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2e9245c3-6517-4416-8b98-91a027a42e7a


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 22 commits August 21, 2026 23:57
…sition

The reuse gate samples HEAD once at the top of run_gate and never
re-checks it before committing to "reused". A concurrent HEAD move to a
different commit with an identical tracked tree (amend, rebase --onto,
another writer) is invisible to worktree_fingerprint, so reuse still
fires against a receipt that no longer matches what is about to be
pushed.

This test simulates that transition by faking the second `git rev-parse
HEAD` sample (currently absent) and asserts the gate falls back to a
fresh quick verification instead of reusing. Currently fails: the gate
reuses regardless.
…euse

The reuse gate sampled HEAD once at the top of run_gate and never
re-checked it before returning "reused". worktree_fingerprint diffs
tracked content against HEAD, so it cannot distinguish "nothing
changed" from "HEAD moved to a different commit with an identical
tree" (amend, rebase --onto, a concurrent writer) — a receipt could be
reused against a HEAD it no longer describes.

run_gate now re-samples live HEAD immediately before committing to
reuse and requires it still equal both the initially observed HEAD and
every non-delete pushed local SHA, alongside the existing provenance
(environment + worktree fingerprint) re-check. Added a comment making
explicit that this is an opportunistic same-user performance
optimization, not an authorization or attestation boundary — it should
not grow into full re-verification or arbitrary-state fingerprinting.

Ref polylogue receipt-reuse correctness review (independent review of
5b1396921, fix(devtools): harden pre-push receipt provenance).
Delete the two modules after repository-wide reachability checks found no consumers. Remove their stale documentation references while retaining the live resume brief builder.

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

Claude-Session: https://claude.ai/code/session_013Euo3GTawxdtdRgob9B5ke
The consolidated MCP read tools use the async admission context, so the previous blocking hook never observed a lease and made the synchronization assertion fail before exercising the route. Instrument the public async context and rendezvous in a worker thread after admission to preserve the concurrent lease assertion.

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

Claude-Session: https://claude.ai/code/session_013Euo3GTawxdtdRgob9B5ke
Polylogue tests added 3 commits August 22, 2026 07:46
Replay continuity tests exercised the retired orphaned_blobs target after its accepted removal. Use superseded_raw_snapshots so the identity-remapping and retry contracts continue to enter the active maintenance catalog.

@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: 466a0cab45

ℹ️ 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 +387 to +390
CommandSpec(
"workspace integrate",
"workspace",
"Apply an ordered list of lane commits to a clean linked integration worktree.",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Document the new integration command in AGENTS.md

Add devtools workspace integrate to the standalone AGENTS.md command list in this change. The new command is registered here and documented in docs/devtools.md, but a repository-wide search finds no corresponding AGENTS.md entry, so agents relying on the mandated standalone instructions will not discover or use it. The repository explicitly requires every devtools extension to be listed there in the same change.

AGENTS.md reference: AGENTS.md:L512-L513

Useful? React with 👍 / 👎.

f"ancestry for source ref {source_ref!r} is ambiguous; target HEAD is not an ancestor; "
"provide explicit --commit SHA values"
)
commits = _git(target, "rev-list", "--reverse", f"{target_head}..{source}")

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 Derive the commit range from the pinned source SHA

Use the already-resolved source SHA here instead of resolving source_ref again. In the parallel-lane scenario this command is designed for, a lane can advance its branch between _commit_sha()/merge-base and this rev-list; the new tip then bypasses the ancestry check performed against the old SHA, so commits from an unvalidated or divergent range can enter the integration plan. Passing f"{target_head}..{source}" keeps planning bound to the exact commit that was checked.

Useful? React with 👍 / 👎.

"""

op_id = operation_id or str(uuid.uuid4())
op_id = str(uuid.uuid4()) if operation_id is None else validate_operation_id(operation_id)

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 Translate invalid operation IDs at the public surfaces

Convert this new ValueError into each surface's typed invalid-argument response instead of allowing it to escape. For example, polylogue ops maintenance run --operation-id ../escape and run-preview reach this call through _run.py:162 without a catch; the similarly changed MaintenanceOperationRegistry.get_operation() is also called unchecked by _status.py:72 and the MCP status dispatcher at server_cutover.py:2037. Consequently ordinary hostile or mistyped user input now becomes an unexpected CLI/MCP exception rather than the structured error behavior already implemented for the daemon HTTP route.

Useful? React with 👍 / 👎.

Polylogue tests added 22 commits August 22, 2026 08:46

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

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

-- value, even when this is the first producer-bearing
-- replay. A derived observation never overwrites producer
-- authority already stored on the session.
WHEN ? AND excluded.created_at_ms IS NOT NULL THEN excluded.created_at_ms

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 timestamp intervals ordered on ordinary replacements

When a non-force, non-append replacement carries a producer created_at later than the currently stored updated_at—for example, after a provider corrects or misreports the creation time—this branch unconditionally advances created_at_ms, while the updated_at_ms CASE falls through to preserving the old value because both force_replace and merge_append are false. The resulting row has created_at_ms > updated_at_ms, despite normalization only guaranteeing that the incoming pair is ordered; clamp the retained update time to the selected creation time or only replace creation time when stored provenance is known to be derived.

Useful? React with 👍 / 👎.

BATCH_LABELS = frozenset({CAMPAIGN_LABEL, "campaign-role:batch", "timing:execution"})
# The migration commit is durable source evidence, not a roster embedded in this
# validator. The source loader below reads it through git without writing state.
CAMPAIGN_SOURCE_REF = "317b59f41f938884d289d48737cfe87ec00bd769:.beads/issues.jsonl"

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 Store the campaign anchor in the checkout

In a shallow checkout such as git clone --depth=1, this fixed ancestor object is absent, so _source_evidence() converts git show's failure into a campaign-source-anchor finding whenever the live export contains the campaign marker. The required devtools lab policy bead-graph --export .beads/issues.jsonl gate therefore exits 1 for an otherwise valid graph; keep the immutable evidence in a tracked file available at HEAD, or explicitly fetch the required object before validating it.

AGENTS.md reference: AGENTS.md:L345-L347

Useful? React with 👍 / 👎.

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

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

),
semantic_reparse="no direct parser; retain unknown evidence until a concrete source adapter is admitted",
display_description="Unrecognized fallback exports",
public_filter=False,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep unknown-export available as a public origin filter

When an archive contains fallback sessions, this flag removes unknown-export from public_origin_tokens(), which now drives both DSL and parameter validation, so queries such as origin:unknown-export fail instead of returning those stored sessions. The repository defines unknown-export as a public query-origin token; keep it accepted by query validators even if completion visibility needs a separate policy.

AGENTS.md reference: AGENTS.md:L296-L300

Useful? React with 👍 / 👎.

@Sinity
Sinity merged commit d250e57 into master Aug 22, 2026
3 checks passed
@Sinity
Sinity deleted the feature/overhaul/integration-batch branch August 22, 2026 12:37
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