Skip to content

feat: render a first tag from the first commit, and confirm a large range before it is read - #282

Merged
goldbarth merged 1 commit into
mainfrom
feat/first-tag-range
Sep 30, 2026
Merged

goldbarth merged 1 commit into
mainfrom
feat/first-tag-range

Conversation

@goldbarth

Copy link
Copy Markdown
Owner

Closes #281

  • Why: a first tag was refused, and the expected range, every commit up to the tag, had to be switched on with --whole-history, whose only effect was to lift the refusal. The name and the message called that range "the whole history", although it ends at the tag, so the message read as the opposite of what the run does.
  • A first tag starts at the first commit: the same default one step earlier than the previous tag, with no flag. --whole-history and WholeHistoryException are gone; CommitRange.IsWholeHistory is StartsAtFirstCommit. A run that still passes --whole-history is not broken silently: the CLI ignores unknown options, and the run stops at the question below.
  • The protection stays, as a question: a first tag, or a range with more commits than range.confirmAboveCommits (default 200), is confirmed before any GitHub request or model call. The text names the range with both ends, what it costs (one GitHub request per commit, every pull request to the model once per audience) and --since <ref> as the way to start later.
  • Twice, no by default: Render all N commits up to <tag>? [y/N], then Continue? [y/N]. Anything but y stops with Stopped: ..., exit code 1, nothing spent.
  • Without a terminal the run stops, and --yes confirms up front: a CI job has nobody to answer, and an unattended run should not spend on a range nobody approved. docs/ci.md advises passing it for that one release, not for good.
  • The threshold also covers a range between two tags: otherwise a forgotten --since on a long history is caught only on a first tag. 200 is well above a release of a few dozen pull requests merged with merge commits, and well below GitHub's 5,000 authenticated requests an hour. An unreadable or negative value is refused, since falling back to the default would let a range run unasked.
  • Rule in the domain, question in the CLI: LargeRangeRule decides, IReleaseRangeGate is the port, ConsoleRangeGate asks. It writes to stderr, so a prompt stays out of a changelog redirected from stdout, and asks only when stdin is a terminal. Without a gate the pipeline counts a range as declined.
  • The run header names every range, not only large ones: Range: the commits after v1.2.0, up to v1.3.0 (7 commits).
  • Run record schema version 3: range.start: "whole-history" is "first-commit". A value changes its name, which the stability rule counts as breaking. changelog.json is unchanged.

Verified end to end, no network, no tokens: binary from this branch in a scratch repository with three commits, v0.1.0, and one commit after the tag:

$ chartula preview --tag v0.1.0 --repo o/n < /dev/null
Range:  every commit up to v0.1.0 (3 commits), the first tag
        It costs 3 GitHub requests, and every pull request in it goes to the model once per audience.
        To start later, pass --since <ref>: the commits after <ref>, up to v0.1.0.
        No terminal to confirm this. Pass --yes to confirm it up front.
Stopped: The range of v0.1.0 was not confirmed, so nothing was read from GitHub or sent to the model.

$ chartula preview --tag v0.1.0 --repo o/n          # in a terminal, answering y, then n
Render all 3 commits up to v0.1.0? [y/N] y
This sends every pull request in the range to the model. Continue? [y/N] n
Stopped: The range of v0.1.0 was not confirmed, so nothing was read from GitHub or sent to the model.

$ Chartula__GitHub__ApiBaseUrl=https://127.0.0.1:1/ chartula preview --tag v0.1.0 --repo o/n --yes < /dev/null
Range:  every commit up to v0.1.0 (3 commits), the first tag
Error: Could not reach the GitHub API for commit bc6e833...: Connection refused (127.0.0.1:1)

The count is 3, not 4: the commit after the tag is not in the range. docs/cli.md matches chartula --help line for line.

Tests: LargeRangeTests (declined and ungated first tag stop before GitHub and the model, confirmed and --yes render, above and at the threshold, a named start is not asked about), ConsoleRangeGateTests (header with both ends, two yeses, anything else declines, no second question after a no, no terminal names --yes), RangeWiringTests (default, configured, refused values), FirstTagTests (built CLI without a terminal stops, with --yes goes on to GitHub), ShallowCloneTests (--yes does not get past a shallow clone), run record first-commit and version 3. Full suite 852 passing, build without warnings, dotnet format clean.

…ange before it is read

A first tag renders every commit up to it without a flag; --whole-history
is gone. A first tag, or a range above range.confirmAboveCommits (200),
is confirmed twice before any GitHub request or model call. Without a
terminal the run stops and names --yes. The run record's range start
whole-history becomes first-commit, schema version 3.

Closes #281
@goldbarth goldbarth self-assigned this Sep 30, 2026
@goldbarth
goldbarth merged commit 953a939 into main Sep 30, 2026
4 checks passed
@goldbarth
goldbarth deleted the feat/first-tag-range branch September 30, 2026 10:50
goldbarth added a commit that referenced this pull request Sep 30, 2026
… after a command (#301)

Closes #300

- **Why:** the CLI checked only the first word. Every option after it
was looked up by name and anything unknown passed over, so `generate
--help` started a run that, with a token that may publish, made every
model call and created a draft; `--nopublish` published; `--tga` and a
`--tag` without a value ran for the nearest tag; `--tag --audience
technical` named a tag `--audience`.
- **Checked before anything starts, not read leniently:**
`CommandLineArguments.Check` runs in `Program` before configuration, git
or GitHub, and refuses a command line it cannot read as meant, the rule
the configuration file already follows (#277, #278). The readers
(`GetOption`, `HasFlag`, `GetOptions`) stay as they are: after the check
they only see well-formed arguments.
- **Each command has its own options:** `preview` and `generate` take
`--tag`, `--repo`, `--since`, `--audience` and `--yes`; only `generate`
takes `--no-publish`; `doctor` takes `--tag` and `--repo`. An option of
another command says whose it is (`--no-publish is an option of
generate, not of preview.`).
- **An unknown option suggests the closest one** within two edits (`Did
you mean --no-publish?`), so the message carries the fix.
- **A value option needs a value that is not itself an option,** so
`--tag --no-publish` stops instead of naming a tag. A single-value
option given twice stops rather than the first winning; `--audience`
stays repeatable, as documented.
- **`-h` and `--help` win wherever they stand,** after the command is
known and before anything is checked, and exit `0`. `help` stays a
first-word command only, since a later `help` is more likely a value
than a request.
- **Two forms get their own message:** `--tag=v1.2.0` says to write it
with a space, and `--whole-history`, removed in #282, says what replaced
it. #282 had relied on unknown options being ignored for it.
- **Errors go to stderr with one line pointing to `chartula --help`,**
exit `1`, the same as the other usage errors. The help text says which
options `doctor` and `generate` alone take.
- `docs/cli.md`: the copied help text matches `chartula --help` line for
line again, and the page states that options are checked, with the
`--nopublish` example.

**Reproduced and verified end to end** with the built binary in a
scratch clone, GitHub pointed at a local stub that logs every request
and the model at a closed port:

```
                                   main                                  this branch
generate --help                    run starts, reaches the publish check help, exit 0, no request
generate --nopublish               run starts, reaches the publish check Did you mean --no-publish?, exit 1
preview --tga v0.1.0-preview.2     runs for v0.1.0-preview.3             Did you mean --tag?, exit 1
preview --tag                      runs for v0.1.0-preview.3             --tag needs a value, exit 1
preview --tag --audience technical Tag '--audience' is not in the checkout --tag needs a value, exit 1
```

Also refused, with no request: a repeated `--tag`, `--no-publish` on
`preview`, `--since` on `doctor`, `--whole-history`, `--tag=...`, a bare
`v0.1.0-preview.2`. `preview --audience technical --audience customer
--tag ...` still runs. Every CLI call in the docs, the workflows and the
install checks still passes the check.

Tests: `CommandLineArgumentsTests` (every option of each command passes;
each refusal with its exact message; `--whole-history`; which flags ask
for help), `ArgumentCheckTests` through the built CLI (`generate
--help`, `generate --tag v1.0.0 -h` and `doctor --help` print the help
and start nothing; `--nopublish` stops before the checkout is read).
Full suite passing, build without warnings, `dotnet format` clean.
goldbarth added a commit that referenced this pull request Oct 1, 2026
…320)

Follows #319 (ADR 0004); this branch builds on it for the index row and
is rebased onto `main` once #319 is merged.

- **Why:** seven changes since September made Chartula stop where it
used to choose silently, each with its own reasoning in its pull
request, but the rule they share was written down nowhere. A contributor
adding an option or a setting could not tell whether to refuse an
ambiguous value or take the likelier reading, nor when refusing goes too
far.
- **Context** lists the seven cases in one table, each with what the
silent choice did and the change that ended it: a first tag (#198 for
#138, #282), a key sent to the other provider's host (#235), an unknown
or misindented key (#238), a shallow clone read as a first release
(#244), review mode approving unseen text (#247), two configuration
files (#287 for #278), and options a command does not take (#301).
Decided is #198, the first of them.
- **Decision:** stop and say so instead of choosing; before anything is
spent; with a message that names the cause and the fix, shown with two
real messages; ask at a terminal where the answer is the user's, and
stop naming the option without one; refuse only what Chartula can tell
for certain (an empty list, an unknown host and an unknown model id are
taken as written); refuse a setting that would have no effect. The rule
is about what the user meant, not about what the release says, which is
what flags are for.
- **Consequences** name the cost: a run that could have produced
something stops, and a CI job fails until the input says what it means.
The ADR weighs that rerun against what a silent choice cost in the seven
cases. For a new case, four questions in order, so a contributor can
apply the rule rather than match it against the examples.
- The index in `adr/README.md` lists 0005.

**Verified:**
- Each case was checked against its pull request's description and the
issue it closes (#237, #243, #233, #278, #300, #138); the dates are the
merge dates.
- Both messages are the ones `docs/cli.md` and `docs/configuration.md`
show from the built binary.
- The counter-cases were checked in the code: `ProviderHost` accepts
every host but two, `ClaudeThinkingSupport` passes an unknown model id,
#289 reads an empty list as written, and #244 still runs `--since` in a
shallow clone when the range holds.
- Every relative link and anchor in all Markdown files of the repository
resolves (script, with a negative test).

Tests: none, documentation only.
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.

Render a first tag from the first commit by default and drop --whole-history

1 participant