Skip to content

docs: require branch + PR in Construct, withdrawing the auto-push exemption - #25

Merged
UnbreakableMJ merged 1 commit into
mainfrom
workflow-require-prs
Aug 5, 2026
Merged

docs: require branch + PR in Construct, withdrawing the auto-push exemption#25
UnbreakableMJ merged 1 commit into
mainfrom
workflow-require-prs

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

Why

The two repos disagreed about workflow, and I hit the conflict while landing the v1.42 §13 change across both.

  • /spacecraft-software/standard/CLAUDE.md"Branch + PR, never push to main. Every change — even a one-line version bump — goes through a feature branch → PR → squash-merge → delete branch, in both the Standard and Construct repos."
  • Construct's maintainer-local CLAUDE.md"Push to origin/main with no confirmation prompt — this repo is pre-authorised for auto-push on skill-directory changes."
  • Construct's CONTRIBUTING.md step 5 — a bare git push … main.
  • AGENTS.md — no push rule at all, only a pointer to CONTRIBUTING.md.

Construct's own recent history (#11, #21, #22) is squash-merged PRs, so the auto-push note was the outlier rather than the policy.

What changed

Resolved in favour of branch + PR:

  • AGENTS.md gains a Branch + PR — never push to main hard rule alongside the existing bundle/staging/UTC-signing rules.
  • CONTRIBUTING.md step 5 replaced — feature branch → PR → squash-merge → delete branch, with the gh pr create invocation and the HTTPS-over-SSH note preserved.
  • Both state it is a two-repo rule binding human and assistant-driven changes alike, with no auto-push exemption for skill-directory edits, and that a contributing agent stops at opening the PR — merging is the maintainer's call, and an agent never merges its own PR.
  • The maintainer-local CLAUDE.md (gitignored, not in this diff) is updated to match.

Flagged, deliberately not fixed here

construct skill ship hard-codes git push origin mainconstruct-cli/src/commands/ship.rs:235 — so the tool this repo ships can still bypass the rule the docs now state.

All three docs now say not to use it to publish until it is reworked. The fix is a real CLI behaviour change (branch + gh pr create, or stop after the signed commit) with knock-on effects on the pushed output field, manifest.rs descriptions, cli.rs help text, and tests/ship.rs — so it wants its own decision and its own PR. Its §5.6 description-cap gate and bundle-drift check remain useful meanwhile; --dry-run --no-sync exercises them without pushing.

Verification

  • No skill directories touched → no bundle rebuild required; drift sweep unaffected.
  • .githooks/check-description-length.py over every SKILL.md → pass.
  • reuse lint → compliant.

Note on the preceding commits

The three commits that landed earlier today (094c806, 86b57d1, and the v1.42 skill sync) went directly to main under the now-withdrawn auto-push note. I have not rewritten that history — rewriting pushed main is worse than the inconsistency. This PR is the first Construct change to follow the new rule.

🤖 Generated with Claude Code

…mption

The two repos disagreed about workflow. /spacecraft-software/standard/CLAUDE.md
states "Branch + PR, never push to main" for **both** the Standard and Construct
repos, while Construct's own maintainer-local CLAUDE.md claimed this repo was
"pre-authorised for auto-push on skill-directory changes" and CONTRIBUTING.md
step 5 was a bare `git push … main`. Construct's actual recent history (#11,
#21, #22) is squash-merged PRs, so the auto-push note was the outlier.

Resolved in favour of branch + PR:

- AGENTS.md gains a "Branch + PR — never push to main" hard rule (it had no
  push rule at all, only a pointer to CONTRIBUTING.md).
- CONTRIBUTING.md step 5 replaced: feature branch → PR → squash-merge → delete
  branch, with the gh invocation. Noted as a two-repo rule binding human and
  assistant-driven changes alike.
- Both state that an agent stops at opening the PR; merging is the maintainer's
  call and an agent never merges its own PR.
- The maintainer-local CLAUDE.md (gitignored) is updated to match.

Also flagged, not fixed: `construct skill ship` hard-codes
`git push origin main` (construct-cli/src/commands/ship.rs:235), so the shipped
tool can still bypass the rule. All three docs now say not to use it to publish
until it is reworked — branch + `gh pr create`, or stop after the signed commit.
That is a CLI behaviour change with schema, help-text, and test impact, so it is
left as a separate decision.

No skill directories touched, so no bundle rebuild. Description cap and
reuse lint pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@UnbreakableMJ
UnbreakableMJ merged commit 535ead7 into main Aug 5, 2026
1 check passed
@UnbreakableMJ
UnbreakableMJ deleted the workflow-require-prs branch August 5, 2026 08:50
UnbreakableMJ added a commit that referenced this pull request Aug 5, 2026
…ng to main (#26)

#25 made branch + PR the rule for this repo but left `construct skill ship`
hard-coding `git push origin main`, so the tool we ship could still bypass the
policy the docs state. This closes that gap.

`ship` now: enforces bundle-drift and the §5.6 description cap (unchanged),
resolves a feature branch, switches to it, stages by explicit name, makes the
signed UTC commit, pushes the branch with `-u`, and opens the PR with `gh`. It
never pushes to the default branch, and it never merges — that stays the
maintainer's call.

Branch resolution, in order:
- `--branch/-b` when given;
- the current branch when it is not the default branch, so a re-run adds a
  commit to the branch an open PR already tracks rather than fragmenting work;
- otherwise a generated `ship/<slug>` derived from the shipped skills. The name
  is deterministic for the same skill set, which makes the re-run case land on
  the same branch.

The default branch is read from `origin/HEAD`, falling back to `main` when it is
unset (fresh clones and fixture repos have no remote refs).

`gh` is now a dependency: it is probed *before* the work tree is touched, so a
missing `gh` fails with DEPENDENCY_MISSING (127) rather than stranding a
committed branch the caller has to finish by hand. If a PR for the branch is
already open, `gh pr create` exits non-zero — that is not a ship failure, since
the commit is already pushed onto the branch the PR tracks, so the existing URL
is looked up and returned.

Auto-sync is removed. `ship` no longer lands anything on the default branch, so
`nix flake update construct` would have pinned an unrelated revision; run
`construct skill sync` after the PR merges. `--no-sync` is kept as a hidden
no-op so existing invocations and scripts keep working.

Output is now `status: "pull_request_opened"` with `branch`, `base_branch`, and
`pull_request_url`; `flake_updated`/`synced_at` are gone. Dry-run reports
`default_branch`, `current_branch`, `branch`, `would_create_branch`, and
`would_open_pull_request`. manifest.rs updated in step (the
`manifest_in_sync_with_cli` test is the guard).

Tests: three new cases — shipping from the default branch must plan a `ship/`
branch and a PR and never target the default branch; `--branch` wins; an
existing feature branch is reused. `--no-sync` dropped from the existing cases
to prove it is no longer needed. 9 ship tests, 40 total, all passing.

Drive-by, required to get a clean gate: src/sources/skillmd.rs had its `split`
helper declared after `mod tests`, which trips clippy's items_after_test_module
under `-D warnings`. Pre-existing on main and invisible because CI runs only
reuse/config/description checks, not cargo. Moved the test module to the end of
the file; no logic change.

cargo fmt --check, cargo clippy --all-targets -- -D warnings, and cargo test all
clean. AGENTS.md and CONTRIBUTING.md updated to describe ship as the automation
of the workflow rather than a tool to avoid.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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