Skip to content

fix: settle files that differ from their own serialization - #33

Merged
gabrielspadon merged 1 commit into
mainfrom
fix/serializer-collapses-field-whitespace
Aug 17, 2026
Merged

fix: settle files that differ from their own serialization#33
gabrielspadon merged 1 commit into
mainfrom
fix/serializer-collapses-field-whitespace

Conversation

@gabrielspadon

Copy link
Copy Markdown
Collaborator

Corrected refresh run 32039247944 ran ten passes and never converged: digests alternated between two states rather than drifting, and every pass logged the same Post-run fixup: corrected 2 .bib files.

A provider returned titles containing a literal newline. The serializer wrote that verbatim while the strict parser collapses whitespace on read, so those entries could never equal their own re-serialization; the corpus digest moved every pass and the loop burned its ten-run ceiling. Three files affected (two sources plus one a2i2 copy).

Two changes. The serializer collapses whitespace inside every field value, so a multi-line value cannot reach a file. And the post-run fixup compares the serialized form against the file rather than asking whether a canonicalization rule reported a change: a file can differ from its own serialization with no rule firing, and the old gate skipped the write while the difference remained, which is why the damaged files never healed.

Verified on the corpus rescued from the failed run (3742 files, preserved by the artifact step added in #32): pass1 fixed=2, pass2 fixed=0, pass3 fixed=0, zero files churning. Both changes mutation-tested; reverting either fails a test. The postrun one needed a new test, since the existing suite missed that mutation.

ruff clean, mypy clean (55 files), pyrefly 0 errors, pytest 2026 passed, 2 skipped.

The refresh ran ten full passes and never converged. The digests alternated
between two states rather than drifting, which is not a pipeline that has more
work to do: it is two files being rewritten every pass.

A provider returned titles containing a literal newline. The serializer wrote
them verbatim while the strict parser collapses whitespace on read, so those
entries could never equal their own re-serialization. The corpus digest moved
on every pass and the loop exhausted its ten-run ceiling.

Two changes. The serializer collapses whitespace inside every field value, so a
multi-line value cannot reach a file. And the post-run fixup decides whether to
write by comparing the serialized form against the file, rather than by asking
whether a canonicalization rule reported a change: a file can differ from its
own serialization with no rule firing, which is exactly this case, and the old
gate skipped the write while the difference remained.

Verified on the corpus rescued from the failed run: the first pass repairs the
two files, the second and third change nothing, and no file churns. Both
changes are covered by tests confirmed to fail when each is reverted.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@gabrielspadon
gabrielspadon enabled auto-merge (squash) August 17, 2026 17:18
@gabrielspadon
gabrielspadon merged commit c584bff into main Aug 17, 2026
11 checks passed
@gabrielspadon
gabrielspadon deleted the fix/serializer-collapses-field-whitespace branch August 17, 2026 17:21
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.

1 participant