Skip to content

fix: report a refused publication next to the files the run wrote - #221

Merged
goldbarth merged 1 commit into
mainfrom
fix/219-publish-failure
Sep 22, 2026
Merged

goldbarth merged 1 commit into
mainfrom
fix/219-publish-failure

Conversation

@goldbarth

Copy link
Copy Markdown
Owner

Closes #219
Follows #218

  • A refusal names the write, not the tag: a 401/403/404 on publishing says GitHub refused to publish the release notes for the tag to the repository, whether a token was sent, and that publishing needs Contents read and write. GitHub's named permission (x-accepted-github-permissions) is quoted when present. The pull requests were read a moment earlier, so a refusal here is about writing - most likely the read-only token the docs recommend until a run publishes.
  • No raw JSON: every other error quotes GitHub's message field, against the tag instead of an API path (repos/.../releases/42).
  • The files survive the error: publishing is the last write, so the pipeline catches its InvalidOperationException (the port's documented failure) and returns it as ReleaseOutcome.PublishFailure next to WrittenOutputs. Before, the exception dropped the list and the run printed only the error.
  • Output and exit code: the summary lists "Wrote:", then "Not published: the release notes." with the reason and what a re-run costs: it replaces this release's CHANGELOG.md section and draft rather than adding to them (checked in ChangelogMarkdownComposer), but pays for the model calls again. Exit code 1, as for a failed audience.
  • One reading of GitHub errors: GitHub/GitHubErrorResponse holds what fix(pull-requests): name the repository and the token, not a commit, when GitHub refuses access #218 put in the pull request reader (message, token sent, named permission, rate limit), now shared by both adapters. A 401 counts as a rejected token only when one was sent; without one it is the missing token.
  • The writer takes the token variable from the composition root, as the reader does since fix(pull-requests): name the repository and the token, not a commit, when GitHub refuses access #218.
  • docs/cli.md: what a refused publication leaves behind.

Verified: the real GitHubReleaseNotesWriter against api.github.com without a token (nothing can be written that way):

Error: GitHub refused to publish the release notes for v9.9.9 to goldbarth/chartula (401 Unauthorized).
  The request carried no token: GITHUB_TOKEN is not set.
  Publishing needs a token with Contents read and write on goldbarth/chartula.

Not verified end-to-end: the full generate run up to the refusal (needs a paid model run) and the 403 with a real read-only token; both covered by tests, the token case comes with the token-permission check still pending.

Tests: 3 new in GitHubReleaseNotesWriterTests (read-only token with named permission, no token, other error in GitHub's words), 1 in ReleasePipelineTests (refusal keeps the written files), 1 in ReleaseCommandOutputTests (listing, message, exit code 1); full suite 651 passing, build and dotnet format clean.

@goldbarth goldbarth added this to the Launch milestone Sep 22, 2026
@goldbarth goldbarth self-assigned this Sep 22, 2026
@goldbarth
goldbarth merged commit abd322b into main Sep 22, 2026
4 checks passed
@goldbarth
goldbarth deleted the fix/219-publish-failure branch September 22, 2026 14:14
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.

A failed publish reports raw JSON and hides the files the run already wrote

1 participant