Skip to content

fix: populate-draft-pr-body#40

Merged
satyaborg merged 2 commits into
mainfrom
fix/populate-draft-pr-body
Jun 3, 2026
Merged

fix: populate-draft-pr-body#40
satyaborg merged 2 commits into
mainfrom
fix/populate-draft-pr-body

Conversation

@satyaborg

Copy link
Copy Markdown
Owner

No description provided.

@satyaborg

Copy link
Copy Markdown
Owner Author

Devloop Review Round 1

  • Verdict: ACCEPT
  • Local cache: .codex/reviews/populate-draft-pr-body-r1.md

Review 1

Verdict: ACCEPT

Acceptance matrix

Criterion Status Implementation evidence Test evidence
AC1 PASS run_devloop calls create_pull_request only when [ -n "$PASS_COMMIT" ] (devloop:2160-2163), reaching create_draft_pull_request which writes a body file and runs gh pr create --draft --fill --base --head --body-file (devloop:3630). Body always begins with # Devloop Draft PR so it is non-empty (devloop:3590-3610). tests/devloop_test.sh:1124 asserts gh pr create line precedes agent reviewer 1; :1126 asserts [[ -s pr-body.md ]]. Full suite green firsthand: ok - PR-backed accept comments.
AC2 PASS Body table emits Source spec, Spec title (spec_title, devloop:3567-3577), Base branch, Head branch, Latest commit with none fallback (devloop:3589), plus an Acceptance Criteria section using criteria_block or the literal No parsed acceptance criteria. fallback (devloop:3605). :1128-1135 assert title E2E PR Accept, Base branch+base_branch, Head branch+feat/e2e-pr-accept, Latest commit+[0-9a-f]{7,} regex, and criterion Write the result file.. Fixture seeds these in make_loop_repo (:886-889), so assertions are non-vacuous.
AC3 PASS gh pr create now passes --body-file "$body_file" (devloop:3630). Verified against gh source: --body-file sets opts.BodyProvided=true and the create path applies if opts.BodyProvided { state.Body = opts.Body } after autofill, so the explicit body overrides --fill's commit-derived body; --fill only supplies the title. :1125 asserts --body-file present in the captured gh command log.
AC4 PASS ensure_pull_request runs lookup_pull_request, and if [ -n "$PULL_REQUEST" ]; then return 0; fi before create_draft_pull_request (devloop:3651-3653). No gh pr edit path exists anywhere, so an existing body is never touched. :1190-1211 seed an existing PR URL, run the loop, then :1207 fails if gh pr create ran and :1206 asserts the existing URL is surfaced. Firsthand: ok - PR-backed existing PR reuse.
AC5 PASS Fake gh pr create parses --body-file and copies it to $state/pr-body.md (tests/devloop_test.sh:610-613,624-626); PR-backed loop asserts body content. Red evidence in track (not ok - created PR body missing) is credible: old gh pr create had no --body-file, so pr-body.md is never written and [[ -s ... ]] fails. Green verified firsthand; ok - 100% project function coverage.

Engineering quality matrix

Area Status Evidence
Correctness PASS Call-site vars ($spec, $criteria_file, $FINAL_COMMIT) are all in run_devloop scope (devloop:1996,2001,2146). spec_title awk matches the first level-1 # line in the file and `
Test quality PASS Assertions trace to fixture content (make_loop_repo writes # E2E PR Accept and 1. Write the result file.), so they verify real output not echoes. Reuse, create-fail, lookup-fail, and comment-fail paths each have a dedicated scenario. Commit-hash regex check guards against a placeholder.
Maintainability PASS Two small cohesive helpers added; extra args threaded positionally through create_pull_requestensure_pull_requestcreate_draft_pull_request, matching the file's existing convention. No control-flow added to a busy path.
Architecture boundaries PASS Body generation lives beside the other PR helpers and reuses the canonical criteria_block instead of reparsing the spec.
Simplicity PASS Heredoc body is direct. The inline -f/-n guard before criteria_block is justified (it protects criteria_block's < "$criteria_file" redirect from a missing file), not redundant complexity.
Security PASS mktemp avoids predictable temp paths; --body-file avoids multiline word-splitting. Heredoc variable expansion does not re-evaluate command substitution from variable contents, so a hostile spec path/title cannot inject commands. No new dependencies.
Operational safety PASS Failures route through the existing PULL_REQUEST_ERROR/pr-error path; temp file cleaned before return; reuse path returns early and untouched; PR creation stays non-interactive.

Review flags

  • Silent decision: absent - Keeping --fill for title while overriding the body via --body-file, and leaving PR reuse unchanged, are both recorded in the track Design tradeoffs.
  • Scope drift: absent - Changes confined to PR-creation helpers, the post-commit call site, and tests/devloop_test.sh, matching the spec In-scope list. README (read directly) documents --create-pr generically and is reinforced, not contradicted, by the populated body, so no doc update was needed.
  • Missing test: absent - The populated-body behavior has targeted, non-vacuous assertions across content, flag usage, reuse, and failure paths.

Findings

None.

Missing tests

  • None blocking. Optional hardening (low risk): the No parsed acceptance criteria. fallback branch and verification that the temp body file is removed after a gh pr create failure are not asserted directly; both are simple guarded paths. The none commit fallback is unreachable from the only caller (PR creation is gated on [ -n "$PASS_COMMIT" ] and FINAL_COMMIT="$PASS_COMMIT"), so it is defensive rather than a true coverage gap.

Fix instructions

None.

Notes

  • The one risk the fake-gh test cannot cover is whether real gh lets --fill override --body-file. Confirmed via gh source (pkg/cmd/pr/create/create.go): --body-file sets BodyProvided=true and state.Body = opts.Body is applied after autofill, so the explicit body wins. This relies on gh's documented, stable --body/--body-file-overrides---fill precedence (verified against current gh), so it is a durable contract rather than a version snapshot. Implementation is correct against real gh, not just the fixture.
  • The body prints the absolute Source spec path into the PR description. This is spec-mandated (AC2 "source spec path") and author-controlled, so it is intended rather than a leak; noting only for awareness.
  • Verified firsthand: bash tests/devloop_test.sh passes all checks including ok - 100% project function coverage.

@satyaborg

Copy link
Copy Markdown
Owner Author

Devloop Final Report

Field Value
Final status accepted
Pass count 1 / 5
Final verdict ACCEPT
PR URL #40
Branch fix/populate-draft-pr-body

Acceptance Matrix Summary

Acceptance matrix

Criterion Status Implementation evidence Test evidence
AC1 PASS run_devloop calls create_pull_request only when [ -n "$PASS_COMMIT" ] (devloop:2160-2163), reaching create_draft_pull_request which writes a body file and runs gh pr create --draft --fill --base --head --body-file (devloop:3630). Body always begins with # Devloop Draft PR so it is non-empty (devloop:3590-3610). tests/devloop_test.sh:1124 asserts gh pr create line precedes agent reviewer 1; :1126 asserts [[ -s pr-body.md ]]. Full suite green firsthand: ok - PR-backed accept comments.
AC2 PASS Body table emits Source spec, Spec title (spec_title, devloop:3567-3577), Base branch, Head branch, Latest commit with none fallback (devloop:3589), plus an Acceptance Criteria section using criteria_block or the literal No parsed acceptance criteria. fallback (devloop:3605). :1128-1135 assert title E2E PR Accept, Base branch+base_branch, Head branch+feat/e2e-pr-accept, Latest commit+[0-9a-f]{7,} regex, and criterion Write the result file.. Fixture seeds these in make_loop_repo (:886-889), so assertions are non-vacuous.
AC3 PASS gh pr create now passes --body-file "$body_file" (devloop:3630). Verified against gh source: --body-file sets opts.BodyProvided=true and the create path applies if opts.BodyProvided { state.Body = opts.Body } after autofill, so the explicit body overrides --fill's commit-derived body; --fill only supplies the title. :1125 asserts --body-file present in the captured gh command log.
AC4 PASS ensure_pull_request runs lookup_pull_request, and if [ -n "$PULL_REQUEST" ]; then return 0; fi before create_draft_pull_request (devloop:3651-3653). No gh pr edit path exists anywhere, so an existing body is never touched. :1190-1211 seed an existing PR URL, run the loop, then :1207 fails if gh pr create ran and :1206 asserts the existing URL is surfaced. Firsthand: ok - PR-backed existing PR reuse.
AC5 PASS Fake gh pr create parses --body-file and copies it to $state/pr-body.md (tests/devloop_test.sh:610-613,624-626); PR-backed loop asserts body content. Red evidence in track (not ok - created PR body missing) is credible: old gh pr create had no --body-file, so pr-body.md is never written and [[ -s ... ]] fails. Green verified firsthand; ok - 100% project function coverage.

Engineering Quality Summary

Engineering quality matrix

Area Status Evidence
Correctness PASS Call-site vars ($spec, $criteria_file, $FINAL_COMMIT) are all in run_devloop scope (devloop:1996,2001,2146). spec_title awk matches the first level-1 # line in the file and `
Test quality PASS Assertions trace to fixture content (make_loop_repo writes # E2E PR Accept and 1. Write the result file.), so they verify real output not echoes. Reuse, create-fail, lookup-fail, and comment-fail paths each have a dedicated scenario. Commit-hash regex check guards against a placeholder.
Maintainability PASS Two small cohesive helpers added; extra args threaded positionally through create_pull_requestensure_pull_requestcreate_draft_pull_request, matching the file's existing convention. No control-flow added to a busy path.
Architecture boundaries PASS Body generation lives beside the other PR helpers and reuses the canonical criteria_block instead of reparsing the spec.
Simplicity PASS Heredoc body is direct. The inline -f/-n guard before criteria_block is justified (it protects criteria_block's < "$criteria_file" redirect from a missing file), not redundant complexity.
Security PASS mktemp avoids predictable temp paths; --body-file avoids multiline word-splitting. Heredoc variable expansion does not re-evaluate command substitution from variable contents, so a hostile spec path/title cannot inject commands. No new dependencies.
Operational safety PASS Failures route through the existing PULL_REQUEST_ERROR/pr-error path; temp file cleaned before return; reuse path returns early and untouched; PR creation stays non-interactive.

Implementation Summary

  • Final branch: fix/populate-draft-pr-body
  • Final commit: 6195115
  • Commit message: fix: populate-draft-pr-body

Commit References

  • pass 1 6195115 fix: populate-draft-pr-body (devloop, tests/devloop_test.sh)

Tests Run

  • Verification hook log: not configured
  • Review test evidence: see the acceptance matrix summary above.

Residual Risk

  • No blocking residual risk was recorded by the final review.

Local Report

  • HTML report path: /Users/satya/Projects/devloop-populate-draft-pr-body/.codex/reports/populate-draft-pr-body.html

Drop unopenable local paths from the PR body and devloop-posted
comments, and lead the body with portable spec content.

- body: drop absolute source-spec path and redundant base/head branch
  rows; embed spec Problem/Outcome as prose; keep bare commit SHA so
  GitHub auto-links it
- round-review comment: drop Local cache .codex path
- final-report comment: drop Local Report HTML path section
- remove now-dead params (slug, report, report_format) orphaned by the
  above, threaded through their call sites
- tests: fixture gains Problem/Outcome; assert embedded content and add
  negative guards against absolute-path and local-cache leaks
@satyaborg satyaborg marked this pull request as ready for review June 3, 2026 06:35
@satyaborg satyaborg merged commit a5dbca4 into main Jun 3, 2026
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