Skip to content

fix(lifecycle): share one root verdict and process census - #89

Closed
alphastorm wants to merge 17 commits into
mainfrom
feat/lifecycle-verdict
Closed

alphastorm wants to merge 17 commits into
mainfrom
feat/lifecycle-verdict

Conversation

@alphastorm

@alphastorm alphastorm commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Invariants

  • Within the declared census boundary, idle requires a readable census, run/install records that are readable
    objects or known absent, no pending launch or unpublished child, no counted survivor, no different-profile
    install and a free port. A retained job requires a stopped run whose tree_verified_empty equals its
    tree_token; quiescence permits another installed profile only after these other conditions hold:
    test_every_combination_lands_in_one_row_and_every_consumer_acts_on_it and
    test_extended_product_preserves_all_three_properties and
    test_every_interruption_preserves_a_nonidle_verdict_until_custody_is_resolved.
  • Where the structural launch/job conditions permit cleanup, stop attempts the recorded processes, verified
    descendants and executable-census members that status counts, including survivors outside a missing job,
    remembers identities within the declared timestamp resolution, and fences delayed wrappers. There are at
    most two termination passes; permission errors, timeouts and still-counted identities can prevent completion.
    Success or a new empty-tree proof requires the last census to be read and empty, without filtering out
    already-ended identities. A still-counted identity is reported as still alive, not claimed ended.
    Initial or later unreadable evidence prevents completion; available attributable processes can still be
    cleaned up, but an absent run record is not invented and unreadable run bytes are not overwritten:
    test_stop_ends_a_surviving_tree_member_and_the_engine_running_under_it,
    test_an_unrecorded_engine_that_outlives_its_server_keeps_the_root_from_idle,
    test_stop_never_reports_stopped_while_a_reused_pid_is_still_counted,
    test_stop_requires_its_last_census_to_be_read_and_empty,
    test_missing_windows_job_does_not_hide_census_cleanup, and the delayed-wrapper interruption case.
  • Unreadable, corrupt, null or other non-object top-level run/install evidence, an unreadable census, an
    unresolved launch, an unproved job or an occupied configured port never admits start/install; unreadable
    record evidence never reads as "not installed". On both platform flags, recovery advice offers stop or
    reinstall only when that action's structural admission permits the same stable evidence and launch/job
    state, not as a promise that later reads, native operations or installation will succeed:
    test_failed_timed_out_or_empty_ps_is_unavailable_not_an_empty_census and
    test_record_faults_block_admission_but_preserve_available_cleanup,
    test_advice_on_both_platforms_including_healthy_stray_status,
    test_advice_table_reaches_every_row_on_both_platform_flags, and
    test_install_does_not_advise_stop_when_the_verdict_requires_reconciliation_or_a_retry.

Scope

Head cb71401e is pushed and merges main at 2db275e2; six changed paths:

  • omp_strata/lifecycle.py
  • omp_strata/procs.py
  • omp_strata/cli.py
  • tests/unit/test_lifecycle.py
  • tests/unit/test_lifecycle_states.py
  • tests/unit/test_experiment_loop.py

This is the lifecycle part of #84 and its successor: one verdict for status, start, stop, candidate-generation
checks and install; explicit pending/abandoned launch labels; delayed-wrapper fencing; surviving and restarted
engines; unpublished-child and unproved-job states; occupied-port refusal with ownership unproved; and
stop-incomplete and unreadable-record labels. Each verdict reads the process table once, not once per command:
healthy status makes additional descendant/health observations and stop obtains later verdicts.

The experiment test file contains only lifecycle fixture/seam migrations.
HoldAndRootTests is inherited once from main in tests/unit/test_host_holds.py.

Red then green

  • 2eaa217: tests-only evidence/model extension, 16,128 combinations plus direct reproductions;
    40 assertion failures and four unguarded-install-read errors, exit 1. The read-only preflight test passed.
  • 0ff258a: the unsupported subsecond-identity expectation is corrected in its own commit to pin the declared
    POSIX collision limit, without changing native identity collection.
  • 2ac1c65: guards both records, checks every later census before success, requires job proof before quiescence,
    cleans census survivors after a missing Windows job, blocks occupied-port installs and shares stop admission
    with recovery advice.
  • 4bd2a22: the first focused run exposed two termination doubles that returned success while leaving their
    processes in the census; the fixtures now remove ended identities, with every assertion retained.
    A minimal pending-start fixture also supplies its install-record path.
  • 92d001c: all twelve advice rows on each platform flag, with present/missing job seams and reinstall
    admission, plus the real healthy-status stray branch and the extended evidence product.
  • aef71fa: four lifecycle reproductions, eight assertion failures, zero errors, exit 1.
    The red-only idle vocabulary comes verbatim from 47da43c:scripts/requalify.py:47;
    the final tests import lifecycle.IDLE_STATES. All four test function bodies are byte-identical across the fix.
  • 0185ca9: verdict/census implementation, 3,920-combination model walk, P0–P8 real-process interruption walk,
    process-table failure tests and explicit census-residual test.
  • 8b75d5c: install recovery test, three assertion failures, exit 1.
  • 0717e0f: install renders the verdict's refusal rather than unconditional stop advice.
  • 56f0db8: preserves the documented port-refusal phrase as contiguous source text without changing its rendered
    message; the existing troubleshooting-source test was red in the first full suite and green after this change.
  • 19e7e5c → 999535b: two PID-reuse tests, 18 failing assertions before the fix, both green afterward;
    the transition walk covers 24 schedules/88 snapshots and refuses continuing replacement after the second pass.
  • 0defcd9 → 0072d96: two stale-snapshot attribution tests, two failing assertions before the fix, both green
    afterward; the real Windows table function is exercised with fake observation seams, including the timestamp
    boundary. Both added test classes remain byte-identical across their respective fixes.

Current merged-head verification

At cb71401ebd2a906fbad7a2229447d9191fea08e6, with main 2db275e2 merged, Python 3.13.18,
2026-11-14 UTC:

  • Complete host-free suite, nothing deselected: 1,283 discovered; 1,276 run; OK (10 skipped, four expected
    failures); exit 0
    , 502.431 seconds.
  • The six focused unit modules: 265 tests OK, 40.238 seconds; all end-to-end stages passed.
  • Original model: 3,920 cases / 4.1 seconds; evidence extension: 16,128 cases / 3.15 seconds.
    Together, 20,048 evaluated cases in two products, plus the 192-case launch/job advice table and
    48-case all-row/platform/job-presence table. These are overlapping enumerated products, not disjoint
    observations; both advice-table counts were also observed while running the unchanged test methods.
  • P0–P8 interruption walk: 9.81 seconds; P0 is intentionally idle before launch publication.
    Identity walk: 24 schedules / 88 snapshots / 0.051 seconds.
  • Hygiene, compatibility render, documented route, 166 profile/route validations and 164 manifest
    verifications passed; release/profile/route history is byte-identical to the merged base.
  • 17 PR-range commits have verified signatures; both native termination bodies remain byte-identical to
    main. Post-unit sleeper scans found no matches.
  • The exact-head host-free CI run passed
    its checks job and all ten suites on Ubuntu. These results do not qualify native Windows behavior.

Historical author verification before the latest main merge and push

At 92d001cb84a2cc4bd80e9530f20d8dc4b301098c, Python 3.13, 2026-11-14 UTC:

  • Complete host-free suite, nothing deselected: 1,240 discovered; 1,233 run; OK (10 skipped, four expected
    failures); exit 0
    , 492.101 seconds. Final targeted regressions: 20 tests OK.
  • Original model: 3,920 cases / 3.9 seconds; evidence extension: 16,128 cases / 3.08 seconds.
    Together, 20,048 evaluated cases in two products, plus the 192-case launch/job advice table and 48-case
    all-row/platform/job-presence table. These enumerations overlap; they are not disjoint observations.
  • P0–P8 interruption walk: 9.84 seconds, with P0 before launch publication;
    identity walk: 24 schedules / 88 snapshots / 0.031 seconds.
  • Hygiene, compatibility render, documented route, document-reader tests, 166 profile/route validations and
    164 manifest verifications: every exit 0. Release/profile/route bytes remain identical to merged main.
  • All 16 branch commits have verified Good signatures; the five remediation commits were verified immediately.
    No existing test was removed and both native termination bodies remain byte-identical to main.
  • The author's final process scans found no leftovers. The later merged head cb71401e has since been pushed.

Earlier historical verification

At 0072d968d5e5841f729e0d66dc5fea57a8bebdb3, directly on main 9dda9179, Python 3.13:

  • Complete host-free suite through the machine-wide limiter, nothing deselected: 1,216 discovered; 1,209 run;
    OK (10 skipped, four expected failures); exit 0
    .
  • Model walk: 3,920 combinations, all 12 rows, 4.0 seconds. P0–P8 interruption walk: 9.80 seconds.
  • PID-reuse transition walk: 24 schedules, 88 snapshots, 0.046 seconds.
  • Public hygiene, compatibility render and documented route: exit 0.
  • All 166 profiles/routes and 164 manifests validate, every exit 0.
  • releases, profiles and routes were byte-identical to that historical main; process scans found no
    remaining started stub, interruption driver or dev-environment process.

Limits

The executable census requires an absolute executable path under the runtime. Relative or unreadable executable
names never acquire ownership from the caller's working directory; recorded processes and verified current
descendants retain their separate identity/ancestry rules.
test_relative_executable_never_acquires_ownership_from_cwd pins that boundary. Individual unreadable identities
and malformed process-table rows can be omitted; an unreadable whole table is not an empty one.

An unrecorded process outside the runtime without a live verified ancestor is outside the census, including a
base interpreter behind a venv redirector.
test_an_unrecorded_process_outside_the_runtime_is_not_counted_or_stopped pins the outside-runtime residual.
A held configured port independently blocks start/install: it does not add the listener to the census, prove it
foreign or authorize stop to signal it. The refusal names listener PIDs when the platform query succeeds and
otherwise reports the PID unavailable; the operator must end the holder or change the port.

Stop makes at most two termination passes. Derived descendants and census members come before other recorded
processes, then server and wrapper; census members retain process-table order, so a census parent can be
signalled before its child. This is not a total deepest-first guarantee.

On the ordinary POSIX ps path, creation stamps have one-second resolution: a PID reused by the same executable
within that second is indistinguishable. If that identity remains counted after a termination pass, stop now
reports it still alive rather than filtering it out and reporting stopped. Finer identity is tracked in
#92. The existing fallback when ps is absent uses procfs
kernel ticks; this change introduces no finer ps clock.

Native Windows Toolhelp, job and signaling behavior has not been exercised on a host. A read-only status is the
recommended first step before native-host qualification, not an automatically enforced first-use sequence or
evidence that qualification has occurred. The Windows census excludes later-created identities before using a
snapshot PPID, tested with synthetic snapshot, identity and clock seams by
test_a_reused_pid_created_after_the_snapshot_is_not_attributed_to_the_old_parent, including before/equal/after
the cutoff; native API and backward-adjusted UTC clock behavior remain unexercised.

The separate inherited signaling window remains
#91: both native termination implementations check identity
and then resolve the PID for signaling, so reuse between those operations can signal a replacement.
Handle-bound Windows verification is not implemented or natively exercised; neither native termination body
was changed here.

Malformed-record coverage is top-level object/null/type/IO/encoding handling, not validation of every nested
identity structure or every timing schedule. Separate commands do not share an atomic observation. The model's
measured times are not runtime ceilings.

The healthy-status path still has a pre-existing diagnostic gap: a key file's permission or encoding error can
escape rather than becoming a structured status problem. This is outside the verdict's idle/quiescent
admission reads and is not fixed here.

No GPU, physical-host, performance or upstream engine-lifetime claim follows from these host-free tests.

The preceding reproduction expected subsecond distinction from ps lstart. Pin the actual collision as the declared limit; native identity collection stays unchanged.
Guard both records without discarding attributable cleanup. Recheck census success before publishing stopped, resolve retained jobs before quiescence, and block install on any occupied port. Share structural stop admission with recovery advice and reject relative executable attribution.
Two termination doubles returned success while leaving every identity in later snapshots, encoding the false-success defect. Remove ended identities from their modeled census without changing any assertion or real sleeper cleanup. Supply the newly required install-record path in the pending-start fixture.
@alphastorm

Copy link
Copy Markdown
Owner Author

Superseded; closing without merging. The branch is kept.

After two review rounds this change was not admitted in either. It holds three mechanisms (the process-table reader, the verdict over records and census, the stop loop), and each round found defects in a different one; the model that guards the verdict takes the process table as given, so it could not see a table that is silently incomplete.

It returns as three stacked pull requests, each one mechanism with its own finite model:

  1. the process-table reader ("the table is every process of one snapshot whose identity this user can read, or it is unavailable") — feat(procs): read the process table whole or report it unavailable #93
  2. the verdict over records and census, on top of feat(procs): read the process table whole or report it unavailable #93
  3. the stop loop, on top of the verdict

Every behaviour found in the two rounds is reproduced as a failing host-free test and fixed on exactly one of the three. The launcher change that was waiting on this pull request waits on the three instead.

@alphastorm alphastorm closed this Nov 14, 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