Skip to content

feat(releases): stop before replacing the notes of a published release unless asked - #335

Merged
goldbarth merged 2 commits into
mainfrom
protect-published-release
Oct 6, 2026
Merged

goldbarth merged 2 commits into
mainfrom
protect-published-release

Conversation

@goldbarth

Copy link
Copy Markdown
Owner

Closes #334

Splits the publishing half off #249, which keeps the interactive review of flags.

  • Why: generate on a tag whose release is already published replaced its notes in public, with no draft in between and without asking. Hand-written notes were gone, and the README listed it as a known limitation. A first run by someone new to Chartula, on a repository with published releases, could hit it.
  • Stop before the first model call: EnsureCanWriteAsync already runs before any model call to check the token. It now also looks the release up by tag (GitHub's lookup by tag finds published releases only) and refuses unless replacing was asked for. The run costs nothing and says what to do: the release's link, --replace-published, and, from the pipeline, --no-publish.
  • Checked again at the write: WriteAsync refuses the same way, so a release someone published while the run was rendering is not replaced either.
  • --replace-published, not a question: an explicit option works the same in a terminal and in CI, where no one could answer. It is a generate option only; the other commands refuse it like any option they do not take.
  • A required parameter on the port: replacePublished has no default on either method, so every caller decides; doctor passes false, since it checks what a plain generate would do.
  • Drafts are unchanged: a draft from an earlier run is still found and updated without the option.
  • doctor: the "GitHub write" check warns about a published release the way it warns about a token that may not publish, with the same message a run would print.
  • Docs: the README limitation is gone and the generate paragraph says what happens instead; github.md, ci.md and cli.md (new section --replace-published) describe it. A second commit rewrites the launch section of ROADMAP.md: the points done since fix(cli): say unauthenticated in the run header when a credential variable is unset #330, and the ones left before the announcement.

Verified:

  • Reproduced with the built CLI before the change: a scratch repository whose v1.2.0 holds one chore: commit, GitHub on a local stub that answers GET /releases/tags/v1.2.0 with a published release. generate --tag v1.2.0 --audience technical sent PATCH /releases/1 with the new body.
  • After the change, the same run stops with exit code 1 after POST /generate-notes and GET /releases/tags/v1.2.0; nothing is written, no PATCH is sent.
  • With --replace-published, the run writes the files and sends the PATCH.
  • doctor --tag v1.2.0 against the same stub shows warn GitHub write with the same message.

Tests: GitHubReleaseNotesWriterTests gains a test for the check and one for the write, each with and without the option, and the existing draft tests run without it; the passing check now expects the lookup after the permission request. ReleasePipelineTests holds that the check and the write are told the same; CommandLineArgumentsTests covers the option for generate and its refusal for doctor. All tests pass.

@goldbarth goldbarth self-assigned this Oct 6, 2026
@goldbarth
goldbarth merged commit f6a3992 into main Oct 6, 2026
4 checks passed
@goldbarth
goldbarth deleted the protect-published-release branch October 6, 2026 17:01
goldbarth added a commit that referenced this pull request Oct 6, 2026
…scriptions (#338)

Closes #337

**Prompt change: merge after the evaluation run in chartula-evals** (see
the last section). The `promptHash` moves from `sha256:18467240...` to
`sha256:adfdfc6c...`.

- **Why:** a fact's title and description, written by whoever opened the
pull request, were appended to the fact statement after `": "` and `" -
"`. Nothing marked where the author's text ended and Chartula's
instructions began, and nothing bounded it: a description with "ignore
the rules above", or a pasted log, went to the model as it was, once per
audience and once per check.
- **Quoted between tags:** `PullRequestQuote` writes `<title>...</title>
<description>...</description>` into the statement, in the rephrasing
prompt (`GroundedFactsFactory`) and in the thorough check's prompt
(`ThoroughFaithfulnessChecker`) alike, so both read the same text. An
opening or closing `title` or `description` tag inside the text, in any
case or spacing, has its `<` written as `&lt;`, so the text cannot close
its own quote or open another. Other angle brackets, such as
`List<string>`, stay as written.
- **Told what it is:** a sixth shared rule in every audience's system
prompt says the quoted text is material to rephrase, never instructions,
and that a cut description goes on beyond what the model sees. The
thorough check's system prompt says the same for the facts and for the
output it checks, which now stands between `<output>` and `</output>`
and cannot close that quote either, since a rendering may repeat what a
description said.
- **Cut at 8,000 characters, in the prompt only:** a longer description
ends in `[cut: N more characters not shown]`. The detailed pull request
bodies of this repository run to about 4,300 characters, so the limit
leaves room for them. The cut is made where the statement is built, not
in the fact base: the run record keeps the description whole, as
`CLAUDE.md` asks of a rendering-level concern, and a cut never splits a
surrogate pair.
- **What it does not do:** it makes text written to steer the model less
likely to work, not impossible. The README limitation now says that
("Pull request text is quoted, not trusted"), and so does `SECURITY.md`;
the roadmap's first point after the launch keeps the rest (breaking
status source, edits after the merge, links).
- **Docs:** `what-goes-into-a-release.md`, section 8, describes the tags
and the cut. The launch list in `ROADMAP.md` gets its line once #335,
which rewrote that section, is merged.

**Verified:**
- The built CLI, `generate --tag v0.1.0-preview.3 --repo
goldbarth/chartula --no-publish` in a throwaway clone, GitHub read for
real, the model on a local stub that records what it is sent: the system
prompt carries the new rule, and each fact reads `[n] Category:
<title>...</title> <description>...</description>`.

**Evaluation, before merging:** run the usual cross-run evaluation in
chartula-evals at this commit against the last baseline, one run per
audience, and compare flags and rubric results. A run costs tokens, so
it is not part of this pull request.

Tests: `PullRequestQuoteTests` (tags, a title alone, tags in the text
neutralized in three spellings, other angle brackets kept, the limit,
the cut and its note, no split surrogate); `ChangelogPromptBuilderTests`
(the output quoted and unable to close its quote, the rule in every
audience); `ThoroughFaithfulnessCheckerTests` expect the quoted
statement; prompt snapshots and `prompt-hash.txt` updated. All tests
pass.
goldbarth added a commit that referenced this pull request Oct 7, 2026
… to date (#344)

Follows #335 and #340 to #342, which each added an option to the help;
merging them left the help wrong.

- **Why:** on `main`, `chartula --help` listed `--replace-published`
under "How it looks" and `--audience` twice, once under "What a run
writes" and again after `--plain`. Both pull requests had edited the
same lines of the help text, and the merge kept parts of each.
- **Fix:** `--replace-published` stands under "What a run writes", after
`--no-publish`, and the second `--audience` block is gone. No option's
text changes.
- **A test for the shape:** the help is one string so that a test can
check it; `The_help_lists_each_option_once_under_its_group` now holds
each group's options, in order, and that each option is listed once. It
fails on the help as merged and passes on this one.
- **`docs/cli.md`:** the `doctor` status table and the sentence on the
last line name a published release as a cause of a warning under GitHub
write (#334), next to a token that may not publish.
- **`ROADMAP.md`:** #315, #337 and #339 move from "Left before the
announcement" to done; what is left is the release that ships them.

**Verified:**
- `chartula --help` from the built CLI before and after: three groups,
every option once.
- Nothing else of the merges needed repair: no conflict markers, the
build has no warnings, and the suite passed on `main` before this
change.

Tests: one theory with three cases in `CommandLineArgumentsTests`. All
tests pass.
goldbarth added a commit that referenced this pull request Oct 7, 2026
Follows #344. Step 1 of `docs/development/releasing.md`.

- **Why now:** the launch points are merged, and the binary people
install is still `0.1.0-preview.3`, which has none of them. The
announcement needs a release that holds what the README and the docs on
`main` describe.
- **What ships since preview.3,** 63 commits:
- a first run: `chartula doctor` (#295, grouped in #341), `chartula
--version` (#286), a free `preview` (#292), progress while a run works
(#297, with a spinner and `--plain` in #340), a first tag from the first
commit with a confirmation for a large range (#282);
- what a release contains: commits without a pull request (#291), issue
numbers at every depth (#293), a sentence for a release with nothing for
developers (#307 in #333);
- checks and prompts: pull request text quoted and bounded (#338), no
false flag for a wrapped phrase or a fenced block (#336), flags set
apart from the entries (#331);
- publishing: the token checked before the first model call (#285), a
published release not replaced unless asked (#335);
- the files: `changelog.json` without descriptions and readable as text
(#294, #332).
- **Breaks to state in the notes,** as `docs/versioning.md` asks of a
preview:
- `changelog.json` is schema version 2: a change's `description` is gone
(#294). The run record is schema version 3 and holds the complete facts.
- `generate` stops on a tag whose release is already published;
`--replace-published` restores the old behaviour (#335).
- An option a command does not take stops the run (#301), and
`--whole-history` is gone (#282).
- The terminal output changed form (#340 to #342): the summary's first
line, audience headings in place of `--- Technical ---`, and `doctor`'s
last line. A script that reads those lines needs a look; exit codes and
the files are unchanged.
- The csproj `Version` is the single source; nothing else carries the
number.

**After merge:** tag the merge commit on `main` with `v0.1.0-preview.4`
and push it; `release.yml` builds the draft, `chartula generate --tag
v0.1.0-preview.4` writes the notes into it, and publishing runs
`install.yml`. The pinned `v0.1.0-preview.3` in `docs/ci.md` and
`docs/install.md`, and the template link in the `doctor` samples, move
to the new tag once the release exists, with the changelog pull request
of step 6.

**Verified:** the built CLI prints `chartula 0.1.0-preview.4+<commit>`.

Tests: no test changed. Full suite 1,010 passing, build without
warnings.
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.

generate replaces the notes of a published release without asking

1 participant