Skip to content

Fix/rebase gate repair main#242

Closed
leynos wants to merge 3 commits intopydantic:mainfrom
leynos:fix/rebase-gate-repair-main
Closed

Fix/rebase gate repair main#242
leynos wants to merge 3 commits intopydantic:mainfrom
leynos:fix/rebase-gate-repair-main

Conversation

@leynos
Copy link

@leynos leynos commented Mar 5, 2026

No description provided.

leynos and others added 3 commits March 5, 2026 00:20
* Add stable runtime IDs for suspendable calls

Expose an additive host-facing runtime ID substrate for
RunProgress and ReplProgress function and OS call payloads.

Plumb runtime IDs through argument conversion so positional and
keyword payload identity remains observable across suspend/resume
and run-progress dump/load boundaries.

Add unit and rstest-bdd behavioural tests for uniqueness,
continuity, and corrupted payload failure paths.

* Refactor runtime ID plumbing and test coverage

Replace tuple-based host call conversion with a named HostCallArgs\nstructure and shared helper functions in args conversion.\n\nAlign keyword key runtime-ID derivation across Inline and Dict kwargs\nby always deriving IDs from Value::id().\n\nAdd and expand runtime-ID tests for:\n- kwargs pairing/order and dump-load stability\n- reused-vs-distinct identity semantics\n- non-call runtime_ids() behavior\n- corruption baseline validation\n\nExtend BDD coverage with keyword-argument and OS-call runtime-ID\nscenarios, and centralize duplicated runtime_ids match logic via a\nshared helper macro used by both RunProgress and ReplProgress.

* Include runtime IDs in consumed function calls

Extend RunProgress::into_function_call and ReplProgress::into_function_call\nto return arg/kwarg runtime ID vectors alongside payload args/kwargs.\n\nThis removes the regression where consuming function-call extraction dropped\nruntime identity metadata, forcing hosts to avoid the primary helper API.\n\nUpdate all in-repo call sites and add a regression test that verifies\ninto_function_call exposes the same runtime IDs as runtime_ids() for the\nsame serialized progress payload.

* Preserve runtime IDs across call snapshots

Carry runtime IDs through run/repl/function-call/OS-call conversion\npaths and include them in Python snapshot payloads so hosts can\ntrack identity continuity across pause/resume and dump/load.\n\nRefactor argument/progress builders and runtime-id tests to reduce\nduplication while preserving existing behavioural assertions.

* Expect nested clippy diagnostics loops

Add tightly scoped  attributes\non the two diagnostic-annotation traversal loops in type checking.\n\nThis keeps the existing traversal structure while documenting why\nthe nesting is intentional and local to span-adjustment logic.

* Add safe nested-checkout lint path

Add a dedicated  target that forces a usable Python\ninterpreter and an isolated Clippy config directory when full-monty\nis checked out as a submodule.\n\nAdd a local  with default thresholds so parent-repo\nClippy settings do not leak into this workspace.\n\nFix branch-local lint fallout surfaced by the safer config:\n- remove stale unfulfilled  attributes\n- reduce a type-complexity signature via type aliases\n- update a  match to ignore new fields.

* Address PR lint-suppression comments

Resolve unresolved review feedback on run.rs by removing the bare
 suppressions flagged in PR #1.

- replace the  complex tuple signature with a type alias
- refactor function-call progress construction to take one input struct
- remove the feature-gated expect on  by eliminating the need
  for it in the current implementation

* Validate runtime ID payload cardinality

Reject malformed snapshot/progress payloads where runtime ID lists do\nnot align with args/kwargs cardinality.\n\n- add checked deserialization for RunProgress and ReplProgress\n- validate Python snapshot load/create paths for ID cardinality\n- document args module purpose with a module-level comment\n- update runtime ID tests to fully resume snapshots under\n  ref-count-panic so tests do not drop live heap graphs

* Return errors for missing VM snapshots

Make RunProgress builder paths panic-free by returning\n and propagating\nmissing-snapshot failures through .\n\nThis replaces  usage in function-call,\nOS-call, and ResolveFutures progress construction with explicit\nruntime errors.

* Share runtime-id validation and refactor tests

Extract shared runtime-ID cardinality and checked-payload helpers for run/repl deserialization paths, then reuse them in both modules to remove duplicate mapping logic.

Refactor runtime_ids tests to use rstest fixtures and parameterized cases for repeated runner setup while preserving identity and stability assertions.

* Refactor runtime-id cardinality parameters

Introduce RuntimeIdCardinality to group the related argument and\nruntime-id lengths passed to cardinality validation.\n\nUpdate shared validation and all run/repl call sites to construct and\npass this struct by reference, preserving behaviour and error text while\nreducing function argument count.

* Remove REPL snapshot panics and tuple payloads

Replace REPL vm_state expects with missing-snapshot error propagation\nvia new_repl_snapshot! and remove thin runtime-id validator wrappers\nin repl/run.\n\nRefactor RunProgress function-call extraction from an 8-tuple alias\nto a named FunctionCallPayload struct, and update affected tests to\nuse named fields for clarity and safety.

* Inline ArgValues host-call conversion logic

Remove per-variant into_hostcall_* helpers and inline the\nconstruction logic directly in ArgValues::into_py_objects_with_runtime_ids\nmatch arms to reduce indirection while preserving behaviour.

---------

Co-authored-by: Codex Agent <codex-agent@local>
* Add generic runtime observer events

Introduce a generic runtime observer substrate for Track A hooks.\n\nAdd canonical event emissions (ValueCreated, OpResult,\nExternalCallRequested, ExternalCallReturned, ControlCondition)\nacross VM/run/repl execution paths while preserving no-op observer\nbehavioural parity.\n\nAdd unit and rstest-bdd coverage for happy paths, unhappy paths,\nand no-op semantic equivalence.

* Default PYO3_PYTHON in test targets

Prefer the subrepo-local .venv interpreter for Rust test targets so\nCPython parity tests do not drift with host Python versions.\n\nUse a portable fallback to python3 on PATH when .venv is absent and\npreserve explicit overrides via PYO3_PYTHON.

* Refine runtime observer integration

Finalize generic runtime observer wiring across VM, run, and REPL\npaths, including snapshot observer persistence and reduced event\nconstruction overhead when observers are disabled.\n\nTighten VM value-creation semantics by separating stack push from\nvalue-creation emission, and update observer-focused unit/BDD tests\nfor return/error/future/method and REPL coverage.\n\nAlso harden Makefile interpreter selection for subrepo test parity\nwith a clear fail-fast path when python3 is unavailable.

* Refactor VM setup to use VMContext

Replace high-arity VM constructor/restore call signatures with a

VMContext parameter object and update run/repl call sites.

Re-export VMContext through bytecode and lib surfaces.

* Simplify observer VM restore and OS call progress

* Apply observer review follow-up fixes

* Fix observer review follow-ups

Apply the remaining verified review fixes for runtime observer wiring.

- Remove unusable VMContext re-export from crate public API

- Move RunError import to module scope in run.rs

- Extend function call payload assertions with call identity metadata

- Add HostArgs rustdoc for argument and runtime-id semantics

* Refine observer progress dispatch and docs

Address duplicated review concerns by documenting new helper entities and

decomposing VM result handling into branch-specific builders.

- Add rustdoc for observer test helper entities

- Document FunctionCallProgressInput and emit_external_call_returned

- Split run/repl FrameExit handling into focused builder helpers

* Extract generic REPL call-progress builder

Introduce ReplCallKind and a shared helper to build external, method, and OS call progress events in one place.

This removes duplicated host-argument conversion, observer emission, and snapshot wiring from three separate functions while preserving existing behavior.

* Refactor unary VM ops and BDD observer helpers

Extract unary opcode handlers into dedicated VM methods and route run-loop dispatch through try_catch_sync. Also deduplicate runtime-observer BDD steps with shared world/event and start-resume helpers while preserving assertions and behavior.

* Centralize external-call request emission

Move the REPL duplicate  helper into\n as a shared  helper with disabled-observer early\nreturn semantics.\n\nUpdate run/repl progress builders to use the shared helper, remove the\ndead observer clone assignment in , and add\nconcise Rustdoc for , , and\nall  progress helpers in .

* Add snapshot/docs refinements for run and repl

- Switch ExternalResult::Future stack pushes in run/repl snapshot resume
  paths to push_created so ValueCreated observer events are emitted.
- Add concise Rustdoc for the requested run/repl dispatch and snapshot
  helper items, including context structs and call-kind enum notes.
- Keep behaviour and ownership flow unchanged outside observer-event
  emission for ExternalFuture values.

* Deduplicate BDD assertions and flatten unary neg

Add typed RuntimeObserverWorld assertion helpers for external call\nrequest/return checks and reuse them in three BDD steps.\n\nFlatten the Value::Int and Value::Ref branches in VM::unary_neg\nto reduce nested conditionals while preserving observer emission,\nerror handling, and value-lifetime behaviour.

* Fix observer emission ordering and add BDD docs

Validate snapshot state before emitting external call request events in\nREPL and run progress builders so failed snapshot construction does\nnot produce spurious observer events.\n\nAdd concise Rustdoc to runtime observer BDD helper types and methods,\nincluding call_id preconditions and shared mutex-buffer behaviour.
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 5, 2026

Merging this PR will not alter performance

✅ 13 untouched benchmarks


Comparing leynos:fix/rebase-gate-repair-main (32a3615) with main (bf7c7ef)

Open in CodSpeed

@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

❌ Patch coverage is 91.75947% with 37 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/monty/src/repl.rs 71.11% 26 Missing ⚠️
crates/monty/src/observer.rs 70.00% 9 Missing ⚠️
crates/monty/src/args.rs 97.50% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@leynos leynos closed this Mar 5, 2026
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