Skip to content

fix(cli): say unauthenticated in the run header when a credential variable is unset - #330

Merged
goldbarth merged 2 commits into
mainfrom
endpoint-notice-missing-key
Oct 6, 2026
Merged

goldbarth merged 2 commits into
mainfrom
endpoint-notice-missing-key

Conversation

@goldbarth

Copy link
Copy Markdown
Owner

Closes #210

  • Why: a run without GITHUB_TOKEN printed GitHub: ..., token from GITHUB_TOKEN directly above the warning that no token was found. The header named a source for a credential the run did not have, and the Model: line did the same for a missing model key.
  • What the line says now: unauthenticated, <VARIABLE> is not set when the variable is unset or blank, key from / token from <VARIABLE> as before when it is set. The variable stays named in both cases, so the line says what to set; a value is still never printed.
  • Blank counts as unset, as in GitHubTokenNotice and the HTTP client, so the header, the warning and the request agree on whether a token is sent.
  • Docs: providers.md said the header names the variable "not whether it is set"; it now says what the line reads without one.

Verified:

  • Reproduced with the built CLI before the change: preview without ANTHROPIC_API_KEY and GITHUB_TOKEN printed key from ANTHROPIC_API_KEY and token from GITHUB_TOKEN.
  • After the change the same run prints unauthenticated, ANTHROPIC_API_KEY is not set and unauthenticated, GITHUB_TOKEN is not set; with both set, the header is unchanged.

Tests: EndpointNoticeTests gains one test for an unset and a blank variable; the default test now sets both keys. All 945 tests pass.

@goldbarth

Copy link
Copy Markdown
Owner Author

Follow-up commit: the local-server sample in providers.md showed key from OPENAI_API_KEY and explained why; it now shows unauthenticated, OPENAI_API_KEY is not set.

@goldbarth goldbarth self-assigned this Oct 6, 2026
@goldbarth
goldbarth merged commit 51345c9 into main Oct 6, 2026
4 checks passed
@goldbarth
goldbarth deleted the endpoint-notice-missing-key branch October 6, 2026 13:07
goldbarth added a commit that referenced this pull request Oct 6, 2026
…e unless asked (#335)

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 #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.
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.

Run header says the token comes from GITHUB_TOKEN when none is set

1 participant