Skip to content

refactor(flow): move the replayer's qualification fault injection to a mixin, unchanged - #2456

Merged
abrichr merged 4 commits into
mainfrom
refactor/replayer-qualification-faults
Nov 21, 2026
Merged

abrichr merged 4 commits into
mainfrom
refactor/replayer-qualification-faults

Conversation

@abrichr

@abrichr abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member

Step E2 of the approved monorepo refactor plan (openadapt-internal#277, track E; DECOMPOSITION.md section 4.4, step 2). It moves code only. Stacked on E1 (#2455, approved): only the last commit is new.

The replayer's qualification fault injection moves unchanged into openadapt_flow/runtime/replay/qualification_faults.py as the QualificationFaultInjection mixin, and Replayer inherits from it. These are the 10 methods:

  • _qualification_fault_gate_for_kind
  • _qualification_fault_context
  • _require_current_fault_driver_binding
  • _validate_fault_mutation
  • _apply_screen_fault_mutation
  • _bind_surface_qualification_environment
  • _is_qualification_fault_step
  • _qualification_id_sha256
  • _observe_qualification_environment
  • _require_qualification_environment_current

How it was generated. I used scripts/extract_mixin.py, the tool from the October decomposition branch refactor/runtime-core (DECOMPOSITION.md section 4.1). For mypy only, a host class declares exactly the attributes and methods the moved code reads from self. At run time, the method resolution order is Replayer, then the mixin, then object. Methods are still looked up on the instance, so tests that call or replace private methods keep working.

Nothing removed.

  • replayer.py keeps every import it had. The three names only the moved code used (QualificationFaultContext, QualificationFaultKind, verify_fault_mutation_receipt) stay importable from it, marked noqa.
  • replayer.py goes from 19,654 to 19,325 lines, and its budget is lowered to match.

Checks I ran.

  • verify_moved_code.py against E1: 10 moved units, no edits, no patch to retarget. The only class header that changed is Replayer(QualificationFaultInjection).
  • Strict mypy passes on replayer.py and runtime/replay/.
  • test_import_surface.py (all 278 Replayer methods), test_import_layers.py, test_fresh_imports.py and the qualification-fault tests pass: 2,320 tests.
  • ruff is clean, and so is the release-consistency check.

Collisions. No open PR edits these methods. The replayer.py hunks that open PRs touch are in _settle_pipelined_readback (#2412), _act_without_dialog (#2363, #2368) and _approval_form_state (#2291).

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: ee97913

Unique work versus #2455 (0d3e558cc): the ten qualification-fault-injection methods move from Replayer into runtime/replay/qualification_faults.py as QualificationFaultInjection, and Replayer inherits from that mixin.

I compared those ten methods to the pre-move replayer.py; their ASTs are identical, and none of them remains defined on Replayer itself. At run time the mixin’s base is object; _QualificationFaultInjectionHost is only a TYPE_CHECKING stub, so it does not change method resolution. Lookups still go through the instance (Replayer, then the mixin), so tests that call or replace these private methods on a Replayer keep working. replayer.py keeps the imports only the moved code used (QualificationFaultContext, QualificationFaultKind, verify_fault_mutation_receipt). The replayer.py line budget is lowered (19654 → 19325), not raised. I do not see a behavior change.

No merge from me.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: 4ff6846

Re-review at the current head (moved since ee97913d, prior APPROVE 7062524700). The unique change is a merge of updated E1 (a9cf62542): the generality baseline entry moves with the already-relocated MockMed comment, count still 1.

The ten mixin methods and Replayer(QualificationFaultInjection) are unchanged from the head I approved. I do not see a behavior change.

No merge from me.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 4ff6846

@abrichr
abrichr merged commit 2a371d3 into main Nov 21, 2026
61 of 62 checks passed
@abrichr
abrichr deleted the refactor/replayer-qualification-faults branch November 21, 2026 13:39
yunusarda-sudo pushed a commit to yunusarda-sudo/OpenAdapt that referenced this pull request Nov 22, 2026
….1.4

Keep OpenAdaptAI#2375's amendment of the OpenAdaptAI#2341 note and this branch's notes side by
side, note the Flow merges since (OpenAdaptAI#2383, OpenAdaptAI#2439, OpenAdaptAI#2451, OpenAdaptAI#2454-OpenAdaptAI#2456, OpenAdaptAI#2459),
and relock packages/flow on openadapt-privacy 1.1.4 (was 1.0.0).
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