Repository navigation
fix: refuse a shallow clone instead of reading it as a first release - #244
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #243
GitCliCommitReaderasksgit rev-parse --is-shallow-repositoryright after the tag resolves. The reader runs first in the pipeline, so the refusal comes before any GitHub request or model call.git fetch --unshallow --tags,fetch-depth: 0,GIT_DEPTH: 0.--whole-historyis refused by the same check: it reaches the reader with no start, and the history it would render is not the whole history.WholeHistoryExceptionis never reached in a shallow clone, so the "first tag" advice that sent users to--whole-historyno longer appears there.--since <ref>still runs in a shallow clone, so a deliberately limited fetch is not blocked. It is refused with the fix when:shallowfile lies insidesince..tag: the start is connected along main, but a merged branch older than the depth is cut off, so commits of the release are missing. This is conservative: a boundary commit whose real parent is the start itself is refused too, since git hides that parent and the unshallow fix covers it.git fetch --tagshint, not in the CLI: it is about how the clone was made, not about Chartula's flags.fetch-depth: 0andGIT_DEPTH: 0(there was no CI snippet for checkout before);docs/cli.mdgets "A shallow clone" under "Where a release starts"; theIReleaseCommitReaderexception doc names the case.Reproduced before the fix, the issue's steps on a real shallow clone of this repository, binary built from main:
After
git fetch --unshallow --tagsthe same tag has 100 commits. (v0.1.0-preview.1is in fact this repository's only tag, so the "predecessor beyond the depth" case is reproduced in the tests below, on local shallow clones.)Verified after the fix, same clone, binary from this branch:
Tests: against real shallow clones (
git clone --depth Noverfile://, viaTempGitRepository.ShallowClone):GitCliCommitReaderTests(refused without a start;--sincefetched with the tag reads the range; start not fetched; start not connected; range cut off inside by a merged branch) andShallowCloneTests(the built CLI, with and without--whole-history: exit 1, the fixes named, no "first tag", no GitHub request). The six refusal tests fail on main. Full suite 813 passing, build without warnings,dotnet formatclean.