Skip to content

Export signed native histories with limited replay scope - #147

Merged
unbraind merged 10 commits into
mainfrom
feat/change-bundles
Oct 23, 2026
Merged

unbraind merged 10 commits into
mainfrom
feat/change-bundles

Conversation

@unbraind

@unbraind unbraind commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Agents can exchange selected native histories through signed vcs bundle export, inspect and import operations. The receiver independently supplies exact path/ref authority, trusted keys and destination leases. Native identities and full selected ancestry are preserved; mixed-scope or incomplete histories refuse before object admission.

Previously, ordinary bundles did not express a signed selective replay contract. This implementation binds scope, exact tips, included/excluded inventories, unknown omissions, archive digest and signer in a domain-separated Ed25519 manifest. It reuses native closure validation, writer leases, ref transactions and publication policies. Reports remain compact, and the SDK and installed CLI work in real non-Git trackers.

The reviewed import safeguards are present and freshly verified:

Finding Result and regression
Destination parent/child ref collisions could partially publish a batch The complete incoming namespace and existing destination filesystem are checked before objects are stored. destination ref namespace collisions refuse the whole import before storing objects covers the exact refs/heads/0, refs/heads/a, refs/heads/a/b batch, existing collisions in both directions and empty directories. Refusal is typed bundle_ref_conflict with a remedy; inventory and refs stay unchanged.
A manifest signer revoked during object admission could publish The receiver grant and effective revocations are checked again immediately before ref writes, under the object lease and destination locks. manifest signer revoked during object admission cannot publish refs covers scheduled/appended revocations, removed grants and freshly loaded local revocations. No refs publish.

Fresh independent behavioral revert proofs after integrating main:

  • Removing only the destination admission guard made node --test --test-concurrency=1 --test-name-pattern="destination ref namespace" test/change-bundles.test.ts fail 0/1 with EISDIR. Restoring it passed 1/1.
  • Removing only the publication-time manifest signer checks made node --test --test-concurrency=1 --test-name-pattern="manifest signer revoked" test/change-bundles.test.ts fail 0/1 with Missing expected exception. Restoring them passed 1/1.
  • Each proof kept the other safeguard active, and the production source was restored exactly.

The whole PR diff was rechecked for exact-name map comparisons, complete closure and path/checkpoint/copy scope, metadata isolation, complete ref-set admission, publication-time trust and CLI boundaries. No additional valid defect was found. The current review-thread inventory has zero unresolved threads, with complete pagination. CodeRabbit has no review body or Outside diff range findings: its issue comment reports that automatic review was skipped. No review thread was replied to or resolved.

Main was integrated in f8dc430, with CHANGELOG.md regenerated inside the merge and the generated self-host conflict resolved by rebuilding from staged source. Fresh evidence and the released tracker claim are committed in d0f925c and 827c073. The two blocking safeguards were already present at the pulled remote head; no production-code change was necessary in this round. The final pushed head is 827c07352dd0197b95d51e2f1e61da5280c24bd5.

Validation:

  • node --test --test-concurrency=1 test/change-bundles.test.ts test/bundle.test.ts: 34/34, zero failures, skips, cancellations or todo.
  • bun test --timeout 120000 ./test/change-bundles.test.ts: 24/24, zero failures.
  • Linked pm test pm-vcs-change-bundles --run --only-last --progress: 3/3 publication scenarios, zero failure categories.

Final-head CI run 40009840699 passed on 827c07352dd0197b95d51e2f1e61da5280c24bd5:

Runtime npm run release:check bun run release:check Direct Bun scenarios
Node 22 / Bun 1.3.14 1,880/1,880 1,880/1,880 32/32
Node 26 / Bun 1.3.14 1,880/1,880 1,880/1,880 32/32

All four full release gates measured 100% statements, branches, functions and lines across the intended 80-file production inventory, with zero failed, skipped, cancelled or todo tests. Both Windows launcher jobs and final-head CodeQL passed. No CI retry was required in this round. A separate local npm release gate with temporary HOME and disabled global/system Git config also passed (1,880/1,880; all four coverage dimensions 100%). The duplicate local Bun gate was stopped after the complete final-head CI matrix passed; it is not counted as passing gate evidence.

The unchanged release gates include native acceptance, stat-cache acceptance, committed self-host verification, production and identity audits, packaging, changelog and release-attestation checks. Local dist was rebuilt; dist remains ignored. The tracked text self-host archive was regenerated after staging tracker evidence. No thresholds, coverage scope or ignore policy changed, and history remains append-only.

Tracker: pm-vcs-change-bundles, tagged gh:unbraind/pm-vcs#147, left in progress with its claim released for orchestrator verification. No new pm CLI/SDK defect was established. The existing local extension-version health coupling remains tracked by pm-vcs-5lre; final-head CI project-health checks passed.

The v1 format remains bounded to 32 MiB and carries complete selected histories. Authorized admitted objects may remain after a publication-time signer/checkpoint refusal, while refs remain unpublished. See the contract and measured public-tracker example. No PR merge or release was performed.

@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Sorry @unbraind, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 18 hours and 34 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 30bc9781-bfe8-4d36-af6a-2d3570edc782
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR implements capability-limited native history bundles end to end: the SDK creates and verifies domain-separated signed manifests over exact selected closures, receivers independently authorize scope and destination leases, CLI commands expose the workflow, and comprehensive tests verify fail-closed behavior before storage while preserving native identities and local publication policies.

Sequence diagram for signed change bundle export and import

sequenceDiagram
    actor Sender
    participant CLI as VCSCommands
    participant SDK as ChangeBundleSDK
    participant Source as SourceObjectStore
    participant Receiver as ReceiverRepository
    participant Policy as ReceiverAuthorization

    Sender->>CLI: vcs bundle export
    CLI->>SDK: exportChangeBundle
    SDK->>Source: collectCommitObjects
    SDK->>Source: closure validation
    SDK->>SDK: sign manifest with Ed25519
    SDK-->>CLI: signed change bundle
    Sender->>CLI: vcs bundle inspect or import
    CLI->>SDK: parseChangeBundleAuthorization
    CLI->>SDK: inspectChangeBundle or importChangeBundle
    SDK->>Policy: verify trusted key and receiver scope
    SDK->>Receiver: validate closure and destination leases
    alt authorization or closure refused
        SDK-->>CLI: ChangeBundleRefusal
    else authorized
        SDK->>Receiver: importBundleObjects
        SDK->>Receiver: refs.transaction
        SDK-->>CLI: compact change bundle report
    end
Loading

Entity relationship diagram for signed change bundle authorization

erDiagram
    CHANGE_BUNDLE_MANIFEST {
        int version
        string scope
        string tips
        string included
        string excluded
        boolean unknownOmissions
        string archiveDigest
        string signer
        string publicKey
    }
    RECEIVER_AUTHORIZATION {
        string scope
        string trustedKeys
        string revocations
    }
    DESTINATION_LEASE {
        string branchRef
        string expectedObjectId
    }
    NATIVE_OBJECT {
        string objectId
        string objectType
    }

    RECEIVER_AUTHORIZATION ||--|| CHANGE_BUNDLE_MANIFEST : limits
    CHANGE_BUNDLE_MANIFEST ||--o{ NATIVE_OBJECT : includes
    CHANGE_BUNDLE_MANIFEST ||--o{ NATIVE_OBJECT : excludes
    DESTINATION_LEASE }o--|| CHANGE_BUNDLE_MANIFEST : authorizes
Loading

File-Level Changes

Change Details Files
Added a signed, capability-limited native history exchange protocol with independent receiver authorization and exact completeness semantics.
  • Introduced typed SDK APIs for exporting, inspecting, and importing selected native commit closures.
  • Bound scope, tips, inventories, omission state, archive digest, signer, and public key with domain-separated Ed25519 signatures.
  • Validated role-aware native closure, checkpoint dependencies, copied-file identities, external references, mixed scopes, and unknown omissions before storage.
  • Preserved native object identities while excluding repository identity, erasure metadata, and unrelated receiver-held objects from imported archives.
engine/change-bundles.ts
engine/bundle.ts
index.ts
Exposed the change-bundle workflow through explicit CLI commands and documented the sender/receiver contract.
  • Registered export, inspect, and import commands with bounded input parsing, external signing keys, independent authorization files, compact reports, and private non-overwriting outputs.
  • Added exact destination branch leases and retained local signature/checkpoint publication policy during import.
  • Documented schemas, refusal behavior, scope and completeness semantics, SDK usage, operational limits, and public-tracker validation.
change-bundle-commands.ts
vcs-commands.ts
README.md
docs/change-bundles.md
Added comprehensive regression coverage and CI execution for selective bundle security and interoperability.
  • Covered tampering, trust and revocation, malformed contracts, missing or extra objects, cross-scope references, checkpoint dependencies, copy provenance, leases, partial histories, erasure state, and oversized archives.
  • Verified SDK and installed CLI behavior in non-Git repositories with unchanged inventories and refs on refusal.
  • Added the change-bundle suite to the Bun release gate and recorded tracker/history metadata.
test/change-bundles.test.ts
.github/workflows/ci.yml
.agents/pm/features/pm-vcs-change-bundles.toon
.agents/pm/history/pm-vcs-change-bundles.jsonl
selfhost.bundle

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Comment thread test/change-bundles.test.ts Fixed

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@unbraind unbraind left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Orchestrator review (built-in Claude review agent, verified by the orchestrator; bots are not waited for since 2026-10-22):

Pre-merge review (codex gpt-6.1-sol read-only review agent; merged by the orchestrator's pipeline after a MERGE verdict and a private-data scan of the added lines).

VERDICT: MERGE
FINDINGS:

  • none
    SUMMARY: The PR adds signed selective native-history bundles with independent receiver scope, trust, and destination leases. The reviewed tests cover tampering, scope enforcement, closure, ref collisions, revocation, and non-Git operation; they were not run locally.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@unbraind unbraind left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Orchestrator review (built-in Claude review agent, verified by the orchestrator; bots are not waited for since 2026-10-22):

Pre-merge review (codex gpt-6.1-sol read-only review agent; merged by the orchestrator's pipeline after a MERGE verdict and a private-data scan of the added lines).

VERDICT: MERGE
FINDINGS:

  • none
    SUMMARY: The PR adds signed native-history bundles with independent receiver scope, trust, and exact ref leases. The 24 new tests cover tampering, incomplete closure, scope violations, publication safeguards, and non-Git CLI operation; I reviewed them statically without executing them.

@unbraind
unbraind merged commit a8afb1a into main Oct 23, 2026
10 checks passed
@unbraind
unbraind deleted the feat/change-bundles branch October 23, 2026 19:48
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.

2 participants