Skip to content

Reuse parsed value enclosures by default - #593

Closed
claell wants to merge 1 commit into
sciunto-org:mainfrom
claell:feature/592-reuse-value-enclosures
Closed

claell wants to merge 1 commit into
sciunto-org:mainfrom
claell:feature/592-reuse-value-enclosures

Conversation

@claell

@claell claell commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reuse parsed quote, brace, and safe bare enclosure styles in the default writer.
  • Preserve established quote/brace style when users edit field values.
  • Fall back to braces if a formerly bare integer is edited to ordinary text.
  • Keep braces as the default for new programmatic values without parser metadata.
  • Extend the enclosure matrix so stale no-enclosing metadata cannot authorize unsafe text.

Closes #592.

Validation

  • Complete enclosure suite under warnings-as-errors: 928 passed, 2 skipped.
  • Complete upstream suite: 2,588 passed, 4 skipped, with the four existing deprecation warnings in tests/test_entrypoint.py.
  • Complete pre-commit hook suite: passed.

The safety rule also turns eight formerly skipped matrix combinations into executable assertions because ordinary text with stale bare metadata now has an unambiguous enclosed result.

Review note

This changes default formatting but preserves semantics and reduces unrelated diffs. Callers that require uniform braces can still configure AddEnclosingMiddleware(reuse_previous_enclosing=False, ...) explicitly.

The edited-bare guard is important: blindly applying no-enclosing parser metadata after a value changes can emit invalid BibTeX. An explicit field.enclosing = "no-enclosing" demand still takes precedence for callers intentionally supplying a valid bare expression.

AI assistance

This pull request was prepared with ChatGPT Codex using GPT-5.6 Sol with high reasoning effort. Codex assisted with default-policy analysis, unsafe-edit discovery, matrix refinement, and validation. Automated validation is not a substitute for maintainer review.

* Preserve quote, brace, and safe bare styles during ordinary writes.
* Fall back to braces when edits make stale bare metadata unsafe.
* Retain brace defaults for values created without parser metadata.
@MiWeiss

MiWeiss commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Hi @claell — same note across all of your July 16 issues and PRs (#567#597), apologies for the repetition.

Closing this. Passing CI isn't evidence the underlying claim is real — it just means generated tests match generated code. The batch's timing, structure, and forward-referenced numbers point to this being AI-generated rather than manually found and checked, and reviewing it properly would take more effort than a targeted pass over the parser myself.

If this fixes something you actually hit: open a small, human-verified PR against a reopened issue with a real repro, and I'll review it in good faith. Any nontrivial design or API choice needs to be discussed and agreed first, not decided inside a PR. Please disclose and verify AI-assisted work before submitting going forward.

@MiWeiss MiWeiss closed this Sep 2, 2026
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.

Reuse parsed value enclosures by default

2 participants