fix(frontmatter): keep the last character of a bare scalar that ends in a quote - #183
Merged
Merged
Conversation
…in a quote `unquote` stripped a leading OR a trailing quote independently, so a value that merely ended in one lost its last character. `check: python3 -c "print(1)"` read back as `python3 -c "print(1)` — an unterminated shell quote — and a title ending in `'7'` lost the closing mark. `formatYamlScalar` already refuses to write that shape: `stringNeedsJsonEncoding` returns true for a value matching /["']$/. So no page this writer produced was ever affected, and the loss fell entirely on frontmatter written by another hand. Measured on one such corpus: 1,378 of 3,655 pages, 1,376 of them in a `check` field, which is the command a claim is re-executed by. The rule is now a matched pair, which is what the writer's own encoder assumes. A quoted value still unwraps; an unmatched quote is data. The new test fails on the previous rule and passes on this one; 222 of 222 tests under src/ pass.
tangletools
approved these changes
Sep 1, 2026
tangletools
left a comment
Contributor
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 60007061
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
This approval is provisional. It rests on the audit running. If the audit cannot run — for example the CLI bridge rejects it — this approval is dismissed rather than left standing, so an unrun check never reads as a passing one.
tangletools · auto-approval · reason: drewstone_author · 2026-09-01T17:47:53Z
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.
What breaks
unquoteinsrc/frontmatter.tsstrips a leading or a trailing quote independently:So a bare scalar that merely ends in a quote loses its last character.
check: python3 -c "print(1)"python3 -c "print(1)title: the symbol '7'the symbol '7A truncated
checkis an unterminated shell quote. Every claim graded by re-executing it recordsunrunnablewhatever the claim proved.Why the writer never produced it, and who pays
formatYamlScalaralready refuses the shape —stringNeedsJsonEncodingreturns true for a value matching/["']$/— so no page this package wrote was ever affected. The loss falls entirely on frontmatter written by another hand, which is the normal case for a store a product already had.Measured on one such corpus (Discovery Lab, 3,655 shared pages): 1,378 pages lost a character, 1,376 of them in
check, 2 intitle, 1 inexpect.The fix
Strip a matched pair, which is what the writer's own encoder assumes. A quoted value still unwraps; an unmatched quote is data.
Proof
src/frontmatter.test.tsfails on the previous rule (Tests 1 failed | 4 passed) and passes on this one.npx vitest run src/— 24 files, 222 of 222 tests pass.