Repository navigation
test(parity): run the corpus with Reflect views of the contexts (0322) - #722
Conversation
ParityReflect/* renders every case with its context as items of one jinja2::Reflect view of a shared copy of the document, held to the ToValue copy's result as the wide run is held to the narrow one. It runs only with JINJA2CPP_PARITY_CONTEXT=reflect: nightly in bindings.yml, under ASan, where it checks the owner chain of every reflected item. divergences/reflect.txt lists 11 cases: five mutation cases that need 0049 P5's stable JSON identity, and six where a JSON view is looked up keys-first like a reflected struct while Python treats it as a dict, filed as 0370. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWNL7nqXUvCsDpYRatAhes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWNL7mTfobPRjMsgmWh7KP
|
CI on d5d7829: 40 checks green, including @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. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DTQTriEsFrrBgcYNKDUUF4
- 0322 done: #722 merged and the nightly bindings run is green. - reflect.txt: the five mutation lines that named 0049 (done) now name 0212, which took 0049 P5 (JSON accessor identity); 0212 says so. - docs/parity.md summary regenerated: 3043 cases, 3016 match. - release-2.0.md G1: 0186's O2 version macros are done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017r4qbSd8vaW6bzt8m4g9it
Requested by Ruslan · project thread
Problem
Since 0311 S7, the parity corpus passes every context through
jinja2::ToValue, which makes a copy. The view path,jinja2::Reflect, answers lookups, iteration, comparisons and filters through the generic map and list adapters. Until now only the ~100 rows oftest/binding/conformance.hchecked it (task 0322).Change
ParityReflect/*intest/parity/parity_test.cpprenders every case with its context as items of oneReflectview of a sharedordered_jsoncopy. The items keep the document alive, not the harness. The result is held to the copy's result, the same way the wide run is held to the narrow one, so a divergence the copy already has is listed only once. The pass runs only whenJINJA2CPP_PARITY_CONTEXT=reflectis set. Without it the suite is empty (GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST), so the per-PRctest -R paritydoes not change.test/parity/divergences/reflect.txtis one allow-list for the whole pass, with idsreflect.<id>, loaded together with the area files.DivergencesNameExistingCasesstrips the prefix.update_divergences.pyleaves alone any line that has no recorded outcome, so normal runs do not touch this file.bindings.yml, the ASan job (gcc-14, address+undefined, Boost bigint) runs the pass after the binding tests. It runs nightly, on demand, and on PRs that match the job's path filter. The filter now also includesparity_test.cppandreflect.txt.test/parity/README.mdgets a "reflect run" section.What the pass found (11 lines)
methods.alias_*cases (m.updateon a loop item or on asetalias of a JSON list item, andnd['k'].append). When a JSON value is read twice, each read gets its own accessor, so a write lands in one cell and the other read does not see it. 0049 already records this as "no stable identity until P5'sIJsonNodemarker".ReflectgetsMapAttrPolicy::KeysFirst, the policy for reflected structs. The copy getsMethodsFirst, and Python treats the object as a dict. As a result,d.itemsreturns the keyitemsinstead of the method,attr('name')finds keys, andis sequenceis false. The fix belongs inGenericMapAdapterplus a dict marker on the JSON adapter, ideally the sameIJsonNodethat 0049 P5 plans (D7 option c). Those files are outside this group's ownership, so the fix is filed rather than made here.0322's done-when says reflect.txt holds only mutation cases. The six 0370 lines are an exception until 0370 lands, so 0322 stays
in-progress.Validation
Debug (gcc, nlohmann):
Parity*passed 5704 tests without the switch and 8554 withJINJA2CPP_PARITY_CONTEXT=reflect.ASan+UBSan (clang-18 RelWithDebInfo,
nlohmann_json;boost_json, detect_leaks=1, detect_stack_use_after_return=1):ParityReflect/*:ParityRegistry.*:*Json*passed 2973 tests with no sanitizer reports.scripts/preflight.sh: everything passed (clang-format, clang-tidy 22.1.8 on changed lines, null comparisons, task files).No rendering code changed, so this PR cannot make a line in
test/chat_templates/divergences.txt(test: Hugging Face chat template suite against transformers (0360 phase 1) #720) stale.Not done: a wide reflect run (only narrow is covered), and MSVC/Apple Clang builds of the new code (CI only).
CI on d5d7829: 40 checks green, including
bindings address+undefined (gcc-14), which runs the pass. Three macos-14 jobs were cancelled by GitHub's macOS 14 image brownout (the image retires 2026-11-02). That is not caused by this PR, and it was flagged for a separate CI change.Roles: main session only. The verifier was not run because this change touches only tests and CI, not
src/orinclude/. Red CI pushes: 0 of 1. Codex: 0 findings, 0 fixed, 0 declined.https://claude.ai/code/session_01AWNL7nqXUvCsDpYRatAhes
Generated by Claude Code