Adopt legaldown-validator 0.4.0's public API; remove validator_bridge.py - #3
Conversation
- Depend on legaldown-validator>=0.4.0,<0.5. - parse_document/validate_document -> parse/validate; assemble() -> parse_template(source).form(answers).assemble(). - ValidationResult fields -> result.index (sections, placed_markers, is_template, *_lookup). - Quote content from legaldown.syntax.quote_blocks, a drafting note's from drafting_note_blocks (replaces _without_drafting_marker and the past-depth branch), code blocks from code_content (replaces _code_block), the answers file from legaldown.load_answers (replaces cli._read_answers). - Lexer, directives and definition helpers from legaldown.syntax; grammar constants, value checks and conditions from legaldown.grammar, including VALID_PLACEHOLDER_TYPES and DECISION_QUESTION_TYPES for the resolver's own copies. - validator_bridge.py is deleted: nothing beyond the public API is used. - Tests fail on a legaldown DeprecationWarning (pytest filterwarnings). - Docs: architecture, roadmap U2/U3, CONFORMANCE, notes on ADR 0002 and 0007. Output is byte-identical (golden tests, and every specification example and fixture under each built-in style), except that a quote nested past the validator's quote depth that holds only a comment no longer renders an empty <p>, as at every shallower depth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013WmBAc5T7UCKVdpUmg9qxz
…ator-main job The job installed the renderer first, which resolves legaldown-validator>=0.4.0,<0.5 from PyPI, and only then swapped in the validator from main. Before a validator release is on PyPI that first step fails, which is exactly when this job is meant to tell us something. Installing the validator from main first satisfies the range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013WmBAc5T7UCKVdpUmg9qxz
|
CI status on this PR:
Generated by Claude Code |
- pyproject.toml: filterwarnings is error::legaldown.LegaldownDeprecationWarning, the one category every validator deprecation now uses, in place of the message regex. Checked: parse_document, validate_document, serialize_document, assemble, template_questions and import_definitions= each fail a test under it. - architecture.md: the filter as it now is; the renderer's diagnostics lack a line because they are about a directive within a block (a block's line is public since 0.4.0, Document.line_of); labels.py has six languages. - CONFORMANCE.md: validator 0.4 is the current dependency; the released legaldown-render 0.2.0 is built on 0.3.0. - PUBLISHING.md: release after the validator's minor release is on PyPI; the tests fail on its deprecations. - concepts.md: validator diagnostics carry a line (since 0.3.0). - ADR 0002, 0007: date the 0.4.0 notes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013WmBAc5T7UCKVdpUmg9qxz
Install the renderer first and force-reinstall the validator from main last, so the validator-main job keeps testing main once its version leaves the renderer's range (pip would otherwise replace it with the PyPI release). legaldown-validator 0.4.0 is on PyPI, so the range installs on its own again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q3fBapGwQ2J2vLzpDyjB5t
Review: adoption of legaldown-validator 0.4.0The PR moves the renderer onto validator 0.4.0's public API correctly, and rendered output is unchanged apart from the one edge case already described. I found one CI problem and fixed it in 90fccc0. The rest are small comments. What was checked
Fixed in 90fccc0The Nits (no change needed to merge)
Possible follow-ups using 0.4.0 features
Generated by Claude Code |
Bump the version to 0.3.0 for the release built on legaldown-validator 0.4.0's public API (#3), and name it in CONFORMANCE.md and the roadmap. The planned DOCX and PDF milestones move to v0.4 and v0.5 (ADR 0004 gets a dated note). The two HTML goldens carry the generator version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q3fBapGwQ2J2vLzpDyjB5t
The renderer now uses only legaldown-validator 0.4.0's public, semver-covered API, so
validator_bridge.pyand its private imports are gone. Rendered output is unchanged.Merge only after legaldown-validator 0.4.0 is on PyPI. The dependency is now
legaldown-validator>=0.4.0,<0.5, so the jobs that install from PyPI fail until that release is published. The "Against legaldown-validator main" job should pass straight away.Changes
legaldown.parser.quote_content,MAX_QUOTE_DEPTH, and render's own_without_drafting_marker/DRAFTING_MARKER/ past-depth branchlegaldown.syntax.quote_blocks/drafting_note_blocks(ForLegalAI/legaldown-validator#88, #93)legaldown.markdownfence helpers and build.py_code_blocklegaldown.syntax.code_content(#93)legaldown.cli._read_answerslegaldown.load_answers, with the CLI keeping the same messagesparse_document/validate_documentparse/validateassemble(source, answers)parse_template(source).form(answers).assemble()result.sections,placed_markers,is_template,*_lookupresult.index.*legaldown.validatorconstants and conditions; top-levelslugify_identifierlegaldown.grammarlex,Directive,find_definition_anchors,is_drafting_note,list_items,render_blocklegaldown.syntax_VALUE_TYPES/_DECISION_TYPESgrammar.VALID_PLACEHOLDER_TYPES/DECISION_QUESTION_TYPESDeprecationWarninginto an error, so a call that 0.5.0 will remove cannot slip in.Behaviour
ruffis clean.--answers.<p class="ld-p"></p>. It now renders nothing, as at every shallower depth. A new test pins this.Left as is, on purpose
These are places where the 0.4.0 answer is not exactly what the renderer needs, so the renderer keeps its own logic.
result.index.blanks: the renderer needs one decision per occurrence, andBlank.consistenthas a different scope._choosevsgrammar.choose_problem: for achoicequestion with malformedchoices,choose_problempasses the directive, but the renderer must still show it as invalid.Template.coerce: the renderer still reportsanswer-invalidfor inputs like5000 EURinstead of reshaping them. Coercing would be a behaviour change, so it is left for a separate decision.Release
PUBLISHING.md says a new validator minor version needs a renderer release. The renderer's version is not bumped here; bump it when cutting that release.
🤖 Generated with Claude Code
https://claude.ai/code/session_013WmBAc5T7UCKVdpUmg9qxz
Generated by Claude Code