Skip to content

feat(observability): show each step of a run while it works - #297

Merged
goldbarth merged 1 commit into
mainfrom
feat/run-progress
Sep 30, 2026
Merged

goldbarth merged 1 commit into
mainfrom
feat/run-progress

Conversation

@goldbarth

Copy link
Copy Markdown
Owner

Closes #283

  • Why: after the header a run printed nothing until it was done. A run takes from seconds to minutes, so a slow run looked like a hanging one, and a user could abort a run that was about to finish and pay for it again.
  • The steps are the ones the run already has, in its order: reading pull requests (one GitHub request per commit, counted off), rendering each audience, checking each rendering (the rule-based check and, when on, the thorough check). A preview shows the first step only, since it makes no model call (preview costs as much as generate, and its purpose is unclear #259).
  • A port next to the metrics: IRunProgress in Core/Observability (Begin, Advance, Complete). The pipeline begins reading and checking, ReleaseRenderer begins each audience it renders, and GitHubPullRequestReader counts off the commits. Without a console it is NullRunProgress.
  • A failed step stays the last line shown: the pipeline ends the current step in a finally, so the error that follows can be placed.
  • Terminal or not decides the shape, on stderr like the header: in a terminal the current line is rewritten in place (\r and clear-to-end-of-line), its time ticking each second while a model call runs, and a finished step keeps its line with its final time. Without one, as in CI, each step is one plain line as it starts, with no control characters. stdout carries exactly what it did before.
  • No time remaining: a model call's duration is not known before it returns, and a wrong estimate reads worse than none.
  • docs/cli.md shows what a run prints while it works.

Reproduced and verified end to end, no tokens: the built binary ran generate --no-publish in a scratch repository, GitHub and the model served by a local stub that takes 3 s per model call, stderr timestamped.

Before, nothing between the header and the end:

  0.1s Range:  the commits after v0.1.0, up to v0.2.0 (3 commits)
  6.5s exit 0

After, without a terminal:

  0.1s Range:  the commits after v0.1.0, up to v0.2.0 (3 commits)
  0.1s Reading pull requests (3 commits)
  0.2s Rendering technical
  3.4s Rendering customer
  6.4s Checking technical
  6.4s Checking customer
  6.5s exit 0

After, in a pseudo-terminal (script), as the terminal shows it once the run is done; while it ran, each line was rewritten each second (Rendering technical 0 s, 1 s, 2 s, 3 s):

Reading pull requests   3/3 commits      0 s
Rendering technical                      3 s
Rendering customer                       3 s
Checking technical                       0 s
Checking customer                        0 s

stdout of that run held no progress line.

Tests: FixturePipelineTests (the steps in order with the real renderer, ending with Complete; a preview shows only reading the pull requests), ReleasePipelineTests (a failing step is still ended before the error surfaces), GitHubPullRequestReaderTests (counts off each commit), ConsoleRunProgressTests (plain lines without a terminal and no control characters; the in-place line with count and time; a finished step keeps its line, 1 min 12 s; completing twice writes nothing), ProgressOutputTests (the built CLI without a terminal: progress on stderr, none on stdout, the failed step last before the error). Full suite 902 passing, build without warnings, dotnet format clean.

@goldbarth goldbarth self-assigned this Sep 30, 2026
@goldbarth
goldbarth merged commit 5090585 into main Sep 30, 2026
4 checks passed
@goldbarth
goldbarth deleted the feat/run-progress branch September 30, 2026 12:32
goldbarth added a commit that referenced this pull request Sep 30, 2026
…n stops (#299)

Follows #298, which added `docs/costs-and-checks.md`, the page this one
takes the diagnosis sections from.

- **Why:** the messages a run stops with were spread over `cli.md`,
`github.md`, `configuration.md`, `what-goes-into-a-release.md` and
`run-metrics.md`, each explained where its topic lives, but nothing let
a user start from the message. `docs/troubleshooting.md` is that entry:
message, cause, fix, with a link to the page that explains more.
- **It opens with `chartula doctor`,** which finds most of the setup and
range situations before anything is spent, and says which ones it cannot
find (a spent rate limit, a first tag, everything that only shows once
the model writes a whole release).
- **The situations:** no model key; GitHub cannot read the repository
(404); a rejected token (401); a token that cannot publish, which stops
`generate` before its first model call (#285); the rate limit, with and
without a token; a configuration error; a shallow clone; a first tag
without a terminal; a failed model call by status (404, 401 with and
without a key, 403), an unreachable endpoint, and an answer the SDK
cannot read, kept apart from an unreachable one (#288); an answer that
does not match the facts; an answer cut off at `maxOutputTokens`; a
context window too small; a thorough check that verified nothing; a slow
run, read from the progress lines (#297) and the run summary.
- **Every message is from a real run of the built binary,** in a scratch
repository, with GitHub and the model served by a local stub (a mode per
case: 404, 401, rate limit with `x-ratelimit-remaining: 0`, 403 with
`x-accepted-github-permissions`, model 404/401, an unknown
`finish_reason`, a reported prompt of 120 tokens, prose instead of a
verdict, a cut answer, a 4 s delay per call). Paths are anonymized to
`/work/my-repo`, the stub's address to `https://api.github.com/` and
`http://localhost:11434/v1`. The line after `The endpoint said:` came
from the stub, so the page shows it as `...` and says its wording
depends on the provider. The slow run's summary is the real local run
from the chartula-evals sweep already used in #298.
- **One home per explanation:** a message appears here and, where it has
one, on the page that explains its topic; the explanation itself stays
there and is linked. From `cli.md`, the status-by-status account of a
failed model call and the missing-key example move here and are replaced
by links. From `costs-and-checks.md`, the three diagnosis sections (slow
run, unreadable check, cut prompt) move here; the summary page keeps a
short list of the lines that point to a problem, each linking its
section.
- **A message corrected on the way:** the warning without a GitHub token
said a run spends "roughly one [request] per pull request". It spends
one per commit in the range, as `docs/github.md` says, so a release
merged with merge commits was underestimated. The class comment also
still claimed that an exhausted limit fails with a 403 naming a commit;
the run names the rate limit (`GitHubErrorResponse.cs`). Both are
corrected in `GitHubTokenNotice.cs`.
- **README:** Troubleshooting joins the "Setting it up" index;
`getting-started.md` links it under "Next".

**Verified:**
- Every case ran with the binary built from this branch; the outputs
match the page, and the corrected no-token warning was rerun after the
fix.
- Every relative link and anchor in all Markdown files of the repository
resolves (script, with a negative test).
- `dotnet build -c Release` without warnings, `dotnet format
--verify-no-changes` clean.

Tests: full suite passing (920), no test changed; no test asserts the
warning's wording.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01BQ1Z71j4Q2W1CwGYjF55No

---
_Generated by [Claude
Code](https://claude.ai/code/session_01BQ1Z71j4Q2W1CwGYjF55No)_

Co-authored-by: Claude <[email protected]>
goldbarth added a commit that referenced this pull request Sep 30, 2026
… exit status (#302)

Follows #299, which took the failure messages out of `cli.md` into
`troubleshooting.md`, and #301, which made the CLI refuse an option it
cannot read as meant.

- **Why:** `cli.md` mixed reference with setup and concepts: a copied
help text, a first-run style tour, the model failure messages, and the
range rules. It becomes the reference only, so a reader finds every
command, option, default, variable, stream and exit status in one place,
and the rest where it lives.
- **The copied help text is gone.** The page points to `chartula
--help`, which prints from the binary and so always matches the
installed version. In its place, one table of the commands (model calls,
files, publishing) and one table of every option with its value, default
and the commands that read it.
- **How options are checked, as #301 made it:** options follow the
command in any order, `--audience` may repeat, every other option comes
once; `-h` and `--help` print the help after a command too. The page
shows the `--nopublish` message and a table of the other refusals (an
option of another command, a missing value, an option given twice, `=`
instead of a space, a word that is no option), each with the message the
built binary printed.
- **`--tag` and `--repo` keep their defaults with their messages;**
`--since`, `--yes`, `--audience` and `--no-publish` each keep a short
section with the message a wrong value gives. The explanation of the
range stays in `what-goes-into-a-release.md`.
- **New: what goes to stdout and what to stderr,** from `Program.cs`,
`ReleaseCommand.cs` and the composition root, including that the range
question needs stdin to be a terminal and the progress line updates in
place only when stderr is one.
- **Exit status as a table** of every case that gives 0 and 1.
- **Environment:** the three credential variables with a link to their
home each; `Chartula__` settings and the environment-only settings link
to `configuration.md`; the install script variables link to
`install.md`.
- **`doctor`, `--version` and `preview` as the free command it is
(#292),** and what a run prints while it works (#297), stay; the
first-run walkthrough stays in `getting-started.md`.
- **Kept for 3.1:** the list of outputs under `generate` stays until
`docs/outputs.md` takes it.
- `providers.md`: one link pointed to the removed
`#when-a-model-call-fails`; it points to
`troubleshooting.md#a-model-call-fails`. README: the index row describes
the page as it is.

**Verified:**
- Every command, option and message on the page was run with the binary
from `main` against a scratch repository and local GitHub and model
stubs, with stdout and stderr captured apart: `--help`, no arguments,
`help`, `--version`, an unknown command, an unknown option, `--tag`
without a value, an unknown audience, `--since` without a value and with
a ref that is no commit, an invalid `--repo`, `preview` with and without
`--audience` and `--no-publish`, `generate` with and without
`--no-publish`, `doctor` with and without `--tag`, and `generate
--help`, and after #301 every refusal in the page's table
(`--nopublish`, `--tga`, `--tag` at the end and before `--no-publish`,
`--no-publish` on `preview`, `--since` on `doctor`, `--tag` twice,
`--tag=v1.3.0`, a bare `v1.3.0`). The exit status of each matches the
table.
- The `preview` example is a real run on this repository's
`v0.1.0-preview.3`; the `--version` line is the build of `main`.
- Every relative link and anchor in all Markdown files of the repository
resolves (script, with a negative test).
- No code, comment or message changed.

Tests: none, documentation only.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01BQ1Z71j4Q2W1CwGYjF55No


---
_Generated by [Claude Code](https://claude.ai/code)_

Co-authored-by: Claude <[email protected]>
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.

A run shows no progress between the header and the result, so a slow run looks like a hanging one

1 participant