Repository navigation
QC-08 refactor(adapters): XMLAdapter and BAMLAdapter on engine formats - #13
Draft
MaximeRivest wants to merge 1 commit into
Draft
MaximeRivest wants to merge 1 commit into
MaximeRivest wants to merge 1 commit into
Conversation
MaximeRivest
force-pushed
the
adapter-engine/qc-07
branch
from
June 10, 2026 10:36
83bb663 to
556085a
Compare
MaximeRivest
force-pushed
the
adapter-engine/qc-08
branch
from
June 10, 2026 10:36
a06faa6 to
a2e0b46
Compare
MaximeRivest
force-pushed
the
adapter-engine/qc-07
branch
from
June 10, 2026 10:44
556085a to
3ebdd69
Compare
MaximeRivest
force-pushed
the
adapter-engine/qc-08
branch
from
June 10, 2026 10:45
a2e0b46 to
0fd5da4
Compare
Two more personalities proving the Format seam — with the hard gate that
dspy/adapters/_engine/render.py shows a ZERO diff in this PR: new wire
formats are Format objects, never renderer changes.
- formats/xml.py: XMLFormat(ChatFormat) — tag wrapping, schema section
without a completed marker, single-call user content, the historical
output-requirements wording, and the DOTALL first-match-wins parser
with its known failure modes (nested tags, CDATA) reproduced verbatim,
including the error-message quirk that interpolates the FieldInfo repr
rather than the field name.
- formats/baml.py: BAMLFormat(JSONFormat) — only the two overridden
surfaces ({name}-placeholder schema joined with single newlines;
pydantic inputs as model_dump_json(indent=2, by_alias=True) with the
empty-segment filter). The simplified-schema helpers are imported from
baml_adapter (single source); the consolidation PR decides their final
home. Parse and assistant side inherited from JSONFormat.
- XMLAdapter.parse gains its engine branch (it overrides parse);
BAMLAdapter inherits JSONAdapter's branch and needs nothing.
- XMLAdapter keeps inheriting the Chat->JSON fallback unchanged.
- Stack tests updated for the migration state: TwoStepAdapter is now the
last unmigrated core.
Verification: XML+BAML request dual-runs (engine AND forced-legacy, both
equal to pre-engine fixtures); XML parse corpus dual-run; 80 XML parse
fuzz cases (prose wrapping, duplicates, broken/nested tags, truncation)
with zero divergence; chat/json corpora re-proven unchanged. Full
battery: 176 fixtures reproduce exactly; tests/adapters 1264 passed;
streaming/callback/predict/teleprompt green. render.py diff vs QC-07: 0
lines.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
MaximeRivest
force-pushed
the
adapter-engine/qc-07
branch
from
June 10, 2026 10:56
3ebdd69 to
d711d0f
Compare
MaximeRivest
force-pushed
the
adapter-engine/qc-08
branch
from
June 10, 2026 10:56
0fd5da4 to
cddaf50
Compare
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.
Stack: The Quiet Compiler
The headline gate
git diff QC-07..QC-08 -- dspy/adapters/_engine/render.pyis empty. Two new wire formats (different tag syntax, different schema renderer) landed purely as Format objects — the mechanical proof that the seam the future preset/YAML epics need actually works.What this PR does
baml_adapter(single source of truth) rather than duplicated.XMLAdapter.parsegains its engine branch; BAML inherits JSON's. XML keeps inheriting the Chat→JSON fallback. TwoStepAdapter is now the last unmigrated core.Gate evidence
tests/adapters1,264 passed | ✅ 80 XML parse fuzz cases, zero divergence | ✅ XML/BAML dual-runs on both paths equal pre-engine fixtures | ✅ chat/json corpora re-proven unchanged | ✅ streaming (incl. XML closing-tag listener)/callback/predict/teleprompt green🤖 Generated with Claude Code