Skip to content

Define an idempotent failed-block writing policy#589

Draft
claell wants to merge 3 commits into
sciunto-org:mainfrom
claell:feature/588-failed-block-policy
Draft

Define an idempotent failed-block writing policy#589
claell wants to merge 3 commits into
sciunto-org:mainfrom
claell:feature/588-failed-block-policy

Conversation

@claell

@claell claell commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve retained failed-block raw source unchanged by default.
  • Offer explicit annotate and fail-closed raise policies.
  • Keep opt-in annotations idempotent across repeated parse/write cycles.
  • Reject unknown policies and continue rejecting failed blocks without raw source.
  • Document why normal mutable blocks still serialize from model state rather than cached raw text.

Closes #588.

Dependency and commit structure

The first commit is the same focused configured-comment fix already represented by #530 / draft PR #566. It is included so the policy branch is executable against current main. The policy and annotation-idempotence changes are the second and third commits. After #566 merges, this branch should be rebased to remove the prerequisite diff.

Validation

  • Focused failed-block writer and round-trip tests under warnings-as-errors: 8 passed before the annotation follow-up, followed by the dedicated annotation-idempotence regression passing.
  • Complete upstream suite: 2,583 passed, 12 skipped, with the four existing deprecation warnings in tests/test_entrypoint.py.
  • Complete pre-commit hook suite: passed.

Review note

The proposed default changes from generated annotation to exact raw preservation. This is a deliberate integrity choice, but it is user-visible and needs maintainer review. The previous behavior remains available explicitly as annotate; strict consumers gain raise. There is intentionally no discard policy.

The implementation also avoids adding a second terminal newline to failed raw source. Without that detail, even annotate changes the failure's line count and cannot recognize its own diagnostic on the next cycle.

AI assistance

This pull request was prepared with ChatGPT Codex using GPT-5.6 Sol with high reasoning effort. Codex assisted with policy design, dependency isolation, regression analysis, newline edge-case repair, and validation. Automated validation is not a substitute for maintainer review.

claell added 3 commits July 16, 2026 16:39
* Format failed blocks with BibtexFormat.parsing_failed_comment.\n* Preserve the documented source-line placeholder.
* Write retained raw failures unchanged by default.
* Offer explicit annotate and fail-closed policies.
* Document why normal mutable blocks cannot safely use stale raw source.
* Recognize an existing annotation attached to the next failed block.
* Avoid adding a second terminal newline to retained raw source.
* Keep repeated opt-in annotation writes idempotent.
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.

Define an idempotent failed-block writing policy

1 participant