Skip to content

feat(ci): dg ci runners and check runs, checkRun-only keys, verified logs on the commit page (I-1) - #148

Merged
PastaPastaPasta merged 5 commits into
masterfrom
feat/dg-ci
Sep 29, 2026
Merged

PastaPastaPasta merged 5 commits into
masterfrom
feat/dg-ci

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

I-1 of the CI track (platform-parity-spec §2, Group I): dg ci, runner memberships, checkRun-only runner keys, check runs on the commit page, and a verified log view. Closes the "nothing renders checkRuns" half of D-604 (D-038) for the CLI and the commit page.

What ships

CLI (dg ci)

  • dg ci runner new <repo> --runner <file> -o <file> does four things:
    • registers a key on the runner identity: AUTHENTICATION / HIGH, ContractBounds::SingleContractDocumentType {forge-collab, checkRun}, 0.5 DASH budget, 365-day expiry;
    • writes it as dfk1: to a 0600 file before registering it, then verifies it on chain;
    • enrols the identity as a forge-core runner, which only the owner can do;
    • reports the measured key and enrolment costs.
  • dg ci runner add | list | revoke.
  • dg ci report <repo> --sha … --name … --status … [--conclusion] [--details-url] [--summary|--summary-file] [--external-id] [--log <file> --storage <profile>]:
    • the first report creates the run; later ones replace the reporter's open run with the same name (queued, then in_progress, then completed);
    • a completed run means a re-run is a new document, unless --external-id matches an existing run;
    • the write is planned before the confirmation prompt, so the prompt prices the right write (create or update);
    • --log uploads to the storage profile (content-addressed) and records logUrl and logSha256;
    • on a private repo --log is refused (E207) unless --public-log;
    • prints the web commit page.
  • dg ci status <repo> <sha>.
  • dg pr merge now enforces requireChecks using checks_state: the newest trusted run per name decides, which is the same rule as the web merge box.
  • dg auth keys disable accepts a runner key without --force.
  • A key used outside its bounds (20014, or a non-batch transition) maps to E302.

forge-core: new ci module:

  • RunnerReader / RunnerService;
  • CheckReport validation that mirrors the schema's conclusionIfDone / doneIfConclusion rules;
  • CheckRuns::plan / execute, and commit_web_url.

Also: KeySpec::DocumentType plus check_doc_type_key; Collab::check_runs trusts runners; Collab::head_checks. Membership reads are shared with members.rs.

Replace semantics:

  • completedAt is cleared unless the status is completed.
  • A re-queue clears startedAt and the log pair.
  • startedAt is never moved by a repeated in_progress report.

Web

  • The commit page has a Checks section.
  • Both the PR Checks tab and the commit page show duration, a Details link, and a Log button.
  • The log is streamed with a 32 MiB running cap (refused up front on Content-Length), a 30 s timeout, credentials: omit and no-referrer. It is shown only if it hashes to the on-chain logSha256; otherwise a warning is shown.
  • Loopback http logs are allowed only when the page itself is on loopback.
  • Runners are trusted alongside members (the runner read is cached).
  • The PR merge box uses checksState, in parity with Rust checks_state / newest_check_runs: an untrusted newer run never shadows a trusted one.

Docs:

  • docs/guides/ci.md: enrol, report, costs, security, and the current contract's limits;
  • docs/design/ci-contract-wishes.md: wishes for the forge-community rework;
  • the E302 entry;
  • spec §2.2 and §2.5 updated to match the code.

Platform facts (verified against v4.2.0-beta.6)

  • PV14 validate_identity_public_key_contract_bounds v2 admits SingleContractDocumentType bounds on AUTHENTICATION, non-master keys.
  • Batch advanced-structure v1 enforces check_batched_transition. Out of bounds is error 20014, and a bound key signing a non-batch transition gets ContractBoundedKeyNonBatchError.
  • So yes: a key can be scoped to checkRun writes only.
  • What the contract cannot express is listed in ci-contract-wishes.md: "runners only", and status-transition rules.

Measured on moutai (2026-09-29, drive 4.2.0-beta.6)

Write Credits DASH
Runner key (identity update, runner pays) 28,519,540 0.000285
Enrol (runner doc, owner pays) 45,820,360 0.000458
checkRun create 55,036,900 – 78,132,420 0.00055 – 0.00078
checkRun replace 3,338,780 – 3,687,280 ≈ 0.000035
Create with --log 59,100,320 0.00059

The prompts use estimates above these figures (35 M / 55 M / 85 M / 5 M).

Tests

  • CLI e2e e2e/cli/scenarios/35-ci-runner-report.sh: PASS live on moutai with freshly minted identities, re-run after the review fixes. It covers:
    • runner new, key bound to checkRun, and the 0600 file;
    • queued → in_progress → repeated in_progress (unchanged) → completed on one document;
    • E201 before signing;
    • ci status trusted;
    • a star with the runner key refused as E302;
    • revoke, after which the next report gets E601 (40120) and the old run is no longer counted;
    • key disable without --force.
  • Playwright forge-web/e2e/ci-checks.spec.ts: PASS against a local build (4831, build marker checked). It covers a runner's run trusted, a revoked runner's run not counted, and a log verified from a local RustFS bucket.
  • Unit tests:
    • forge-core ci (validation, run selection, replace semantics, commit URL) and the E302 mapping;
    • dg checks_refusal;
    • web checks.test.ts (trusted-first parity, log verification, streaming cap, content-length refusal, no credentials/referrer, the loopback rule).
  • cargo clippy -D warnings, cargo test -p forge-core -p dg, tsc, vitest, eslint: all green.
  • Evidence: dash-forge-qa/evidence/impl/feat-dg-ci/ (screenshots and JSON outputs).

Review

  • code-review-validator came back REQUIRES CHANGES. All of M1–M5 and L1–L9 are fixed in 753931c.
  • code-simplifier findings are applied in 047902e.

Not in this PR

🤖 Generated with Claude Code

PastaPastaPasta and others added 5 commits September 29, 2026 09:50
… in forge-core

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…he existing helpers

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…reads, merge-box parity

Clear completedAt unless completed and reset start and log on a re-queue; plan the write before the prompt with estimates above the measured fees; stream log reads with a cap, timeout, no credentials or referrer, loopback only from a loopback page; the newest trusted run decides in the web and in dg pr merge (checks_state); refuse --log on private repos without --public-log; runner keys disable without --force.

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

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 26 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: 0c6c27b4-bea7-4a65-8c9f-e513f447c9fa

📥 Commits

Reviewing files that changed from the base of the PR and between 24eb0f5 and 753931c.

📒 Files selected for processing (27)
  • crates/dg/src/auth/keys.rs
  • crates/dg/src/auth/mod.rs
  • crates/dg/src/ci.rs
  • crates/dg/src/errors.rs
  • crates/dg/src/main.rs
  • crates/dg/src/pr/mod.rs
  • crates/dg/src/release.rs
  • crates/forge-core/src/ci.rs
  • crates/forge-core/src/collab/v2.rs
  • crates/forge-core/src/lib.rs
  • crates/forge-core/src/members.rs
  • crates/forge-core/src/platform/identity.rs
  • crates/forge-core/src/user_error.rs
  • docs/design/ci-contract-wishes.md
  • docs/design/platform-parity-spec.md
  • docs/errors.md
  • docs/guides/README.md
  • docs/guides/ci.md
  • docs/guides/collaborating.md
  • e2e/cli/run.sh
  • e2e/cli/scenarios/35-ci-runner-report.sh
  • forge-web/components/repo/commit-content.tsx
  • forge-web/components/repo/pull-content.tsx
  • forge-web/components/repo/pull-tabs.tsx
  • forge-web/e2e/ci-checks.spec.ts
  • forge-web/lib/repo/checks.test.ts
  • forge-web/lib/repo/checks.ts

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.

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