feat(polish): emit polish: skipped frontmatter on lenient fallback#33
Merged
Conversation
Surface a polish bypass in the rendered YAML frontmatter so the degradation shows up in PR diffs. Without this marker, raw-Jinja output is structurally identical to a normal generation (same headings, same frontmatter shape) and slips past review — see attune-author#30 and attune-rag d39e39d, where a regeneration with polish silently bypassed merged in degraded form. The marker is only added when polish falls back to returning raw content in lenient mode (no API key, swallowed LLM error). The success path and the cache-hit path are unchanged. Helper is idempotent: re-running polish on an already-marked file does not double-write. Non-YAML output (project-doc templates with HTML-comment footers) passes through unchanged — surfacing bypass there would need a different mechanism and is deliberately out of scope here. Tests: - ``test_lenient_bypass_marks_yaml_frontmatter`` — bypass injects the marker; body is preserved verbatim. - ``test_lenient_bypass_is_idempotent_when_already_marked`` — re-running does not double-write. - ``test_lenient_bypass_passes_through_non_frontmatter_content`` — non-YAML content unchanged. - Updated golden snapshots reflect the new marker (snapshots are recorded under the lenient-by-default conftest fixture). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
silversurfer562
added a commit
that referenced
this pull request
May 15, 2026
…eck Phase 1 (#34) Bumps pyproject.toml from 0.11.1 → 0.13.0 and converts the CHANGELOG Unreleased section into the 0.13.0 release notes. Skipping 0.12.0 — the internal release/v0.12.0 branch carried the polish fact-check Phase 1 work but was never published to PyPI. That work now ships in 0.13.0 alongside the regenerator fixes prompted by attune-rag d39e39d. Headline changes: - #31 — reference templates carry typed Parameters/Returns columns without depending on the LLM polish pass (closes #30) - #32 — test fixture isolates the polish cache per session to prevent shared-state flakes in golden snapshot tests - #33 — polish bypass surfaced in YAML frontmatter (polish: skipped) - #28 — polish fact-check Phase 1 (already on main from prior PR) Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
3 tasks
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.
Summary
When polish falls back to returning raw Jinja content (no API key, swallowed LLM error in lenient mode), inject a `polish: skipped` line into the YAML frontmatter so the bypass is visible in PR diffs. Closes the "optionally" hardening item from #30.
Why
Without this marker, a polish bypass is structurally indistinguishable from a normal generation — same headings, same frontmatter shape — and slips past review. That's how attune-rag d39e39d landed in degraded form (lost `Parameters` / `Returns` columns and the human description). Surfacing the bypass directly in the rendered output makes the regression visible at the point of review.
What changed
Test plan
Notes on ordering
Stacks cleanly with #32 (test-isolation: polish cache → tmp dir). With #32 not yet merged, snapshot tests on this branch only pass deterministically if the local `~/.attune/polish_cache` is empty. CI sees an empty cache so it'll be fine. Recommend merging #32 first.
🤖 Generated with Claude Code