Skip to content

feat(cli): sealed edits of issues, PRs and comments in private repos - #93

Merged
PastaPastaPasta merged 1 commit into
masterfrom
feat/cli-sealed-edits
Sep 27, 2026
Merged

PastaPastaPasta merged 1 commit into
masterfrom
feat/cli-sealed-edits

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

What

Until now the CLI refused edits in a private repository. The web edited through sealEdit. This PR adds the CLI equivalent:

  • dg issue edit (title and body)
  • dg pr edit (title and description)
  • dg issue edit-comment <repo> <comment-id> --body/--body-file, new, for issue and PR comments. dg issue view --json comments now carry an id.

In a private repository, each edit works like this:

  • Re-sealed as a whole. The stored document is opened with keys resolved now, and reseal_edit re-seals it with the change applied through seal_props, the same transform as a create.
    • Untouched text, a comment's path, and an importer's imported.author / url carry over.
    • Test a_reseal_edit_is_the_create_transform: re-sealing every shared private_collab_seal vector gives the vector's enc byte for byte.
  • Only enc / epoch are replaced. Any legacy plaintext title / body stored next to enc is cleared in the same replace.
  • The right epoch. Issues and comments re-seal under the current write epoch. A PR re-seals under its own epoch, because its ref-name hashes are keyed by it (§4.5).
    • The PR edit is refused if that epoch is burned (E310) or not held (E307).
    • dg pr edit warns before signing when the PR's epoch is older than the repo's.
  • Guarded by the revision read. replace_document_guarded refuses a replace when another edit landed since: E607, new, documented in docs/errors.md.
    • A missing $revision is an explicit Platform error.
    • After a spent-nonce retry, the message no longer claims nothing was written.

For every repository, public too:

  • The stored document is read first and must be in the named repository (E203 otherwise). So the document's own repository decides whether the edit is sealed.
    • Security review HIGH finding: naming a private comment's id through a public repository used to write its body in plaintext.
  • A non-author is refused before any key work (E601).
  • Unchanged text writes nothing.

Web

The web side of the same fixes is owned by review-parity PR 3 (branch feat/web-review-ia), coordinated with that agent:

  • imported provenance in sealEdit
  • the stored-repoId check (expectRepoId)
  • expectedRevision on comment edits
  • clearing legacy plaintext

This PR is CLI and core only; docs/security/private-repos.md §4.5 says which client guards what today.

Tests

  • cargo clippy --workspace --all-targets --all-features -D warnings is clean, and cargo test --workspace --all-features passes.
  • Each review finding has a failing-first test:
    • an_edit_is_refused_for_a_document_of_another_repo
    • an_edit_by_a_non_author_is_refused_before_any_key_work
    • an_edit_of_a_document_without_a_revision_says_so
    • a_private_replace_clears_legacy_plaintext_next_to_enc
    • a_pr_edit_uses_the_pr_epoch_keys_only_while_held_and_not_burned (burned → E310, unheld → E307, held → its keys)
    • a_replace_against_a_newer_revision_is_refused
    • an_edit_reseals_the_whole_content_and_replaces_only_enc_and_epoch
  • Live on moutai (beta.5), scenario 19 with freshly minted identities: 19/19 checks pass.
    • P_OWNER edits the issue title and the PR description, and P_MEMBER edits their comment.
    • The dump shows every document still sealed, with no plaintext.
    • The PR's epoch and baseRefNameHash are unchanged.
    • The member reads the new text; the untouched body, the sealed label and the base branch are intact.
    • Refused before signing: a non-author's issue edit, a non-author's comment edit (E601), and the cross-repo attempt (E203).
    • The PR still merges.

🤖 Generated with Claude Code

dg issue edit, dg pr edit and the new dg issue edit-comment re-seal the whole content under the right epoch (a PR under its own) and replace only enc/epoch, through the same transform as a create (every private_collab_seal vector re-seals byte for byte). Every edit is guarded by the revision read (E607, new), refused for a document of another repo (so the document's own repo decides sealing) and for a non-author before any key work (E601); legacy plaintext next to enc is cleared.

Scenario 19 covers the edits, the PR's unchanged epoch and base hash, the non-author and cross-repo refusals.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: fc5ef1e0-d481-47b0-a5ae-bfea6980b566

📥 Commits

Reviewing files that changed from the base of the PR and between 98c04d4 and 3d5b766.

📒 Files selected for processing (20)
  • crates/dg/src/errors.rs
  • crates/dg/src/issue.rs
  • crates/dg/src/main.rs
  • crates/dg/src/pr/state.rs
  • crates/forge-core/src/collab/private.rs
  • crates/forge-core/src/collab/v2.rs
  • crates/forge-core/src/keyring.rs
  • crates/forge-core/src/platform/mod.rs
  • crates/forge-core/src/private/conformance.rs
  • crates/forge-core/src/refs.rs
  • crates/forge-core/src/repo.rs
  • crates/forge-core/src/user_error.rs
  • crates/forge-core/src/webhooks.rs
  • crates/forge-relay/src/daemon.rs
  • crates/forge-relay/src/ingest.rs
  • docs/errors.md
  • docs/guides/collaborating.md
  • docs/security/private-repos.md
  • e2e/README.md
  • e2e/cli/scenarios/19-private-collab.sh

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.

@PastaPastaPasta
PastaPastaPasta merged commit 2b6fe46 into master Sep 27, 2026
22 checks passed
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