fix(generator): render typed Parameters/Returns columns without polish (#30)#31
Merged
silversurfer562 merged 1 commit intoMay 15, 2026
Conversation
#30) The Jinja meta-template for `reference.md` only emitted a 3-column table (`Function | Description | File`). The richer 4-column table seen in committed help templates was synthesized by the LLM polish pass. When polish was bypassed (no API key, lenient mode, or a silently-swallowed failure), regeneration produced a structurally lossier file that looked normal in a diff and slipped through PR review. See attune-author#30 and attune-rag commit d39e39d. This commit makes the structural data flow without depending on the LLM: - Capture `params` and `returns` on each entry in `_SourceInfo.function_signatures` via a small `_split_signature` helper that parses the already-formatted signature string. No new AST traversal — reuses `_format_function_signature` output. - Thread `function_signatures` (and `class_signatures`) into the Jinja render call in `_render_template` so help templates can render typed data. - Update `meta_templates/reference.md.j2`: - Render `feature.description` directly under the title so the human-written intro from `features.yaml` survives without polish. - Render a 4-column `Function | Parameters | Returns | Description | File` table from `function_signatures` when available, falling back to the 3-column shape from `public_functions` for callers that pass the legacy data only. Polish still has a job (rewriting prose, smoothing tone). It is no longer the only source of structural columns, so a polish bypass degrades prose quality rather than silently deleting typed data the AST already has. Tests: - New `TestSplitSignature` unit tests cover the parser (typed params + return, no-return, complex pipe-union returns, defensive no-match shape). - New `TestReferenceTemplateColumns` asserts the rendered reference template contains the 4-column header, typed parameters from the AST, the return annotation, and the feature description — all *without* polish. - Updated reference golden snapshot to reflect the new shape. Closes #30. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2 tasks
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
.help/templates/<feature>/reference.mdsilently drops theParametersandReturnscolumns + human description when the LLM polish pass is bypassed.What changed
_collect_functionnow also storesparams: strandreturns: stron eachfunction_signaturesentry, computed from the existing formatted signature via a small_split_signaturehelper. No new AST traversal._render_template(the.help/path) now passesfunction_signaturesandclass_signaturesinto the Jinja render call alongside the legacypublic_functions/public_classes.meta_templates/reference.md.j2:feature.descriptiondirectly under the title, so the intro fromfeatures.yamlsurvives without polish.Function | Parameters | Returns | Description | Filetable fromfunction_signatureswhen available, falling back to the previous 3-column shape frompublic_functionswhen only the legacy data is present.Why
A regression slipped into attune-rag's main branch this week — see attune-rag d39e39d. Regenerating
.help/templates/benchmark/reference.mdwith polish bypassed droppedParameters/Returnscolumns and the human description. The diff looked normal at review time (frontmatter + headings + a function table) so it merged.The data the user lost was already present on
_SourceInfo.function_signaturesfrom the AST — it just wasn't being threaded into the Jinja render call.Before / after
Before (raw Jinja, polish bypassed):
```markdown
Benchmark reference
Functions
After (raw Jinja, polish still bypassed):
```markdown
Benchmark reference
Precision/recall/faithfulness benchmark runner — gates CI on configurable thresholds; supports custom query files and optional faithfulness scoring via --with-faithfulness
Functions
Test plan
TestSplitSignatureunit tests: typed params + return, no-return, complex pipe-union return, defensive no-match shape.TestReferenceTemplateColumnsasserts the rendered reference template contains the 4-column header, typed parameters, return annotation, and the feature description — without polish.tests/test_dogfood_help.py) still pass.test_task_template_matches_snapshot— cache cross-contamination with a real API key in.env, reproducible onmain, unrelated to this change).🤖 Generated with Claude Code