Repository navigation
Conversation
A JSON object viewed through jinja2::Reflect now looks names up as the dict Python's json.loads gives: dict methods before keys, attr() does not see the keys, it is a sequence, and tuple unpacking takes its keys. The JSON adapter's accessors derive from a new exported marker, jinja2::IJsonNode, which GenericMapAdapter detects once when it is made; reflected structs keep keys-first lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWNL7mCuJcu8xmBFskqHPP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWNL7mCuJcu8xmBFskqHPP
The cross-cast on every lent map item cost up to 19% of a reflect render; a two-slot cache keyed by the most-derived type answers with one compare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWNL7mCuJcu8xmBFskqHPP
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: c6ead2a26c
ℹ️ 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".
…0370) A JSON view now exports through ExportCopier::CopyMap, which read out every entry without checking maxSequenceSize. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWNL7mCuJcu8xmBFskqHPP
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
Parity batch 3, group E. Closes 0370.
Problem
A JSON object passed with
jinja2::ToValueis a dict to the template. Passed withjinja2::Reflect, it became aGenericMapAdapterwith the struct policy (KeysFirst,HasAttributes() == true), so the same document rendered differently depending on how the host passed it. Examples:d.itemswith a keyitems,attr('name'),map('attr', ...),is sequence. The ParityReflect pass (0322) listed six such lines.Change
include/jinja2cpp/json_adapter.hadds an exported marker,jinja2::IJsonNode. It is empty for now.json::ObjectAccessorandjson::ArrayAccessorderive from it. This is the marker from the approved 0049 plan (D7 option c). Public header change for G1: it is additive and changes no existing vtable.GenericMapAdapterasksIsJsonNode()once, when it is made. For a JSON object it then answersMethodsFirstandHasAttributes() == false. Any other host map, such as a reflected struct, keeps keys-first lookup.IsJsonNode()caches its answer by the accessor's most-derived type, in two relaxed atomic slots (one for the last JSON type, one for the last other type). Without the cache, the cross-cast on every lent map item cost up to +19% on reflect renders (verifier round 1).{% set x, y = j %}unpacks the keys, which was the third bullet of 0212.Tests
reflect.*lines naming 0370 are deleted fromtest/parity/divergences/reflect.txt.DictMethodsgroup intest/binding/conformance.h. It runs on every binding, in all four modes, narrow and wide. Its rows areshadowed_method,attr_filter,testsandunpack_keys, with expectations pasted fromconformance_expect.py --cppunder Python 3.12 and Jinja2 3.1.6.ExpressionTest.ReflectedStructFieldComesBeforeADictMethod: a reflected struct keeps its fields before dict methods.Validation
ctest6/6.ParityReflect/*plus*JsonConformance*withJINJA2CPP_PARITY_CONTEXT=reflect: 3115/3115.ctest6/6, reflect pass 3115/3115;ctest6/6; the cast across the.soworks;scripts/preflight.sh --perf: all PASS, including the instruction gate on the default data.bench/count.py --data reflect, head against master: worst case Render/for_filter_if +0.45%. Everything else is at or below +0.38%. Allocation counts are unchanged; bytes grow slightly (oneboolper adapter).dynamic_castgoes to an exported empty struct, the same pattern asdetail::OwnedAccessor. CI checks these platforms.Open
/mnt/project-files/release-2.0/0212-plan.md): shouldIJsonNodeget theNodeIdentity()virtual before this merges, so the marker never ships empty? This waits for Ruslan.template_module.cpp(CopyMap) instead of keeping the view. The verifier flagged it for a reviewer's look; the same size caps apply.Roles: architect (0212 plan), verifier, 1 round. Round 1 had two blocking findings, both fixed: the instruction cost of the cast and an include-cleaner hit. Red CI pushes: none yet. Codex: pending.
Generated by Claude Code