Skip to content

fix(faithfulness): compare the rule-based check's names with whitespace folded and fences taken out - #336

Merged
goldbarth merged 1 commit into
mainfrom
rule-check-line-breaks
Oct 6, 2026
Merged

goldbarth merged 1 commit into
mainfrom
rule-check-line-breaks

Conversation

@goldbarth

Copy link
Copy Markdown
Owner

Closes #315

  • Why: the rule-based check looked up each quoted or backticked name of a rendering in the facts as written, line breaks included. A rendering is one line per entry (RenderingComposer.SingleLine folds every run of whitespace), so a name a description wraps over two lines was not found and was flagged although the facts back it. A fenced code block made it worse: folded onto one line, its three backticks paired with the backticks of the code spans around it, and the text between them was flagged.
  • Both sides in the same form: the rendering and the facts are compared with every run of whitespace folded into one space and every fence (three or more backticks) replaced by a space. The check stays a lookup, decided without a model; it now looks up the text in the form the rendering has.
  • Facts stay apart: the parts of the haystack are joined by a NUL instead of a line break, so once whitespace is folded a name still cannot be found across the end of one fact and the start of the next.
  • What is still flagged: a name the facts do not contain, in any spacing.
  • A real release as a fixture: chartula-preview-3-release is v0.1.0-preview.3 of this repository, frozen from a run record as docs/development/testing.md describes. Its descriptions are hard-wrapped and hold fenced blocks, which is the case the issue found; The_fixtures_cover_the_cases_the_pipeline_treats_differently holds that they still do.
  • Docs: testing.md drops the note that such a release fails the suite and lists the new fixture; architecture.md says how the rule-based check compares now.

Verified:

  • Reproduced before the fix: the run record came from 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, so no tokens. Frozen into the fixture, it failed Text_that_only_repeats_the_facts_is_never_flagged with the flags the issue lists (' $ chartula generate --no-publish --tag v0.1.0-preview.2 ... ', ' Every hash matches ', and others).
  • After the fix, the fixture passes every fixture test, and the unit tests below pass.

Tests: RuleBasedFaithfulnessCheckerTests gains four: a name wrapped in the description, text around a fenced block the rendering repeats, a name truly absent still flagged with its spacing folded, and no match across two facts. The new fixture joins FactBaseFixture.All, so every fixture test runs on it. All tests pass.

@goldbarth goldbarth self-assigned this Oct 6, 2026
@goldbarth
goldbarth merged commit 02cfc95 into main Oct 6, 2026
4 checks passed
@goldbarth
goldbarth deleted the rule-check-line-breaks branch October 6, 2026 17:02
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.

The rule-based check flags a quoted phrase that the facts break over two lines

1 participant