Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

test: capture capped recheck propagation panic - #4180

Closed
teerthsharma wants to merge 1 commit into
pyrefly-org:mainfrom
teerthsharma:codex/deep-chain-panic-reproducer
Closed

teerthsharma wants to merge 1 commit into
pyrefly-org:mainfrom
teerthsharma:codex/deep-chain-panic-reproducer

Conversation

@teerthsharma

Copy link
Copy Markdown

Summary

  • let the incremental test harness configure an explicit in-memory module set
  • generate a finite chain of 208 two-module SCCs inside one Rust test
  • record the current Transaction has uncommitted changes failure with #[should_panic]

Why

An export change can consume the 100-epoch incremental budget, produce another export change during forced invalidation, and then reach commit with that change still pending. The generated graph exercises the real incremental transaction path without external fixtures or dependencies.

This is deliberately a synthetic defense-in-depth reproducer and contains no scheduler fix. The assertions after the failing call describe the behavior a separate fix should restore.

Verification

  • without #[should_panic], the focused test fails at commit with Transaction has uncommitted changes
  • cargo test -p pyrefly --lib test_deep_scc_chain_stabilizes_after_epoch_cap
  • cargo test -p pyrefly --lib test::incremental (75 passed)
  • python3 test.py --no-test --no-tensor-shapes --no-conformance --no-jsonschema

Refs #4171

A finite chain of cyclic module pairs can consume the incremental epoch budget and reach commit with recorded export changes still pending.

Keep the current failure as an expected-panic regression so a separate scheduler fix can remove the annotation and verify propagation reaches the final importer.
@meta-codesync

meta-codesync Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@kinto0 has imported this pull request. If you are a Meta employee, you can view this in D112566493.

@kinto0

kinto0 commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

thank you very much! it's taken me a sec to understand this. I've graphed the example out below:
image

  1. The recheck propagates the change one layer per epoch: epoch 2 updates a_0, epoch 3 updates a_1, …
  2. After 100 epochs (MAX_EPOCHS), propagation has only crawled to ~a_98— nowhere nearmainata_207. The chain is longer than the budget.
  3. The scheduler gives up its normal loop and runs a fallback (invalidate everything downstream, do one final pass).
  4. That fallback pass is a single epoch, so it only advances one more edge — it does not finish propagating. It leaves pending changes recorded.
  5. The recheck then tries to commit, which asserts "no pending changes." There are pending changes → panic ("Transaction has uncommitted changes").

this trigger was from the chain > 100 (though there could likely be other triggers) and the bug exists in the fallback (it breaks the invariant)

@stroxler stroxler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@meta-codesync

meta-codesync Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

@kinto0 merged this pull request in 3e90baa.

@meta-codesync meta-codesync Bot added the Merged label Jul 18, 2026
avokin2 pushed a commit to avokin2/pyrefly that referenced this pull request Aug 12, 2026
Summary:
- let the incremental test harness configure an explicit in-memory module set
- generate a finite chain of 208 two-module SCCs inside one Rust test
- record the current `Transaction has uncommitted changes` failure with `#[should_panic]`

## Why

An export change can consume the 100-epoch incremental budget, produce another export change during forced invalidation, and then reach commit with that change still pending. The generated graph exercises the real incremental transaction path without external fixtures or dependencies.

This is deliberately a synthetic defense-in-depth reproducer and contains no scheduler fix. The assertions after the failing call describe the behavior a separate fix should restore.

## Verification

- without `#[should_panic]`, the focused test fails at commit with `Transaction has uncommitted changes`
- `cargo test -p pyrefly --lib test_deep_scc_chain_stabilizes_after_epoch_cap`
- `cargo test -p pyrefly --lib test::incremental` (75 passed)
- `python3 test.py --no-test --no-tensor-shapes --no-conformance --no-jsonschema`

Refs pyrefly-org#4171

Pull Request resolved: pyrefly-org#4180

Reviewed By: stroxler

Differential Revision: D112566493

Pulled By: kinto0

fbshipit-source-id: cb8e015c4c31c4d39ee20a356d21d717406c9dc4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants