Skip to content

majit: stabilize and trace prepass determinism - #1161

Merged
youknowone merged 3 commits into
mainfrom
residual
Aug 12, 2026
Merged

majit: stabilize and trace prepass determinism#1161
youknowone merged 3 commits into
mainfrom
residual

Conversation

@youknowone

@youknowone youknowone commented Aug 11, 2026

Copy link
Copy Markdown
Owner

What changed

  • preserve deterministic work ordering for pointer-keyed annotator reflow sets and serialized descriptor keys
  • retain graph/link/block owners where identity keys must not outlive their referents
  • preserve source class/instance dictionary insertion order through the flowspace and rtyper pipeline
  • add opt-in prepass determinism tracing and counters for reflow, allocation, cutoff, and address-reuse diagnostics

Why

The two-phase annotator/rtyper prepass could vary across processes when pointer-derived keys flowed through unordered containers or when identity-keyed entries outlived their owners. This made gh#1139 difficult to localize and could perturb prepass work order.

Impact

Default behavior gains stable ordering in the affected paths. The new diagnostics remain disabled unless the PYRE_DETERMINISM_TRACE / PYRE_DTRACE_CONST_* environment variables are set.

Verification

  • cargo check --features dynasm — passed before the final rebase
  • cargo check -p majit-translate — passed after rebasing onto origin/main
  • dynasm benchmark and regression suite — 17/17 passed
  • cargo test --features dynasm — one policy test fails because the four new diagnostic environment variables do not yet have entries in pyre/gate-triage.md

Summary by CodeRabbit

  • Improvements

    • Preserved stable ordering for descriptor members, class dictionaries, trait members, generators, and translated output.
    • Improved consistency when selecting cached graphs, methods, and registry entries.
    • Added more reliable graph and block handling during translation.
  • Diagnostics

    • Added optional determinism tracing through PYRE_DETERMINISM_TRACE=1.
    • Expanded diagnostics for reflows, graph processing, block reuse, identity allocation, and cutoff events.
  • Documentation

    • Clarified Python 3.14 compatibility and parity-test coverage.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6b8160b9-aea8-4236-8e64-d3e8014302f5

📥 Commits

Reviewing files that changed from the base of the PR and between 95acc0f and 38a53b3.

📒 Files selected for processing (28)
  • pyre/extra_tests/parity_tests/bool_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/builtin_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/bytearray_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/bytes_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/complex_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py
  • pyre/extra_tests/parity_tests/dict_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/float_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/functional_iterator_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/int_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/jit_itemgetter_branch_comprehension.py
  • pyre/extra_tests/parity_tests/jit_recursive_closure_live_set.py
  • pyre/extra_tests/parity_tests/list_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/memoryview_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/memoryview_tobytes_order_python314.py
  • pyre/extra_tests/parity_tests/method_wrapper_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/ordered_dict_python314.py
  • pyre/extra_tests/parity_tests/property_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/range_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/script_source_encoding_startup.py
  • pyre/extra_tests/parity_tests/set_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/slice_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/str_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/super_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/syntax_error_python314_offsets.py
  • pyre/extra_tests/parity_tests/tuple_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/type_text_signatures_python314.py
  • pyre/gate-triage.md

Walkthrough

The translator now preserves deterministic iteration order, centralizes shared graph-reference creation, and records optional allocation, reflow, notification, and cutover diagnostics. Descriptor members also support ordering.

Changes

Deterministic translation and diagnostics

Layer / File(s) Summary
Ordered data and canonicalization
majit/majit-ir/src/effectinfo.rs, majit/majit-translate/src/flowspace/*, majit/majit-translate/src/annotator/*, majit/majit-translate/src/translator/rtyper/pyre_call_registry.rs, majit/majit-translate/src/codewriter/call.rs
Ordered maps and sets preserve traversal and member insertion order. Descriptor-set keys and registry candidates use stable ordering.
Shared graph references and allocation tracking
majit/majit-translate/src/flowspace/model.rs, majit/majit-translate/src/flowspace/pygraph.rs, majit/majit-translate/src/annotator/specialize.rs, majit/majit-translate/src/translator/rtyper/*, majit/majit-translate/src/translator/translator.rs
FunctionGraph::into_ref() replaces repeated manual wrapping. Block, graph, variable, and constant allocation diagnostics record identities and reuse.
Annotator reflow and notification diagnostics
majit/majit-translate/src/annotator/annrpython.rs, majit/majit-translate/src/annotator/bookkeeper.rs, majit/majit-translate/src/annotator/classdesc.rs, majit/majit-translate/src/annotator/listdef.rs, majit/majit-translate/src/translator/transform.rs
Link and notification entries retain references and ordered positions. Counters and optional traces cover reflows, notifications, attribute updates, subclass changes, list widening, and cutoff handling.
Cutover tracing
majit/majit-translate/src/lib.rs, majit/majit-translate/src/translator/rtyper/cutover.rs
PYRE_DETERMINISM_TRACE=1 enables cached trace configuration, stable prepass metadata, graph mapping, cutset hashes, and dead-code cutoff diagnostics.
Parity test and gate documentation
pyre/extra_tests/parity_tests/*, pyre/gate-triage.md
Comments document CPython 3.14 parity coverage. Gate triage lists the new diagnostic and value-knob settings.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Poem

A rabbit checks each ordered key,
And keeps each graph in its proper place.
Counters mark the reflow path,
Stable traces map the race.
“Hop by hop, the order stays—”
Says the bunny through the maze.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main changes: deterministic prepass stabilization and diagnostic tracing.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch residual

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@youknowone
youknowone marked this pull request as ready for review August 11, 2026 15:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95acc0fecd

ℹ️ 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".

pub(crate) fn determinism_trace_enabled() -> bool {
static ENABLED: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
*ENABLED.get_or_init(|| {
std::env::var_os("PYRE_DETERMINISM_TRACE").is_some_and(|value| value == "1")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Document the new diagnostic environment gates

Any workspace test run that includes pyrex now fails every_live_pyre_gate_has_a_gate_triage_entry: this reader and the three new PYRE_DTRACE_CONST_* readers in flowspace/model.rs have no entries in pyre/gate-triage.md. I verified the test reports all four missing names, so add the required triage rows before landing to restore the mandated cargo test --features dynasm run.

AGENTS.md reference: AGENTS.md:L236-L237

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

🤖 Codex parity review

Static analysis of this diff vs the local RPython/PyPy sources (commit 5fa150d).
Updated: 2026-08-11T23:00:54.542Z

Files in the reviewed diff
majit/majit-ir/src/effectinfo.rs
majit/majit-translate/src/annotator/annrpython.rs
majit/majit-translate/src/annotator/bookkeeper.rs
majit/majit-translate/src/annotator/classdesc.rs
majit/majit-translate/src/annotator/listdef.rs
majit/majit-translate/src/annotator/specialize.rs
majit/majit-translate/src/codewriter/call.rs
majit/majit-translate/src/flowspace/generator.rs
majit/majit-translate/src/flowspace/model.rs
majit/majit-translate/src/flowspace/pygraph.rs
majit/majit-translate/src/lib.rs
majit/majit-translate/src/translator/rtyper/cutover.rs
majit/majit-translate/src/translator/rtyper/flowspace_adapter.rs
majit/majit-translate/src/translator/rtyper/normalizecalls.rs
majit/majit-translate/src/translator/rtyper/pyre_call_registry.rs
majit/majit-translate/src/translator/rtyper/rpbc.rs
majit/majit-translate/src/translator/rtyper/rtyper.rs
majit/majit-translate/src/translator/transform.rs
majit/majit-translate/src/translator/translator.rs

1. Regressions to PyPy parity introduced by this patch

None.

2. Other mismatches introduced by this patch

None.

3. Pre-existing mismatches (already present before this patch)

  • majit/majit-translate/src/annotator/annrpython.rs:126 ↔ rpython/annotator/annrpython.py:397: Pyre’s pre-existing per-subject transaction/rollback model continues after annotation failures; upstream propagates non-BlockedInference exceptions immediately from processblock.

  • majit/majit-translate/src/translator/rtyper/cutover.rs:3416 ↔ rpython/rtyper/rtyper.py:177: Pyre’s existing Phase-B rtyper isolates per-graph failures and records skips; upstream RPythonTyper.specialize() is a single fatal whole-program pass.

4. Structural adaptations

  • majit/majit-translate/src/annotator/annrpython.rs:133 ↔ rpython/annotator/annrpython.py:39: links_followed now retains LinkRefs alongside pointer identity keys. This is the required Rust ownership adaptation: upstream’s dictionary keys strongly retain the Python Link objects, whereas a bare LinkKey cannot.

  • majit/majit-translate/src/annotator/annrpython.rs:138 ↔ rpython/annotator/annrpython.py:40: notify retains each BlockRef and uses IndexSet for positions. The retained block restores upstream dictionary-key lifetime semantics; ordered iteration is a deliberate deterministic scheduling adaptation for Rust pointer-keyed state.

  • majit/majit-translate/src/flowspace/model.rs:180 ↔ rpython/annotator/classdesc.py:665: host class and instance dictionaries changed from HashMap to IndexMap, preserving CPython/PyPy dictionary insertion order when class attributes become annotation work items.

  • majit/majit-translate/src/codewriter/call.rs:6141 ↔ rpython/jit/codewriter/effectinfo.py:339: descriptor members are content-sorted for artifact serialization. Upstream keeps live descriptor objects in-process; Pyre must serialize and later resolve them, so this deterministic ordering has no direct upstream representation.

  • majit/majit-translate/src/flowspace/model.rs:37 ↔ rpython/flowspace/model.py:176: address-reuse counters and PYRE_DETERMINISM_TRACE diagnostics are Rust-only instrumentation around Rc<RefCell<_>> allocation; they do not alter the translated graph semantics.

  • majit/majit-translate/src/translator/rtyper/pyre_call_registry.rs:420 ↔ rpython/annotator/bookkeeper.py:353: sorting Pyre registry keys before first-writer-wins selection is a Pyre-specific deterministic bridge for Rust path registries; upstream resolves identity-bearing Python objects directly and has no equivalent registry.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@majit/majit-translate/src/codewriter/call.rs`:
- Around line 6149-6151: Update the canonicalization logic around DescrSetKeys
so each DescrRef remains paired with its corresponding DescrSetMember while
ordering is normalized. Sort the descriptor/member pairs together, or defer
splitting them until after sorting, and ensure the resulting keys retain the raw
descriptor vectors’ canonical order.

In `@majit/majit-translate/src/lib.rs`:
- Around line 68-75: Update the policy documentation in pyre/gate-triage.md to
register PYRE_DETERMINISM_TRACE and the related constant-trace environment
variables. Ensure all diagnostic variables introduced by the determinism and
constant-trace functionality are listed before release so the policy test
passes.

In `@majit/majit-translate/src/translator/rtyper/cutover.rs`:
- Around line 3258-3285: Add the four determinism-trace environment
variables—PYRE_DETERMINISM_TRACE, PYRE_DTRACE_CONST_BT, PYRE_DTRACE_CONST_FROM,
and PYRE_DTRACE_CONST_TO—to pyre/gate-triage.md, each with a concise description
of its purpose. Keep the documentation scoped to the tracing controls used by
emit_determinism_trace and run_two_phase_prepass_inner.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a1e65e4f-7970-491a-a255-4a5cd11ddda9

📥 Commits

Reviewing files that changed from the base of the PR and between 134810d and 95acc0f.

📒 Files selected for processing (19)
  • majit/majit-ir/src/effectinfo.rs
  • majit/majit-translate/src/annotator/annrpython.rs
  • majit/majit-translate/src/annotator/bookkeeper.rs
  • majit/majit-translate/src/annotator/classdesc.rs
  • majit/majit-translate/src/annotator/listdef.rs
  • majit/majit-translate/src/annotator/specialize.rs
  • majit/majit-translate/src/codewriter/call.rs
  • majit/majit-translate/src/flowspace/generator.rs
  • majit/majit-translate/src/flowspace/model.rs
  • majit/majit-translate/src/flowspace/pygraph.rs
  • majit/majit-translate/src/lib.rs
  • majit/majit-translate/src/translator/rtyper/cutover.rs
  • majit/majit-translate/src/translator/rtyper/flowspace_adapter.rs
  • majit/majit-translate/src/translator/rtyper/normalizecalls.rs
  • majit/majit-translate/src/translator/rtyper/pyre_call_registry.rs
  • majit/majit-translate/src/translator/rtyper/rpbc.rs
  • majit/majit-translate/src/translator/rtyper/rtyper.rs
  • majit/majit-translate/src/translator/transform.rs
  • majit/majit-translate/src/translator/translator.rs

Comment on lines +6149 to +6151
// The raw set stays in pointer order for identity dedup and lookup, while
// the member order crossing into the artifact is determined by content.
keys.sort();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 8 --type rust '\bcanonicalize_keyed_descrs\s*\(' majit

Repository: youknowone/pyre

Length of output: 4626


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '6128,6185p' majit/majit-translate/src/codewriter/call.rs
sed -n '6338,6405p' majit/majit-translate/src/codewriter/call.rs
rg -n -C 6 --type rust 'read_descrs_fields_arcs|readonly_fields|write_descrs_fields_arcs|write_fields|read_descrs_arrays_arcs|readonly_arrays|write_descrs_arrays_arcs|readonly_interiorfields' majit/majit-translate/src

Repository: youknowone/pyre

Length of output: 23670


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 10 --type rust 'struct DescrSetKeys|DescrSetKeys|descr_set_keys|_readonly_descrs_fields|_write_descrs_fields' majit

Repository: youknowone/pyre

Length of output: 50372


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 12 --type rust 'descr_set_keys\.(readonly_fields|write_fields|readonly_arrays|write_arrays|readonly_interiorfields|write_interiorfields)|keys\.(readonly_fields|write_fields|readonly_arrays|write_arrays|readonly_interiorfields|write_interiorfields)' majit
rg -n -C 12 --type rust 'DescrMintEntry|DescrMintSpec|descr_set_keys|mint.*descr|deserialize.*descr|rebuild.*descr' majit/majit-ir majit/majit-translate majit/majit-metainterp
sed -n '110,175p' majit/majit-ir/src/effectinfo.rs

Repository: youknowone/pyre

Length of output: 153


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 8 --type rust 'readonly_fields|write_fields|DescrMintEntry|DescrMintSpec|descr_set_keys' majit/majit-ir/src/effectinfo.rs majit/majit-ir/src/descr.rs majit/majit-translate/src
sed -n '110,175p' majit/majit-ir/src/effectinfo.rs

Repository: youknowone/pyre

Length of output: 50371


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 15 --type rust 'ei_descr_mints|DescrSetKeys \{|descr_set_keys\.as_ref|descr_set_keys\.as_mut|_readonly_descrs_fields\s*=' majit
rg -n -C 12 --type rust 'serde.*EffectInfo|EffectInfo.*Deserialize|from_effect_info|set_effect|register_keyed|ei_descr_mint' majit/majit-ir/src majit/majit-translate/src majit/majit-metainterp/src

Repository: youknowone/pyre

Length of output: 50372


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -l --type rust 'ei_descr_mints|DescrSetKeys|descr_set_keys' majit | sort
rg -n -C 10 --type rust 'ei_descr_mints' majit/majit-runtime majit/majit-metainterp majit/majit-translate 2>/dev/null || true

python3 - <<'PY'
pairs = [
    ("descr_b", "member_z"),
    ("descr_a", "member_a"),
]
raw_order = sorted(pairs, key=lambda pair: pair[0])
descrs = [descr for descr, _ in raw_order]
keys = sorted(member for _, member in raw_order)
print("raw paired order:", raw_order)
print("returned vectors:", list(zip(descrs, keys)))
print("association preserved:", raw_order == list(zip(descrs, keys)))
PY

Repository: youknowone/pyre

Length of output: 10036


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
pairs = [
    ("descr_b", "member_a"),
    ("descr_a", "member_z"),
]
raw_order = sorted(pairs, key=lambda pair: pair[0])
descrs = [descr for descr, _ in raw_order]
keys = sorted(member for _, member in raw_order)
returned = list(zip(descrs, keys))
print("raw paired order:", raw_order)
print("returned vectors:", returned)
print("association preserved:", raw_order == returned)
PY

Repository: youknowone/pyre

Length of output: 320


Keep DescrRef and DescrSetMember paired during canonicalization

DescrSetKeys must keep the same canonical order as the raw descriptor vectors. Sorting keys after splitting the pairs breaks the association when pointer order differs from member order. Sort the pairs instead, or preserve pairing until the consumer separates the vectors.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@majit/majit-translate/src/codewriter/call.rs` around lines 6149 - 6151,
Update the canonicalization logic around DescrSetKeys so each DescrRef remains
paired with its corresponding DescrSetMember while ordering is normalized. Sort
the descriptor/member pairs together, or defer splitting them until after
sorting, and ensure the resulting keys retain the raw descriptor vectors’
canonical order.

Comment thread majit/majit-translate/src/lib.rs
Comment on lines +3258 to +3285
// Exists to localise prepass nondeterminism (gh#1139).
fn emit_determinism_trace(phase: &str, index: usize, canonical_key: &str) {
eprintln!(
"[DTRACE] {phase} {index} {canonical_key} var={} const={} reflow={} block={} rf_list={} rf_sub={} rf_attr={} rf_pbc={} rf_notify={} widen={} nupd={} breuse={} greuse={} nhitreused={}",
crate::flowspace::model::next_var_id(),
crate::flowspace::model::next_constant_id(),
crate::annotator::annrpython::reflow_count(),
crate::annotator::annrpython::processblock_count(),
crate::annotator::listdef::reflow_from_listitem_count(),
crate::annotator::classdesc::reflow_from_subclass_count(),
crate::annotator::bookkeeper::reflow_from_attr_count(),
crate::annotator::bookkeeper::reflow_from_pbc_count(),
crate::annotator::annrpython::reflow_from_notify_count(),
crate::annotator::listdef::listitem_widen_count(),
crate::annotator::listdef::listitem_notify_update_count(),
crate::flowspace::model::block_addr_reuse_count(),
crate::flowspace::model::graph_addr_reuse_count(),
crate::annotator::annrpython::notify_hit_on_reused_count(),
);
}

fn run_two_phase_prepass_inner(
call_registry: &PyreCallRegistry,
candidate_graphs: &HashSet<crate::parse::CallPath>,
function_graphs: &crate::codewriter::call::GraphStore,
) {
// Exists to localise prepass nondeterminism (gh#1139).
let determinism_trace = crate::determinism_trace_enabled();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the environment-variable definitions and the policy registry.
rg -n -C 3 'determinism_trace_enabled|std::env::var|std::env::var_os|env::var|env::var_os' \
  majit/majit-translate/src

rg -n -C 3 'DTRACE|TRACE|DETERMIN|MAJIT_' pyre/gate-triage.md

Repository: youknowone/pyre

Length of output: 39989


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- tracing readers ---'
rg -n -C 5 'PYRE_DETERMINISM_TRACE|PYRE_DTRACE_CONST_(BT|FROM|TO)|DTRACE[-_]' \
  majit/majit-translate/src

printf '%s\n' '--- policy registry context ---'
sed -n '780,860p' pyre/gate-triage.md
sed -n '940,1010p' pyre/gate-triage.md

printf '%s\n' '--- repository-wide references ---'
rg -n 'PYRE_DETERMINISM_TRACE|PYRE_DTRACE_CONST_(BT|FROM|TO)' .

Repository: youknowone/pyre

Length of output: 27474


Register the determinism-trace environment variables in pyre/gate-triage.md.

Add PYRE_DETERMINISM_TRACE, PYRE_DTRACE_CONST_BT, PYRE_DTRACE_CONST_FROM, and PYRE_DTRACE_CONST_TO, with a short purpose for each.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@majit/majit-translate/src/translator/rtyper/cutover.rs` around lines 3258 -
3285, Add the four determinism-trace environment
variables—PYRE_DETERMINISM_TRACE, PYRE_DTRACE_CONST_BT, PYRE_DTRACE_CONST_FROM,
and PYRE_DTRACE_CONST_TO—to pyre/gate-triage.md, each with a concise description
of its purpose. Keep the documentation scoped to the tracing controls used by
emit_determinism_trace and run_two_phase_prepass_inner.

…ify's block

`RPythonAnnotator::notify`'s position set, the graph maps built in `complete`
and `seed_all_annotated_return_vars`, and `ListItem::read_locations` were
`HashSet`/`HashMap` keyed on values derived from `Rc::as_ptr`. Each of those
loops issues `reflowfromposition` calls, so their iteration order is a work
order, and hashing an address makes that order differ between processes. They
now use `IndexSet`/`IndexMap`, the containers `annotated`, `added_blocks`,
`blocked_blocks` and `genpendingblocks` already use in the same file.

`notify` additionally stored only the block's address and never a reference to
it, and it is the only `BlockKey`-keyed map that is never pruned — its siblings
are all `shift_remove`d when a block leaves the annotator's view. Entries now
carry the `BlockRef` they are keyed on, so the address behind a live key cannot
be handed to a later block.

The prepass census flip reported in gh#1139 still occurs with these changes
applied.

Assisted-by: Claude
…et keys

`RPythonAnnotator::links_followed` keyed links by `Rc::as_ptr` while holding
no reference to them. `transform_dead_code` drops a link's last `Rc` in the
same loop in which `cutoff_alwaysraising_block` allocates a fresh one, so a
new link can land on a freed but still-recorded address and read back as
already followed; the dead arm then survives and the block's cutoff never
runs. Hold the `LinkRef` in the map, as `all_blocks` and `notify` do.

The `seen` map that `annotate`'s block-subset path builds is also keyed on a
pointer and iterated to produce a work order; make it ordered.

`canonicalize_keyed_descrs` returned `descr_set_keys` in `Arc` address order,
so the serialized effect info carried a different member order per process.
Sort the keys by content, which `DescrSetMember` now derives `Ord` for. The
raw `_*_descrs_*` sets keep pointer order, which the `descr_ptr_id`
binary_search in `compute_bitstrings` requires; the reader rebuilds those
sets from the keys and re-canonicalises, so the two orders are independent.

Assisted-by: Claude

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py`:
- Around line 1-3: Update the leading parity-gap comment in
dict_set_sizeof_python314.py to state that exact __sizeof__ values for dict,
set, and frozenset are asserted by the tests below, while retaining the existing
purpose of guarding Pyre’s CPython 3.14 container-size behavior.

In `@pyre/gate-triage.md`:
- Line 974: Update the entry count in the “Default-OFF diagnostics, censuses and
probes” heading from 54 to 55, leaving the listed diagnostic names unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6b8160b9-aea8-4236-8e64-d3e8014302f5

📥 Commits

Reviewing files that changed from the base of the PR and between 95acc0f and 38a53b3.

📒 Files selected for processing (28)
  • pyre/extra_tests/parity_tests/bool_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/builtin_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/bytearray_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/bytes_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/complex_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py
  • pyre/extra_tests/parity_tests/dict_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/float_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/functional_iterator_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/int_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/jit_itemgetter_branch_comprehension.py
  • pyre/extra_tests/parity_tests/jit_recursive_closure_live_set.py
  • pyre/extra_tests/parity_tests/list_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/memoryview_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/memoryview_tobytes_order_python314.py
  • pyre/extra_tests/parity_tests/method_wrapper_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/ordered_dict_python314.py
  • pyre/extra_tests/parity_tests/property_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/range_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/script_source_encoding_startup.py
  • pyre/extra_tests/parity_tests/set_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/slice_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/str_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/super_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/syntax_error_python314_offsets.py
  • pyre/extra_tests/parity_tests/tuple_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/type_text_signatures_python314.py
  • pyre/gate-triage.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py`:
- Around line 1-3: Update the leading parity-gap comment in
dict_set_sizeof_python314.py to state that exact __sizeof__ values for dict,
set, and frozenset are asserted by the tests below, while retaining the existing
purpose of guarding Pyre’s CPython 3.14 container-size behavior.

In `@pyre/gate-triage.md`:
- Line 974: Update the entry count in the “Default-OFF diagnostics, censuses and
probes” heading from 54 to 55, leaving the listed diagnostic names unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6b8160b9-aea8-4236-8e64-d3e8014302f5

📥 Commits

Reviewing files that changed from the base of the PR and between 95acc0f and 38a53b3.

📒 Files selected for processing (28)
  • pyre/extra_tests/parity_tests/bool_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/builtin_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/bytearray_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/bytes_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/complex_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py
  • pyre/extra_tests/parity_tests/dict_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/float_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/functional_iterator_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/int_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/jit_itemgetter_branch_comprehension.py
  • pyre/extra_tests/parity_tests/jit_recursive_closure_live_set.py
  • pyre/extra_tests/parity_tests/list_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/memoryview_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/memoryview_tobytes_order_python314.py
  • pyre/extra_tests/parity_tests/method_wrapper_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/ordered_dict_python314.py
  • pyre/extra_tests/parity_tests/property_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/range_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/script_source_encoding_startup.py
  • pyre/extra_tests/parity_tests/set_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/slice_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/str_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/super_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/syntax_error_python314_offsets.py
  • pyre/extra_tests/parity_tests/tuple_text_signatures_python314.py
  • pyre/extra_tests/parity_tests/type_text_signatures_python314.py
  • pyre/gate-triage.md
🛑 Comments failed to post (2)
pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py (1)

1-3: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Correct the parity-gap comment.

Line 1 says that exact dict and set __sizeof__ values are not asserted. Lines 7-19 assert exact values for dict, set, and frozenset. Update the comment to describe the existing coverage.

Proposed fix
-# CPython-suite gap: exact dict and set __sizeof__ values are not asserted.
+# CPython-suite coverage: exact dict and set __sizeof__ values are asserted.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

# CPython-suite coverage: exact dict and set __sizeof__ values are asserted.
# parity-tests reason: guard pyre's CPython 3.14 container size surface.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py` around lines 1 -
3, Update the leading parity-gap comment in dict_set_sizeof_python314.py to
state that exact __sizeof__ values for dict, set, and frozenset are asserted by
the tests below, while retaining the existing purpose of guarding Pyre’s CPython
3.14 container-size behavior.
pyre/gate-triage.md (1)

974-974: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix the default-OFF inventory count.

The heading states 54 entries, but the inventory contains 55 distinct names through Line 1000. Update the count so the documentation matches the listed diagnostics.

Proposed fix
-### §6c — Default-OFF diagnostics, censuses and probes (54): keep, cost nothing
+### §6c — Default-OFF diagnostics, censuses and probes (55): keep, cost nothing
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

### §6c — Default-OFF diagnostics, censuses and probes (55): keep, cost nothing
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyre/gate-triage.md` at line 974, Update the entry count in the “Default-OFF
diagnostics, censuses and probes” heading from 54 to 55, leaving the listed
diagnostic names unchanged.

@youknowone
youknowone merged commit 2f7f0e4 into main Aug 12, 2026
15 of 17 checks passed
@youknowone
youknowone deleted the residual branch August 12, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant