Skip to content

Prove stale process refs preserve runtime identity#100

Merged
beardedeagle merged 3 commits into
mainfrom
stale-process-ref-lifecycle-gate
Jun 6, 2026
Merged

Prove stale process refs preserve runtime identity#100
beardedeagle merged 3 commits into
mainfrom
stale-process-ref-lifecycle-gate

Conversation

@beardedeagle

Copy link
Copy Markdown
Owner

Summary

This change adds a source-to-runtime gate for stale process-reference lifecycle behavior. The new example spawns two Worker instances from the same process definition, transports the first ProcessRef<Worker> through a Sender, stops that original runtime PID, and proves a later send through the stale reference returns Err(Stopped(Work)) instead of retargeting to the newer worker instance.

What changed

  • Added examples/process_ref_stale_lifecycle.str as a runnable source-to-runtime example for stale process-reference sends.
  • Added an acceptance test that checks, builds, and runs the example through Mantle.
  • Asserted the artifact lowers the send target through typed received-payload IDs rather than source names or type spellings.
  • Asserted trace evidence for the transported runtime PID, the newer same-definition worker PID, the stopped stale target, and the absence of any Work delivery to the newer worker.
  • Wired the focused gate into just source-to-runtime-gates and the runnable success-example list.
  • Updated assurance markers and runtime/source-to-runtime documentation so the boundary guarantee is visible in the documented language surface.

Why

Process references are runtime authority surfaces. A transported reference must remain bound to the specific runtime process instance it denotes. It must not be resolved later by source process name, type spelling, or any other metadata that could accidentally route a stale reference to a newer instance of the same process definition.

This gate makes that boundary executable and trace-checked.

Validation

  • just process-ref-lifecycle-gates
  • just run-example process_ref_stale_lifecycle
  • just language-surface-assurance
  • just source-to-runtime-gates
  • just quality
  • just performance-smoke
  • just fuzz-ci
  • just miri-ci
  • pre-commit hook: clippy and fmt-check
  • pre-push hook: native CI gate, including workspace checks/tests, source-to-runtime gates, and git diff --check

Add a source-to-runtime gate that spawns two same-definition workers, transports the first ProcessRef through another process, stops that original PID, and proves the follow-up send returns Err(Stopped(Work)) instead of retargeting to the later worker. Wire the example into runnable gates, assurance markers, and documentation so the runtime boundary remains documented and testable.

Constraint: Process references are runtime authority surfaces that must dispatch through typed process IDs and runtime PIDs rather than source names.
Rejected: Source-name or type-spelling dispatch checks alone | trace-level PID assertions are required to prove non-retargeting.
Confidence: high
Scope-risk: narrow
Directive: Keep stale ProcessRef behavior tied to runtime PID identity; update trace-level gates if scheduler or PID lifecycle semantics change.
Tested: just process-ref-lifecycle-gates; just run-example process_ref_stale_lifecycle; just language-surface-assurance; just source-to-runtime-gates; just quality; just performance-smoke; just fuzz-ci; just miri-ci
Not-tested: Long-duration stress or OS-level RSS profiling beyond existing performance-smoke and fuzz/Miri gates.
Copilot AI review requested due to automatic review settings June 6, 2026 03:51

Copilot AI 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.

Pull request overview

This PR adds an executable “source-to-runtime” gate proving that transported (stale) ProcessRef<Worker> values remain bound to their original runtime PID and do not retarget to a newer instance of the same process definition.

Changes:

  • Added a new runnable example (process_ref_stale_lifecycle) that transports a stale ProcessRef<Worker> through a Sender and asserts the later send yields Err(Stopped(Work)).
  • Added/ wired an acceptance-test gate (including trace + artifact assertions) and integrated it into just source-to-runtime-gates plus the success-example list.
  • Updated docs and language-surface assurance markers to make the stale-ref identity guarantee visible and tracked.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Justfile Adds a focused process-ref-lifecycle-gates recipe and wires it into source-to-runtime-gates; includes the example in the success gates list.
examples/process_ref_stale_lifecycle.str New example exercising stale ProcessRef lifecycle behavior via a transported reference and stopped-send outcome.
docs/src/source-to-runtime-gates.md Documents the new runnable example and the dedicated lifecycle gate + its trace-level proof intent.
docs/src/runtime-reference.md Updates process-reference boundary text to explicitly state transported refs never retarget to newer instances.
docs/src/examples.md Adds the new example to the recommended reading order list.
docs/src/examples-runtime.md Adds a runtime-focused bullet describing what the new example proves.
crates/strata-mantle-acceptance/tests/source_to_runtime_gates/process_refs_and_authority.rs Adds the acceptance test validating stdout signals, artifact lowering shape, and trace evidence for stale-ref non-retargeting.
crates/strata-mantle-acceptance/tests/language_surface_assurance/process.rs Wires the new example + test into the language-surface assurance feature matrix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The stale ProcessRef gate must prove a newer same-definition worker exists before the stale send outcome is bound, not merely that both events occurred somewhere in the trace. Reusing the existing trace line-index helper keeps the assertion exact and source-to-runtime focused.

Constraint: PR review identified a trace-order proof gap in the stale ProcessRef lifecycle gate.
Rejected: Relying on stdout order or event presence alone | those checks do not prove the newer worker existed before the stale send outcome.
Confidence: high
Scope-risk: narrow
Directive: Keep process-ref identity tests tied to runtime PID ordering evidence, not process/source names.
Tested: cargo +stable fmt --all --check; just process-ref-lifecycle-gates; just language-surface-assurance; just source-to-runtime-gates
Not-tested: Full workspace quality after this test-only assertion change.

Copilot AI 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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Copilot AI 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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

The stale ProcessRef lifecycle gate should prove runtime identity through artifact-derived process IDs and stable assurance markers. This keeps the test aligned with the typed Strata/Mantle boundary while avoiding brittle ordering literals or assertion-message marker text.

Constraint: PR review identified hardcoded process IDs and a brittle assurance marker in the stale ProcessRef proof.
Rejected: Keeping current literal process_id checks | they couple the gate to artifact ordering even though the typed ID is already available.
Rejected: Keeping assertion text as assurance evidence | marker wording can change without changing behavior.
Confidence: high
Scope-risk: narrow
Directive: Keep lifecycle proof checks tied to artifact-derived typed IDs and stable test names.
Tested: cargo +stable fmt --all --check; just process-ref-lifecycle-gates; just language-surface-assurance; just source-to-runtime-gates
Not-tested: Full workspace quality after this narrow review-fix patch.
@beardedeagle beardedeagle force-pushed the stale-process-ref-lifecycle-gate branch from 43b513d to 766c1ba Compare June 6, 2026 04:20

Copilot AI 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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Copilot AI 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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@beardedeagle beardedeagle merged commit ab7792f into main Jun 6, 2026
10 checks passed
@beardedeagle beardedeagle deleted the stale-process-ref-lifecycle-gate branch June 6, 2026 05:34
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.

2 participants