Skip to content

feat(core,dg): members-only content foundations in public repos (lane 0, readers, verdict rule, key-aware membership) - #395

Merged
PastaPastaPasta merged 9 commits into
masterfrom
feat/mv1-lane
Oct 5, 2026
Merged

PastaPastaPasta merged 9 commits into
masterfrom
feat/mv1-lane

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

What

Phase 1 of members-only content in public repositories (mixed visibility), stream "lane": DESIGN stream 1A (everything except the envelope crypto) and the Rust/dg half of stream 1F. The crypto stream's #392 (the v0x03/v0x04 envelopes) has merged; this branch includes current master.

Everything keys on "this public repository has a members key" (a lane-0 anchor), never on visibility alone. Private repositories are unchanged: their anchors are byte for byte the same, and every private_* vector passes unchanged.

forge-core

  • Predicate split (D1). is_well_formed becomes content_well_formed (a public repo also admits enc v0x03/v0x04 with an epoch and no plaintext; v0x01 stays private-only) and git_plane_well_formed (plaintext only, used by the settings fold, the config timeline, the ref fold, and the public release fold / PR lookups by plaintext branch name). A unit test checks that the git plane refuses every enc version on every kind.
  • Members-key anchor in a public repo. post_anchor builds its content with anchor_content(visibility, settings, link): a public repo's anchor is vis: "public", carries no settings and no backend/archived, and has an empty TLV at epoch 0. Rotations and re-anchors carry nothing forward. enable_members_key writes epoch 0 (self-wrap, anchor, confirm, wraps to every key-holding member); has_members_key is what membership changes key on.
  • Per-document reads. open_with reads a plaintext document as it is and opens a sealed one. An outsider gets a placeholder (MembersOnly: id, author, time, number, asMember, and why it did not open), never E306/E307 or "not found". A public repo's keys load only when a sealed document is met. target_read, comments_read and Listed::members_only expose placeholders. A sealed issue or PR read by number through issue()/patch() returns E311 (a member whose key was not shared yet), E306, or the new E313 (members-only).
  • Readers on public repos. The "readers only on private repos" rule is dropped. READERS_IN_MEMBERS_KEY (one constant) decides whether readers hold the key. A runner document is not a membership, so it never gets a wrap.
  • asMember on sealed writes. The proof_refused fallback never strips asMember from a sealed document.
  • D15. counted_reviews counts a sealed review's plaintext verdict for every reader when it carries asMember, whether or not the reader can open it. Private repos are unchanged (§8.1). Review::members_only marks verdict-only rows.
  • Audience fixed at creation. edit_keeps_audience refuses a plaintext edit of a sealed document and a sealed edit of a plaintext one. A sealed document is always re-sealed as a whole.
  • Parent-audience lookup before sealing. A comment, reply, review or event value reads its parent (the target, and a reply's thread root). A members comment on a public thread is allowed. A public reply to a members comment, or a public comment on a members issue, is refused before signing. An event value is sealed exactly when its target is. With no explicit request the default is the parent's audience (Collab::request_audience).
  • No members text at rest or in public storage. The create-journal fingerprint is keyed for anything that is not public. store_long_body takes the audience and refuses a members-only text longer than its field: kind-70 sealed long bodies are not implemented, so nothing is ever stored as a plaintext artifact.
  • Members-only writes seal with doc::seal_members (v0x03) and are re-sealed on edit. Keyring::open sets vis from the document. A v0x03 CommitMismatch stays CommitMismatch (never EarlierUse) and is filed under "not encrypted for this repo". Members-only PRs are refused (phase 3).
  • docs/errors.md: E311, E312, E313. private-repos.md: §8.1 updated for the split and D15; new §17 "Mixed repositories" (rule level).

dg (1F, Rust half)

  • dg collab add wraps the key whenever the repo has a members key and the role holds it. dg collab remove then rotates: writer, triage and reader, plus a maintainer with the re-anchor. A role change to a role that does not hold the key also rotates. The pure plan functions (add_plan, remove_rotates) have unit tests. In a public repo, a member with no encryption key is still added, with a note to run repair later. A private repo still refuses that member.
  • dg repo keys status|repair|rotate work on public repos with members-only content and return E312 otherwise.
  • New dg repo members enable (maintainers only): shows the measured cost (anchor 37M + 74M credits per member, from S1), asks "Turn on members-only content?" in the §10 copy (skip with --yes), then posts the anchor and the wraps. New dg repo members status.

Vectors

mixed_anchor__{public_settings_free,rotation_carries_nothing,…}, approval_count__sealed_verdict_{member,outsider,…}, mixed_edit__plaintext_refused (+5), content_well_formed__* (10), git_plane_well_formed__* (5). The TypeScript runner skips these cases until stream 1B ports them (MIXED_PENDING_CASES in lib/rules/conformance.test.ts).

Not in this PR

  • git-remote-dash is unchanged. In phase 1 it never needs a key for a public repo, because refs and packs stay public until phase 3, so it does not load an identity (product L4 is moot until then).
  • The dg --members flags and the placeholder rendering in dg … view belong to 1E. The web side belongs to 1B/1D/1F-web.
  • Kind-70 sealed long bodies: refused instead, see above.
  • The web isWellFormed/privateGate parity belongs to 1B.

Review round 1 (4a919c33)

  • Lane. Members-only content is sealed with the crypto stream's private::Lane (Keyring::lane), never with Private. v0x04 opens give Unreadable::Letter.
  • Reply audience. A reply's audience is the narrowest of its target, the comment it answers and the thread root. thread_docs reads them once, and dg pr comment --reply-to plans with the same reads. Tested: a reply to a members-only reply under a public root is sealed.
  • Fail closed. A target, thread root or event target that cannot be read is an error, never public. The importer's named root is polled briefly before it fails. Issue, Patch and Comment carry the audience of the document they were read from, and dg edits use it.
  • Web guard. grantMember, revokeMember and changeMemberRole refuse a public repo with any sealed config ("This repo has members-only content turned on. Change its members with dg for now."). Covered by members-key-guard.test.ts. The enable prompt adds: change members only with an up-to-date Forge.
  • One definition of a members key. It means any sealed config (Keyring::has_members_key, keyring::has_members_key; the web uses the same rule). Epoch 0 is never minted over an existing sealed config: an unresolved key is refused and pointed to dg repo keys repair (enable_step, tested).
  • Unreadable issues are still targets. dg issue close, lock, label and comment resolve the issue with target_read, so a maintainer can act on a members-only issue by number without reading it (TargetRead::target, tested). Members-only PRs still need a readable view; they come in phase 3.
  • Reads never fail on the key. If a public repo's members key cannot be read, members-only rows stay placeholders and the read succeeds.
  • Forged content. A member sees content that fails the commitment or tag check as NotForThisRepo, the same "not encrypted for this repo" bucket as hidden_bucket (recorded for the web stream). E313's fixes now say why the reader can't open it.
  • Public sealed content is discussion only. content_well_formed(Public) admits sealed issues, PRs, comments and reviews only (new vector content_well_formed__public_ref_update_members).
  • Long bodies. dg plans the room with the document's audience (v0x03 room for members-only text), and the too-large message quotes the members-only limit. Members-only long bodies (kind 70) stay refused.
  • dg repo members.
    • enable on a repo where it is already on goes to dg repo keys repair (its own cost) or says it is already on.
    • A writer is told "only maintainers can turn on members-only content" and to ask a maintainer.
    • status youCanRead is about the current epoch.
    • The wrap estimate uses the measured 74M credits.

How tested

  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test --workspace: green. forge-core lib: 839 passed, including the new mixed vectors, a v0x03 seal/open/reseal round trip, per-document read dispatch, the sealed-proof rule, and the anchor and plan tests. dg: 327 passed.
  • vitest run lib/rules/conformance.test.ts lib/private/conformance.test.ts: 997 passed.
  • At 4a919c33 the gates were run under the cargo lock, with the staleness rule and no debuginfo:
    • fmt and clippy -D warnings: clean.
    • cargo test --workspace: 1652 passed, 0 failed.
    • Web: tsc and eslint clean, copy lint clean, vitest run 6023 passed (33 skipped).
  • After merging master (7182277b), the same gates were run again: fmt and clippy clean, cargo test --workspace 1752 passed, 0 failed, web tsc/eslint/copy lint clean, vitest run 6113 passed (33 skipped). The keyring.rs conflict with feat(core,cli,web): protect the default branch and every tag by default (D6) #372 was resolved by passing the new default protected patterns into a private repository's epoch-0 anchor.
  • e2e scenario 38 was run live on sakura with these binaries and passed 12/12 checks (dash-forge-qa/evidence/mv1/lane/e2e-38.log). Re-checked live: the writer's enable refusal, enable on a repo already on, and the removed reader's youCanRead: false.
  • New e2e scenario e2e/cli/scenarios/38-members-key-reader.sh: enable, add a reader, remove them (rotation), keys status, and a non-member's members status.
  • Live QA on sakura (evidence dash-forge-qa/evidence/mv1/lane/README.md, repo D1b5YCGH…/mv1-lane-qa-0353, dg f78dc5e, stale client = debug build of origin/master 40da852):
    • dg repo members enable: the §10 prompt shows the measured cost (~0.00185 DASH for 2 members, 0.0015 actually spent). A writer is refused. Keys status reads "(public, members-only content on)", epoch 0.
    • Adding a reader shares the key (keyShared: true, no missing wraps). Removing them rotates to epoch 1, with wraps to the maintainer and the writer only.
    • Members-only content (enc v0x03) written with the members_only fixture: an issue by the writer, a reader's comment on a public issue, a maintainer reply, and a writer's members-only approve. Outsiders and anonymous readers get placeholders only (#3 · members-only issue by …, asMember, NotAMember). Members open it. A public reply on the members-only issue is refused before signing.
    • D15 live: the writer's members-only approve counts for the outsider, the anonymous reader and the reader, and the new dg pr view (anonymous) shows approvedBy: [writer]. The stale dg shows approvedBy: [], hiddenReviews: 1 (the conservative undercount).
    • After the rotation the removed reader still reads the earlier members comment, and the epoch-1 comment is a placeholder for them (NotReadable).
    • A member added by the stale dg (member row, no wrap) sees NoKeyShared placeholders (the E311 state). dg repo keys status lists them under missingWraps, dg repo keys repair wraps them, and they can then read.
    • Stale client: dg repo view, dg repo protect list and git ls-remote from 40da852 are identical before enable, after enable and after the rotation (default branch main, refs/heads/main protected, same refs). Stale dg issue view 3 says E102 where the new dg says E313.
    • Leak scan (LANEQA-SECRET-* markers): only reads by members contain them.

Design questions for the lead

  • E313 MEMBERS_ONLY is new: issue()/patch() need an answer for an outsider who reads a sealed number, and the design lists only E311/E312. 1E will render the placeholder instead (target_read).

🤖 Generated with Claude Code

PastaPastaPasta and others added 4 commits October 5, 2026 03:09
Split the well-formedness predicate (content vs git plane), read sealed
documents per document with placeholders for outsiders, count members-only
review verdicts for every reader (D15), keep a document's audience fixed on
edit, check a child's audience against its parent before sealing, and make
the members-key anchor of a public repo settings-free (vis public).

Membership changes key on the repo having a members key: dg collab add
wraps, remove rotates, keys status/repair/rotate work on public repos with
members-only content, and dg repo members enable|status turns it on.
Readers hold the key (READERS_IN_MEMBERS_KEY); runners never do. E311,
E312 and E313 are new. Members-only sealing (enc v0x03) is refused until
the crypto stream's envelope lands.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	forge-web/lib/rules/conformance.test.ts
Members-only issues, comments, reviews and event values of a public repo
are sealed with the crypto stream's v0x03 envelope (seal_members) and
re-sealed on edit; the keyring opens them with the document's vis. A
v0x03 commitment mismatch stays CommitMismatch (never EarlierUse) and is
filed with tampered documents. The long-body room of members-only text
uses MIN_V3. Adds comments_read (placeholders) and a members_only QA
fixture example.

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

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 29 minutes.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aed42288-e131-4b1f-9676-a77b55048aa6
📥 Commits

Reviewing files that changed from the base of the PR and between 34545b8 and 7182277.

📒 Files selected for processing (64)
  • crates/dg/src/collab.rs
  • crates/dg/src/errors.rs
  • crates/dg/src/issue.rs
  • crates/dg/src/keys.rs
  • crates/dg/src/long_body.rs
  • crates/dg/src/main.rs
  • crates/dg/src/meta.rs
  • crates/dg/src/pr/branch.rs
  • crates/dg/src/pr/mod.rs
  • crates/dg/src/pr/review.rs
  • crates/dg/src/pr/state.rs
  • crates/dg/src/pr/threads.rs
  • crates/dg/src/release.rs
  • crates/dg/src/repo.rs
  • crates/forge-core/examples/members_only.rs
  • crates/forge-core/src/collab/long_body.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/members.rs
  • crates/forge-core/src/refs.rs
  • crates/forge-core/src/rules.rs
  • crates/forge-core/src/rules/v2.rs
  • crates/forge-core/src/user_error.rs
  • crates/forge-import/src/chain.rs
  • crates/forge-import/src/sealed_release.rs
  • docs/errors.md
  • docs/security/private-repos.md
  • e2e/cli/run.sh
  • e2e/cli/scenarios/38-members-key-reader.sh
  • forge-contracts/vectors/approval_count__private_unopened_not_counted.json
  • forge-contracts/vectors/approval_count__sealed_verdict_member.json
  • forge-contracts/vectors/approval_count__sealed_verdict_outsider.json
  • forge-contracts/vectors/approval_count__sealed_verdict_stale_head.json
  • forge-contracts/vectors/approval_count__sealed_verdict_without_proof_not_counted.json
  • forge-contracts/vectors/content_well_formed__private_issue_members_envelope.json
  • forge-contracts/vectors/content_well_formed__public_comment_members_with_plaintext_path.json
  • forge-contracts/vectors/content_well_formed__public_comment_specific_people.json
  • forge-contracts/vectors/content_well_formed__public_config_anchor_envelope.json
  • forge-contracts/vectors/content_well_formed__public_issue_members.json
  • forge-contracts/vectors/content_well_formed__public_issue_members_with_plaintext_title.json
  • forge-contracts/vectors/content_well_formed__public_issue_members_without_epoch.json
  • forge-contracts/vectors/content_well_formed__public_issue_plaintext.json
  • forge-contracts/vectors/content_well_formed__public_issue_private_envelope.json
  • forge-contracts/vectors/content_well_formed__public_ref_update_members.json
  • forge-contracts/vectors/content_well_formed__public_review_members.json
  • forge-contracts/vectors/git_plane_well_formed__config_members_anchor.json
  • forge-contracts/vectors/git_plane_well_formed__config_members_envelope.json
  • forge-contracts/vectors/git_plane_well_formed__config_plaintext.json
  • forge-contracts/vectors/git_plane_well_formed__ref_update_members.json
  • forge-contracts/vectors/git_plane_well_formed__ref_update_plaintext.json
  • forge-contracts/vectors/mixed_anchor__private_rotation_repeats_settings.json
  • forge-contracts/vectors/mixed_anchor__public_burned_rotation_link_only.json
  • forge-contracts/vectors/mixed_anchor__public_settings_free.json
  • forge-contracts/vectors/mixed_anchor__rotation_carries_nothing.json
  • forge-contracts/vectors/mixed_edit__plaintext_beside_reseal_refused.json
  • forge-contracts/vectors/mixed_edit__plaintext_refused.json
  • forge-contracts/vectors/mixed_edit__public_edit_kept.json
  • forge-contracts/vectors/mixed_edit__reseal_kept.json
  • forge-contracts/vectors/mixed_edit__sealed_edit_of_plaintext_refused.json
  • forge-contracts/vectors/mixed_edit__specific_people_to_members_refused.json
  • forge-web/lib/repo/members-key-guard.test.ts
  • forge-web/lib/repo/writes.ts
  • forge-web/lib/rules/conformance.test.ts
  • Autopilot · 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.

PastaPastaPasta and others added 3 commits October 5, 2026 03:39
…y content

Scenario 38: enable the members key on a fresh public repo, check the
settings still read from the plaintext config, add a reader (key shared),
remove them (rotation to epoch 1, nothing to repair), and a non-member's
members status reads it as on but not readable.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- Seal members-only content with the crypto stream's Lane (Keyring::lane),
  never a private repository's seams.
- A reply's audience is the narrowest of its target, the comment it answers
  and the thread root (read once by thread_docs); dg plans the same.
- Audience lookups fail closed: a missing target, root or event target is
  an error, never public; edits take the audience of the document read.
- The web refuses membership changes of a public repo with members-only
  content until it shares and rotates the key itself.
- Never mint epoch 0 over an existing sealed config; one definition of
  having a members key (any sealed config) everywhere.
- Members-only issues are event and transition targets by number; a members
  key that cannot be read leaves placeholders, never a failed read; a
  member sees forged content as not encrypted for this repo.
- Public sealed content is issues, PRs, comments and reviews only; long-body
  planning and the too-large message use the v0x03 room.
- dg repo members enable routes an enabled repo to repair, tells a writer
  only maintainers can turn it on, and status reads the current epoch; the
  wrap estimate uses the measured cost.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	crates/forge-core/src/keyring.rs
# Conflicts:
#	forge-web/lib/rules/conformance.test.ts
@PastaPastaPasta
PastaPastaPasta merged commit 232137b into master Oct 5, 2026
33 of 34 checks passed
@PastaPastaPasta
PastaPastaPasta deleted the feat/mv1-lane branch October 5, 2026 14:31
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