fix(pr, issue-migrate): hardening, the token off the command line, remote branches first, .env messages, repeated keys #14

Merged
neerdoc merged 17 commits from fix/hardening-pr-and-migrate into main 2026-11-18 08:42:43 +00:00
Owner

Hardening of pr.sh and the migration

Fixes four deferred issues found in the reviews of Phase 1: 0066, 0065, 0052
and 0064. No new feature. The project works at effort level tool.

pr.sh

  • 0066 - the token is in no process argument. It reaches curl on
    standard input, as a curl configuration holding the authorization header,
    and is written to no file. Before, it was in the -H argument and visible
    in the process list while curl ran. The request, the URL, the payload,
    PR created: <url> and Error: <response> are unchanged.
  • 0065 - remote branches first. The roadmap check resolves a branch as
    origin/<name> when that exists, otherwise as the local branch, because the
    PR is made from what is pushed. A stale local base no longer hides a missing
    tick, and an unpushed tick is no longer counted.
  • 0052 - a missing .env or credential gives a message. The order of
    steps is now root, arguments and head, roadmap check, credentials, request,
    so the usage and a roadmap refusal work in a repository with no .env. New
    messages: .env not found at the root; create it with FORGEJO_URL, FORGEJO_OWNER, FORGEJO_REPO and FORGEJO_TOKEN, and <name> is missing or empty in .env; set it. .env is read in a subshell, its output is
    discarded, and only the four values come back.

issue-migrate.sh

  • 0064 - a repeated key no longer hides a change. The check that removing
    status, closed and created changes nothing else compares the YAML as
    printed by yq, as plain text, so every copy of a repeated key takes part.
    Before, a cut in an earlier copy was lost and the file was migrated silently.

Design, tests and documents

  • docs/design/pr-roadmap-check.md and docs/design/issue-migration.md
    rewritten for the four items; DE-11 and test.sh name the tools the tests
    need: bats, jq, yq, curl, script and nc.
  • 1,226 bats tests (21 new or changed), 4 skipped, 0 failed. The token tests
    run pr.sh against a real local nc listener that never answers and read
    the process table; there is no python and no stand-in for the git system.
  • README row of pr.sh.

Issues, audit and review

  • Closed: 0052, 0064, 0065, 0066.
  • Audit: no issues (reports/audit-hardening.md).
  • Review 001 (Opus): no High or Medium finding; one Low resolved (a stale step
    number in the design) and one Low deferred as 0068 (an unpushed tick is
    refused with advice that is already done). The record is in
    docs/reviews/hardening-pr-and-migrate/review-001.

Not covered

A real git system (the success line of pr.sh); Linux and the nc variants
other than the BSD form; the remaining deferred issues.

🤖 Generated with Claude Code

## Hardening of pr.sh and the migration Fixes four deferred issues found in the reviews of Phase 1: 0066, 0065, 0052 and 0064. No new feature. The project works at effort level `tool`. ### pr.sh - **0066 - the token is in no process argument.** It reaches `curl` on standard input, as a curl configuration holding the authorization header, and is written to no file. Before, it was in the `-H` argument and visible in the process list while curl ran. The request, the URL, the payload, `PR created: <url>` and `Error: <response>` are unchanged. - **0065 - remote branches first.** The roadmap check resolves a branch as `origin/<name>` when that exists, otherwise as the local branch, because the PR is made from what is pushed. A stale local base no longer hides a missing tick, and an unpushed tick is no longer counted. - **0052 - a missing `.env` or credential gives a message.** The order of steps is now root, arguments and head, roadmap check, credentials, request, so the usage and a roadmap refusal work in a repository with no `.env`. New messages: `.env not found at the root; create it with FORGEJO_URL, FORGEJO_OWNER, FORGEJO_REPO and FORGEJO_TOKEN`, and `<name> is missing or empty in .env; set it`. `.env` is read in a subshell, its output is discarded, and only the four values come back. ### issue-migrate.sh - **0064 - a repeated key no longer hides a change.** The check that removing `status`, `closed` and `created` changes nothing else compares the YAML as printed by `yq`, as plain text, so every copy of a repeated key takes part. Before, a cut in an earlier copy was lost and the file was migrated silently. ### Design, tests and documents - `docs/design/pr-roadmap-check.md` and `docs/design/issue-migration.md` rewritten for the four items; DE-11 and `test.sh` name the tools the tests need: `bats`, `jq`, `yq`, `curl`, `script` and `nc`. - 1,226 bats tests (21 new or changed), 4 skipped, 0 failed. The token tests run `pr.sh` against a real local `nc` listener that never answers and read the process table; there is no python and no stand-in for the git system. - README row of `pr.sh`. ### Issues, audit and review - Closed: 0052, 0064, 0065, 0066. - Audit: no issues (`reports/audit-hardening.md`). - Review 001 (Opus): no High or Medium finding; one Low resolved (a stale step number in the design) and one Low deferred as 0068 (an unpushed tick is refused with advice that is already done). The record is in `docs/reviews/hardening-pr-and-migrate/review-001`. ### Not covered A real git system (the success line of `pr.sh`); Linux and the `nc` variants other than the BSD form; the remaining deferred issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves 002 of review 001 of hardening-pr-and-migrate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves 001 of review 001 of hardening-pr-and-migrate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
WulfScience-FOSS/wulf-dev!14
No description provided.