Skip to content

fix(dg): --json field aliases, one doctor forge-v2 row, pr checkout switches, DPNS names (QW-081, QW-083) - #260

Merged
PastaPastaPasta merged 6 commits into
masterfrom
fix/qw-final-small
Sep 30, 2026
Merged

PastaPastaPasta merged 6 commits into
masterfrom
fix/qw-final-small

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

The last small dg items from the bonsia QA wave: part of QW-081 (--json shapes) and part of QW-083 (human-output polish). #254 fixed the rest of both that was small. What's left is listed at the end.

QW-081: --json fields

  • dg repo view --json now has description, the same string dg repo list --json gives ("" when the repo has none). It is null when the repo document can't be read, as archived already is. The human view prints a description: line when there is one.
  • Issue JSON from list, close and reopen now has "state": "open"|"closed" (the words dg pr uses) next to "open".
  • id next to documentId: outputs that had only documentId now also carry id with the same value. These are issue view, collab accept / add / list, ci runner add and ci report.
  • No field is renamed or removed, so existing --json consumers keep working.

QW-083: human output

  • dg doctor prints the forge-v2 row once, under contracts. That row is the proof-checked one, and it names its source (forge-contracts/deployments/<net>.json). The recorded-ids row only appears when the live check could not run. In --json, the row moves from the network section to contracts.
  • dg pr checkout now switches to pr/<n>, as gh pr checkout does, without losing work:
    • In these cases it points the branch at the PR head but does not switch, and prints "not switched: " and the git switch hint:
      • there are uncommitted tracked changes;
      • HEAD is detached at a commit no branch, tag or remote holds;
      • the PR head tracks a path that is an ignored file here, such as a local .env. A plain git switch would overwrite that file silently.
    • If you are already on pr/<n>, it fast-forwards with --no-overwrite-ignore.
    • If a local pr/<n> has commits the PR head doesn't (a force-push, or your own commits), it refuses with E206 and names git branch -m / git branch -D. gh refuses this case too. It used to move the branch silently, leaving those commits only in the reflog.
    • JSON gains switched.
  • DPNS names: dg collab list and dg issue view show each identity as <id> (<name>.dash) when it has a name. The names come from one concurrent batch (PlatformClient::dpns_first_names), which looks up at most 50 ids and stops waiting after 5 s. An id whose lookup fails or doesn't finish in time is shown bare. --json makes no DPNS lookups.

Still open in these two ids

  • QW-081
    • "" vs null across every --json emitter. This needs an audit, and consumers would see the change.
    • Issue view's state is already an object ({open, labels, assignees}), so a string alias would need a rename.
  • QW-083

Tests

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • dg pr checkout now switches to the PR branch when safe, while preserving local commits and avoiding overwriting working-tree changes. It reports whether it switched or stayed on the current branch.
    • Human-readable collaborator and issue listings show DPNS names when available, with identity IDs as fallback.
    • repo view now displays the repository description when available.
  • Improvements

    • Issue and collaboration responses now provide consistent state and identifier fields.
    • Checkout guidance and error documentation clarify branch-switching behavior and how to handle protected local branches.

PastaPastaPasta and others added 5 commits September 30, 2026 11:26
The row was printed under network (proof-verified) and again under contracts (the recorded ids). The proof-verified row now carries the deployment file as its source and stands alone under contracts; the recorded row is shown only when the live check did not run (fresh install, no deployment, DAPI unreachable). QW-083.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Like gh pr checkout: pr/<n> is pointed at the PR head and switched to when the working tree has no uncommitted changes; with changes it stays put and prints the git switch hint. Already on pr/<n>, it fast-forwards (git refuses what would lose work) instead of failing on branch -f. JSON gains switched. QW-083.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…issue view

QW-081: repo view --json gains description (as repo list has it; null when the repo document cannot be read). Issue JSON gains state (open/closed) beside open; outputs with only documentId (issue view, collab accept/add/list, ci runner add, ci report) also get id. No field is renamed or removed.

QW-083: dg collab list and dg issue view print each identity's DPNS name after its id, read concurrently in one batch (PlatformClient::dpns_first_names), human output only; a failed read shows the bare id.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A local pr/<n> holding commits the PR head does not is left alone (E206 naming the rename or delete), as gh pr checkout refuses a non-fast-forward; branch -f used to move it silently. A clean but detached HEAD that no branch, tag or remote ref holds is not switched away from either. The git work moves to place_pr_branch. docs/errors.md E206 covers the new case.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 1fcc7e2a-cbfc-42fd-bd5f-f3d3fb023c01

📥 Commits

Reviewing files that changed from the base of the PR and between f8ab759 and e1996fc.

📒 Files selected for processing (13)
  • crates/dg/src/ci.rs
  • crates/dg/src/collab.rs
  • crates/dg/src/doctor.rs
  • crates/dg/src/fmt.rs
  • crates/dg/src/issue.rs
  • crates/dg/src/main.rs
  • crates/dg/src/pr/mod.rs
  • crates/dg/src/repo.rs
  • crates/forge-core/src/platform/identity.rs
  • crates/forge-core/src/resolve.rs
  • crates/forge-core/src/user_error.rs
  • docs/errors.md
  • docs/guides/collaborating.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The PR changes PR branch checkout behavior, CLI output, JSON response fields, doctor deployment checks, and repository view output. It also adds DPNS name resolution for human-readable collaboration and issue output.

Changes

PR checkout

Layer / File(s) Summary
Branch placement and checkout outcomes
crates/dg/src/pr/mod.rs, crates/dg/src/main.rs, crates/forge-core/src/user_error.rs, docs/errors.md, docs/guides/collaborating.md
Checkout creates or updates the PR branch and switches to it when safe. It avoids overwriting extra local commits and avoids switching when tracked work, an unheld detached HEAD, or overlapping ignored paths could be affected. Tests and command guidance cover these conditions and outcomes.

Identity and issue display

Layer / File(s) Summary
DPNS name lookup and formatting
crates/forge-core/src/platform/identity.rs, crates/dg/src/fmt.rs
dpns_first_names deduplicates IDs, limits lookup concurrency and duration, and returns available first names. with_name displays a sanitized name beside an ID when available.
Collaboration and issue rendering
crates/dg/src/collab.rs, crates/dg/src/issue.rs
Human-readable output resolves member and issue-actor names, with IDs as fallbacks. JSON mode skips name lookup. Issue output uses open and closed state words, and close/reopen responses include a state field.

JSON document identifiers

Layer / File(s) Summary
Command response identifier fields
crates/dg/src/ci.rs, crates/dg/src/collab.rs, crates/dg/src/issue.rs
CI responses add id alongside documentId. Collaboration responses use id instead of documentId; issue view adds id alongside the existing field.

Doctor deployment rows

Layer / File(s) Summary
Live and recorded deployment rows
crates/dg/src/doctor.rs
A live forge-v2 check appears in the contracts section rather than the network section. If no live check is available, the recorded row remains. Successful rows include the deployment source path.

Repository description

Layer / File(s) Summary
Description lookup and view output
crates/forge-core/src/resolve.rs, crates/dg/src/repo.rs
Repository view retrieves the description, includes it in JSON output, and prints it in human-readable output when it is non-empty.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant Checkout as dg pr checkout
  participant Git as Local Git
  User->>Checkout: Request checkout of a PR
  Checkout->>Git: Check branch and worktree state
  Checkout->>Git: Create or update the PR branch
  Checkout->>Git: Switch branches when safe
  Checkout-->>User: Report branch and switch outcome
Loading

Merge Risk: ⚪ Minimal · up to e1996

The checkout safeguard preserves local ignored files, and existing JSON identifier fields remain compatible. No actionable merge-blocking issue remains; the change is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to e1996

The checkout changes add safeguards for local work, and identity names remain display-only with bounded lookups and fallback to IDs. No introduced security defect was established in the inspected flows. Concurrent worktree changes and some underlying fetch authorization behavior remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The newly introduced placement behavior exposes the invoking local worktree to PR-head content. Its branch name is derived from the numeric PR identifier. Fetch also updates dash-pr remote refs and uses an environment selected according to target visibility; the inspected placement code does not establish wider service or tenant authority.

Trust Boundaries and Controls

  • observed — Repository-document values cross into Git operations through explicit head validation and constructed arguments. DPNS display reads register the DPNS contract before invoking the SDK name-read method. These are visible control hooks, not independent verification of patch-writer policy, source-ID validation, remote fetch authentication, or SDK proof enforcement.

Resilience and Maintainability Implications

  • observed — Sequential checkout protects local state by refusing divergent branch replacement and withholding a switch for tracked changes, an unheld detached HEAD, or ignored-path overlap. Failed path listings conservatively prevent switching. The already-checked-out branch uses fast-forward-only merging with --no-overwrite-ignore. The multi-command transition is not protected by a visible operation-wide lock.

Hardening Proposals

  • proposed — Consider enforcing ignored-file preservation in the switch operation itself, in addition to preflight checks, so that another process creating an ignored file after inspection cannot invalidate that protection. This is defense in depth, not an established exploit or observed data-loss finding.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 45 functions across 11 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: JSON field additions, the doctor forge-v2 row fix, safer PR checkout switching, and DPNS name display.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 45 functions across 11 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

… DPNS display lookups

git replaces an ignored file silently when a switch or fast-forward brings a tracked file to its path, so pr checkout now stays put when the PR head tracks a path that is an ignored file (or directory) here, and fast-forwards with --no-overwrite-ignore. place_pr_branch gains temp-repository tests for every case it must not lose work in: a clean switch, a fast-forward, uncommitted changes, an ignored file, a diverged pr/<n>, and an unheld detached HEAD. dpns_first_names looks up at most 50 ids and stops waiting after 5 s, keeping the names it has.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@PastaPastaPasta
PastaPastaPasta merged commit 500c3e1 into master Sep 30, 2026
29 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