Repository navigation
Parity suite against another Python Jinja2: JINJA2CPP_TEST_ORACLE (0186 phase 1) - #725
Merged
Merged
Conversation
…86 phase 1) CMake option JINJA2CPP_TEST_ORACLE=bundled|python|venv (cmake/parity_oracle.cmake) adds a CTest fixture that runs generate.py --out <build>/parity-oracle --any-version under another Python Jinja2 at test time, and jinja2cpp_parity_oracle, which runs the narrow suite with JINJA2CPP_TEST_ORACLE_DIR naming that directory. Where the two oracles agree a case is judged by the allow-list as before; where they differ it is reported as tracks-bundled, tracks-oracle, neither or not-run in report.md, and fails only under JINJA2CPP_TEST_ORACLE_STRICT=1. Bundled builds are unchanged. Files 0372 for the corpus gap on code points changed after Unicode 15.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWNL7oJQzYFjjoGQPuDCF2
generate.py --out no longer sweeps other *.json files from the directory and refuses expected/; report cells and strict-mode messages replace invalid UTF-8 and cut on a character boundary; a malformed oracle.json or index.json is a failure of OracleCorpusMatches rather than an exception at tear-down; clearer message for a venv without jinja2; README notes that ';' separates requirements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWNL7oJQzYFjjoGQPuDCF2
…ad-jt9vif # Conflicts: # CMakeLists.txt
Member
Author
|
@codex review Generated by Claude Code |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 802501815a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The venv stamp records the base interpreter, so a new JINJA2CPP_TEST_ORACLE_PYTHON rebuilds the venv; OracleCorpusMatches compares every rendering input (context, env, templates), not only the template, so a directory generated before a case changed fails instead of reporting deltas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWNL7oJQzYFjjoGQPuDCF2
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.
Requested by Ruslan · project thread
Problem
The parity suite compares only against the pinned oracle (Python 3.12, Jinja2 3.1.6, MarkupSafe 3.0.3). A user on another Jinja2 or Python could not ask whether Jinja2C++ matches their oracle. This is the open half of task 0186. The approved plan (sections 4.2-4.3, phase 1) makes the measurement configurable and leaves the library alone.
Resulting behaviour
JINJA2CPP_TEST_ORACLE=bundled|python|venv(cmake/parity_oracle.cmake, oneinclude()in the test block), plusJINJA2CPP_TEST_ORACLE_PYTHONandJINJA2CPP_TEST_ORACLE_REQUIREMENTS.bundledis the default and registers nothing new. Every CI job stays onbundled.pythonandvenvadd a CTest fixture,jinja2cpp_parity_oracle_generate(cmake/parity_oracle_generate.cmake). It builds a venv when needed and runsgenerate.py --out <build>/parity-oracle --any-version.generate.py --out DIRwrites the expectations plusoracle.json, which records the Python, Jinja2 and MarkupSafe versions.--any-versionworks only together with--out, soexpected/keeps the pin.--out expected/.parity_test.cppreadsJINJA2CPP_TEST_ORACLE_DIR.tracks-bundled,tracks-oracle,neitherornot-run. It fails only underJINJA2CPP_TEST_ORACLE_STRICT=1(decision O4).report.mdnext to the expectations.ParityRegistry.OracleCorpusMatchescatches a stale or malformed oracle directory. It compares every rendering input of each case: template, context, env and templates.ParityRegistry.OracleVerdictstests the classification table.generate.py --out,JINJA2CPP_TEST_ORACLE_DIRand these verdicts.Validation
ctest -R parityandgenerate.py --check(py3.12) pass. Regeneratingexpected/is byte-identical.python, py3.12, jinja2 3.1.6venv,jinja2==3.1.2;markupsafe==2.1.5on py3.12tracks-bundledvenv, jinja2 3.0.3 on py3.13tracks-bundledThese were measured on the 2850-case corpus. On master 2fc3fac the corpus has 2940 cases, and the 3.1.2 row is 2931 agree, 9 differ.
The 9 cases are the 8 from plan section 2 plus
string_filters.m168. That satisfies section 8's "done when". The 22 match the plan's measurement.STRICT=1fails the deltas, as designed.Parity/*:ParityRegistry.*is clean with and without an oracle dir, and under shuffle/repeat.scripts/preflight.shis green: clang-format, clang-tidy 22.1.8 on changed lines, task files.Process
.claude/agents/verifier.md. It found 0 blocking and 4 non-blocking findings, and all were fixed in the second commit:--outswept unrelated*.jsonfiles;oracle.jsonthrew at tear-down;Json::parse(...)temporary.Remaining
parity-oracles.ymlwith Jinja2 main, 3.0.x and Python 3.13/3.14 rows, follows in a separate PR.🤖 Generated with Claude Code
https://claude.ai/code/session_01AWNL7oJQzYFjjoGQPuDCF2