You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RemoveEnclosingMiddleware already records whether each parsed value used braces, quotes, or no enclosure. The default writer nevertheless configures AddEnclosingMiddleware(reuse_previous_enclosing=False), so an unchanged parse/write cycle converts quoted and bare numeric values to braces.
That creates unrelated diffs and means editing a field's value also changes its established enclosure style. This is avoidable layout mutation because the parser already has the necessary metadata.
Proposed default
Set reuse_previous_enclosing=True in the default unparse stack:
parsed quoted values remain quoted;
parsed braced values remain braced;
parsed bare integers remain bare;
explicitly demanded bare macro/expression values remain bare; and
new programmatic fields without parser metadata continue using braces.
Safety for edited bare values
Reusing no-enclosing metadata requires one guard. A bare integer may later be edited to ordinary text while retaining the original metadata. Emitting that text bare could create invalid BibTeX. When no-enclosing comes only from parser metadata (rather than an explicit field.enclosing demand), reuse it only while the current value is still numeric; otherwise fall back to the configured default enclosure.
Tests should cover unchanged quote/brace/bare values, edits to quoted and braced fields, the edited-bare fallback, and values created without metadata.
Compatibility
This is a formatting-default change, not a semantic transformation. Callers who prefer uniform braces can continue to supply AddEnclosingMiddleware(reuse_previous_enclosing=False, ...) explicitly. Preserving source enclosure choices is the less surprising default for ordinary read/edit/write use.
A standalone, validated draft implementation is available in PR #593: #593. During isolation, the implementation gained an edited-bare safety guard and converted eight formerly skipped matrix cases into assertions.
Hi @claell — I'm posting this same note on all of your July 16 issues and PRs (#567–#597), so apologies for the form-letter feel.
I'm closing this. The batch — 13 issues, 18 PRs, ~3,000 lines, opened within a two-hour window with spec-style language and forward-references to PR numbers that didn't exist yet — reads as AI-generated rather than something you hit and verified by hand. Reviewing it properly would cost me more time than just fixing the parser myself.
If this is a real bug you've actually hit: reopen it with a concrete repro and a small, human-verified fix, and I'll review it. Any nontrivial design or API choice should be discussed in the issue first, before code is written. Otherwise, please disclose and verify AI-assisted contributions before submitting them in future.
Activity
claell commentedon Jul 16, 2026
A standalone, validated draft implementation is available in PR #593: #593. During isolation, the implementation gained an edited-bare safety guard and converted eight formerly skipped matrix cases into assertions.
MiWeiss commentedon Sep 2, 2026
Hi @claell — I'm posting this same note on all of your July 16 issues and PRs (#567–#597), so apologies for the form-letter feel.
I'm closing this. The batch — 13 issues, 18 PRs, ~3,000 lines, opened within a two-hour window with spec-style language and forward-references to PR numbers that didn't exist yet — reads as AI-generated rather than something you hit and verified by hand. Reviewing it properly would cost me more time than just fixing the parser myself.
If this is a real bug you've actually hit: reopen it with a concrete repro and a small, human-verified fix, and I'll review it. Any nontrivial design or API choice should be discussed in the issue first, before code is written. Otherwise, please disclose and verify AI-assisted contributions before submitting them in future.