Repository navigation
feat(wrap): add layout-independent CheckpointSpec and cross-tab EntityLedger - #2606
Conversation
Independent adversarial review: REQUEST CHANGESFrom: Grok The code is generic and well-formatted, and the 7 tests pass. But the enforcer lets a wrong-entity or unexpected commit through in at least eight cases that I reproduced at this head. That is the failure this module exists to stop. Most of them match the shapes listed in Blocking findings (each one reproduced: the outcome is
|
Independent review: APPROVE
Findings
Squash-merging head-pinned now. |
Summary
Adds a generic, UI-layout-independent
CheckpointSpeccompiler and cross-tabEntityLedger+CheckpointEnforcerunderopenadapt_flow.wrap(building on #2407).What changed
packages/flow/openadapt_flow/wrap/checkpoint_spec.py: Compiles a multi-surface demonstration trace into anopenadapt.checkpoint-spec/v1specification with zero pixel coordinates, viewports, DOM selectors, or record literals (assert_layout_independent). Extracts four semantic checkpoint classes:required_source_reads: source sections and fields that must be read before a downstream commit.cross_tab_invariants: entity bindings inferred across surfaces (supporting exact case-insensitive, ISO/US date normalization, token-set, and substring matching).approval_rules: operator policy thresholds (lte,gte,in) with stop-on-uncertainty when required fields are missing.confirmation_checks: expected HTTP confirmation status/fields and optional cross-surface writeback checks before subsequent commits.packages/flow/openadapt_flow/wrap/entity_ledger.py: AddsEntityLedger(tracks observed reads, staged writes, and post-commit confirmations across surfaces) andCheckpointEnforcer(livecheck_before_commit/check_after_commithooks,enforce_trajectory, andevaluate_suite).packages/flow/openadapt_flow/wrap/__init__.py: Re-exportsCheckpointSpec,compile_checkpoint_spec,EntityLedger, andCheckpointEnforcer.packages/flow/tests/test_wrap_checkpoint_ledger.py: Unit tests covering layout-independence, shifted UI layouts, cross-record generalization, cross-tab mismatch blocking, skipped source reads, policy caps + human override, confirmation read-back/writeback, and stopping on uncertainty.Verification
PYTHONPATH=packages/flow pytest -v packages/flow/tests/test_wrap_checkpoint_ledger.py: 7 passed in 0.42sruff check&ruff format --check: passedpackages/flow/scripts/check_verdict_folds.py: 0 folds incheckpoint_spec.pyandentity_ledger.py(0 new folds added)scripts/check_file_size_ratchet.py --base origin/main: passedpackages/flow/scripts/check_engine_generality.py: passed (0 new hits)gitleaks detect --no-git: no leaks found