8000 ci: preflight generated release bodies before publishing by adityamukho · Pull Request #1001 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

ci: preflight generated release bodies before publishing - #1001

Merged
adityamukho merged 1 commit into
release/v3.0.0-alphafrom
fix/release-body-preflight
Dec 3, 2026
Merged

adityamukho merged 1 commit into
release/v3.0.0-alphafrom
fix/release-body-preflight

Conversation

@adityamukho
@adityamukho adityamukho commented Dec 3, 2026 •
Copy link
Copy Markdown
Collaborator

Summary

Prevent a late GitHub release failure when cargo-dist's generated announcement exceeds the release-body limit. For #994, cargo-dist 0.31.0 produces 118,058 Unicode code points; the generated workflow's echo adds one LF, so the submitted notes contain 118,059 and leave 6,941 code points of headroom.

This is a draft stacked on #994, targeting release/v3.0.0-alpha, so the diff contains only the preflight changes. The current branch/path filters exclude this stacked PR from CI; no CI results are claimed. The sole commit has no CI-skip directive. After integration, #994 must pass the preflight and the appropriate CI before tagging; the existing release gate also requires successful push checks for the exact tagged commit.

Type of change

  • Bug fix (non-breaking release automation)
  • New feature
  • Breaking change
  • Documentation / tests only

Changes

  • Add a standard-library Python checker for a cargo-dist manifest or an exact final notes file. Decode JSON before counting; preserve CRLF and trailing whitespace; report code points, UTF-8 bytes, UTF-16 units, SHA-256 and headroom. Fail on malformed output or mismatched expected tag/version.
  • Enforce the 125,000-code-point ceiling and warn at 120,000. Workflows also enable a conservative 125,000-byte project policy, because GitHub's exact Unicode counting unit is undocumented. Check the separate 131,072-byte Linux environment-string cap, including the ANNOUNCEMENT_BODY= name and terminating NUL.
  • Extend the existing handwritten release-gate.yml to download artifacts-plan-dist-manifest from the same run and check it before the generated host job. Require nonempty changelog content, the actual release tag, cargo-dist 0.31.0, and the extra LF used by the notes-file transport.
  • Add a read-only PR/branch-push workflow that derives the prospective tag from the root Cargo package and checks a fresh dist plan. Keep generated release.yml and dist-workspace.toml unchanged.
  • Add 53 CLI boundary, configuration and input-validation tests. Every fixture verifies its input remains unchanged. Both workflows validate dist-workspace.toml and the manifest against one audited version constant in the checker; the PR installer obtains that same validated version.

Measurement

Measured from #994 head 177689670813829900ddf21fe8c6e587ec0e82c0 with the checksum-verified official cargo-dist 0.31.0 binary:

dist plan --tag=v3.0.0-alpha --output-format=json
Content Code points UTF-8 bytes UTF-16 units
Extracted changelog 116,385 116,520 116,385
Generated announcement 118,058 118,193 118,058
Exact notes after echo 118,059 118,194 118,059

Generated heading/download overhead is 1,673 code points. The notes-file SHA-256 is ee937bbf1543e7ff5c00dede7033fa272b906accc4a11f6ea6c84766fbec7156. The earlier 141,076 figure is reported by #994, not independently reproduced from an earlier committed tree.

The compact full manifest is 243,064 bytes, already too large for one Linux environment string. The new gate therefore reads the artifact file instead of exporting the full inputs.plan JSON.

Validation

  • 53 preflight/configuration tests passed locally.
  • 71 total tests passed when combined with the existing release-validation suite.
  • Boundary tests cover 124,999 / 125,000 / 125,001 submitted characters; the additional LF; CRLF; Unicode, JSON escapes and UTF-16; byte/environment caps; malformed and missing bodies; tag/version mismatch; and missing changelog.
  • Both workflows parse as YAML and every shell step passes bash -n; shared audited-version wiring, direct host dependency and failure propagation inspected.
  • Patch passed git apply --check against the pinned source snapshot.
  • dist generate --mode ci --check passed on the pinned source; the generated workflow is unchanged.
  • Read PHILOSOPHY.md; no library, query, storage, or public API behavior changes.

cargo test, clippy and Rust formatting were not rerun: this changes Python/YAML release tooling only. No release was created or edited, and no workflow was dispatched or rerun. No product changelog entry is included in this release-automation-only draft.

Notes for reviewer

  1. Preflight timing: this checks the planning manifest. Cargo-dist recomputes the body during host after merging artifact metadata; this is not a literal check of final notes.txt immediately before gh release create. Reassess if custom artifact-producing jobs or generation behavior change.
  2. Hook ordering: in cargo-dist 0.31.0, custom plan jobs run concurrently with plan and are not directly tested by the host's always() condition, which accepts skipped intermediates. Host hooks also run alongside host, and publish hooks run after GitHub release creation here. The existing release gate is a direct failure dependency and avoids those ordering problems.
  3. Version selection: the PR workflow checks the version currently declared by the root crate. It does not claim to cover future [Unreleased] notes before the version bump. Repeat after final changelog/date staging and merge updates.
  4. Limits: GitHub CLI's issue tracker records an API maximum of 125,000 characters. The REST docs do not specify the Unicode unit. The byte budget is deliberately stricter project policy, not an asserted API byte limit. No live release-creation probe was made.
  5. No automatic truncation: failures preserve the complete announcement for an editorial fix. The checker is reusable in --notes-file mode without adding another LF.

Review follow-up

Addressed the findings in Claude's review:

  • Centralized the audited cargo-dist version in the checker. The PR validates configuration before installation; both workflows validate manifest/configuration against that same pin. Tests cover a synchronized config/manifest upgrade that must still fail until the transport audit pin changes.
  • Replaced the original sole commit with a clean message. This removes the skip directive from the PR's commit history, preventing propagation through the repository's commit-message-based squash defaults. Existing branch/path filters preserve the no-CI review scope.
  • Added escaped GitHub Actions warning/error annotations, including parser/input errors, while preserving JSON stdout and plain local diagnostics.
  • Derived an omitted warning threshold as the smaller of 120,000 and the chosen character ceiling; explicitly invalid thresholds still fail.
  • Enforced the nested measurements report shape in tests and removed temporary proposal wording.
  • Documented that the environment cap is an independent fallback if the stricter byte budget changes, and that validation must run on the parent PR before tagging.

Review-fix validation: 71 local tests passed, both workflow YAML files and shell steps validated, and the measured alpha announcement still passes at 118,059 submitted code points. No workflow was dispatched or rerun.

@adityamukho adityamukho left a comment •
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 644610a. This was a read-only review: I did not run the test suite, dist, or either workflow. Two findings are marked important; the rest are nits.

Important: [skip ci] can block the release, not just this PR's CI. The PR already says to remove it before merging; this is why it matters. The commit title ends in [skip ci], and this repo's squash setting is COMMIT_MESSAGES, so a squash merge of this PR or of #994 can carry the marker into the new head commit. GitHub then skips the push workflows for that commit. release.sh check_ci requires successful push runs of Rust, WASM, Lint, etc. for the tagged SHA, and a tag push on that commit can skip release.yml itself. Fix: amend the commit title before merging, and check the final squash messages for both PRs.

The other findings are inline.

— Claude (Opus 5.5), AI code review via Claude Code, posted from @adityamukho's account at their request

Comment thread .github/workflows/release-gate.yml Resolved
Comment thread .github/workflows/release-body.yml Resolved
Comment thread .github/release/check_release_body.py Resolved
Comment thread .github/workflows/release-body.yml Resolved
Comment thread .github/release/check_release_body.py Resolved
Comment thread .github/release/test_release_body.py Resolved
Validate the rendered release body through the existing release gate and
add an early PR preflight with boundary and configuration tests.

Use one audited cargo-dist version policy in both workflows. Surface
warnings as safe Actions annotations and support lower character budgets.

Incorporate review feedback while retaining the existing branch filters.
@adityamukho
adityamukho force-pushed the fix/release-body-preflight branch from 644610a to 532f3c8 Compare December 3, 2026 12:33
@adityamukho adityamukho left a comment
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at 532f3c8. All seven findings from the review at 644610a are resolved, and I found no new problems. This was a read-only check of the code: I did not run the tests, dist, or either workflow, and no CI has run on this PR.

  • [skip ci] marker: fixed. There is no skip marker in this PR's commit message or in #994's three commits. The squash setting is still COMMIT_MESSAGES, so check the final message when merging.
  • Version pin only checked after tagging: fixed. Both workflows check dist-workspace.toml and the manifest against AUDITED_DIST_VERSION.
  • Workflow cannot run on this PR: resolved by documentation. The workflow comment now requires the parent PR to pass it before tagging.
  • Warning easy to miss: fixed, with escaped annotations and injection tests.
  • --max-env-bytes: now documented as a backstop in both workflows.
  • --max-chars on its own: fixed, with boundary tests.
  • Flat report shape in tests: fixed, and the "proposed" wording is gone.

Still needed before tagging: Release Body Preflight and the rest of CI must pass on #994 after this is merged into it. Repeat the preflight after the final changelog and date edits.

— Claude (Opus 5.5), AI code review via Claude Code, posted from @adityamukho's account at their request

@adityamukho
adityamukho marked this pull request as ready for review December 3, 2026 15:35
@adityamukho
adityamukho merged commit f2cf26c into release/v3.0.0-alpha Dec 3, 2026
@adityamukho
adityamukho deleted the fix/release-body-preflight branch December 3, 2026 15:36
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

0