Skip to content

feat(procs): read the process table whole or report it unavailable - #93

Merged
alphastorm merged 13 commits into
mainfrom
feat/process-table-complete
Nov 14, 2026
Merged

alphastorm merged 13 commits into
mainfrom
feat/process-table-complete

Conversation

@alphastorm

@alphastorm alphastorm commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Accounted process-table reader

Every enumerated PID is either identified or explicitly unidentified, and the reader's own identity must be readable; otherwise the table is unavailable. The table has no production caller in this piece. Every function that exists on main keeps its results and exceptions.

Unchanged behaviour

The proof of unchanged behaviour for this piece is structural: every baseline line remains in order, insertions bind neither baseline names nor previously unbound globals read by baseline functions on either platform branch, and all 18 original function bodies plus ProcInfo stay identical, so exception messages are covered by identical bodies rather than by a test that compares them. A later piece that deliberately changes an older function adds the behavioural comparison it needs.

The four tests are in tests/unit/test_process_table.py, under LegacyStructureTests:

  • test_baseline_lines_are_preserved_in_order
  • test_insertions_do_not_rebind_baseline_names
  • test_insertions_do_not_bind_unbound_legacy_globals
  • test_every_original_function_body_is_byte_identical

tests/unit/frozen_procs_main.py is an unchanged, test-only copy of main at 2db275e2c08bbb2717504b9af2352c6f0f5a2529, never imported by the runtime package. The generated differential is removed: comparing identical bodies against the same globals added no independent evidence.

One comparison

Malformed records give “cannot say”. For a valid record, an unidentified PID gives “cannot say”, and a PID that was not enumerated gives “not enumerated”. Only an identified row reaches executable comparison, where an unreadable path on either side gives “cannot say”. After those exits, the comparison is:

Creation stamps Executable Outcome
Equal text Equal Same process
Equal text Different Cannot say: the program may have replaced itself or one identity may be rendered differently
Different stamps in the same counter clock Any readable path Another process
Every other stamp pair Any readable path Cannot say

A process can replace its program in place while retaining its PID and creation time. Its calendar stamp can also be re-rendered after a clock or time-zone change, or be replaced by procfs text when the available source changes. Neither a different executable nor both of those text changes proves another process. A missing live stamp is likewise unrecognised and gives “cannot say”.

Windows FILETIME and procfs start ticks are counter clocks; procfs ticks count from boot. Under the same-host, PID-namespace and time-namespace precondition, two different counter stamps for one PID prove another process, including across a reboot, because the recorded process did not survive it. Equal stamps and an equal executable after a reboot cannot be distinguished from the same process; this is already a limit of the comparison on main. ComparisonCells.test_equal_procfs_stamp_after_reboot_is_indistinguishable documents that behaviour without claiming to exercise a real reboot.

A recognised counter stamp is canonical unsigned decimal (0, or digits without leading zeros), bare for FILETIME and prefixed by starttime: for procfs. Other spellings and calendar text are unordered. Executables compare without case on Windows; POSIX strips the kernel's (deleted) suffix on both sides. Surrogate escapes are lossless, U+FFFD is lossy, and a marker without a path is unreadable on POSIX.

On a host whose stamps are calendar text, this comparison never proves that a PID was reused: it says “cannot say”. What a refusal offers the operator belongs to the piece that consumes this table, not this reader.

Sources, ancestry and limits

  • Records and tables are comparable only on the same host and in the same PID namespace and time namespace; this code does not check that precondition, and recording namespace identity belongs to a later record format.
  • On procfs systems, the executable must come from a readable kernel link, never a command-name fallback. Missing, inaccessible and zombie links make the PID unidentified. Without procfs, ps executable text is used.
  • The procfs fallback brackets the executable-link read with two start-time reads. A failed or different second stamp makes the PID unidentified. An unchanged stamp keeps the identity, even if the parent or command text changed. The reread rejects reuse that changes the reported start tick, not reuse within one tick; a same-tick replacement can combine the earlier parent with the later executable, and a dead record with an equal executable can compare as the same process. The ps path retains its separate stamp/link window.
  • A ps row is checked only for the shape of five tokens: alphabetic weekday and month, a one- or two-digit ASCII day, three two-digit ASCII clock components, and a four-digit ASCII year; date-shaped impossible values and a missing year supplied by a four-digit command token still pass. Fields that fail this token-shape check leave a readable PID unidentified. No English names or changed locale are assumed. Because calendar stamps never prove another process, such a mis-read row gives “cannot say” or, only when its stamp text and normalised executable equal the record, “the same”. A limit follows: under a locale whose ps prints these fields in another order, or with punctuation in the weekday or month, no row has the shape, the reader's own row is unidentified, and the table is unavailable; the readers on main, which take the five tokens as they come, are unaffected.
  • Duplicate PIDs are unidentified even if their rows agree. Duplicate or unreadable self, an unreadable PID token, a failed source or an incomplete Windows walk makes the table unavailable.
  • Counter clocks can disprove parent edges; calendar stamps cannot. Calendar text has no UTC offset and can reverse during daylight-saving fall-back. Equal counter stamps retain the edge; mixed or unrecognised clocks are not ordered. POSIX reparents children when a parent exits.
  • Windows samples before snapshot capture and subtracts _WINDOWS_CREATION_MARGIN_100NS = 10_000_000 (one second). The inclusive margin covers ordinary clock granularity differences, not backward clock changes. It clears uncertain parent edges without hiding readable identities, and can also clear a genuine young edge.
  • On the POSIX ps path with procfs, the stamp and parent come from ps, while the executable link is read later. Reuse of a PID between those reads by a process with the same executable path can leave the earlier stamp and parent in the row. Closing this gap needs an identity whose stamp procfs provides in the same read as the executable link; that requires a new record format and belongs to a later piece.
  • Ordinary ps retains its one-second identity collision. Existing termination keeps its check-then-signal limit. Native Windows and backward clock changes are not qualified by these host-free tests.

Unlinked images

The unchanged POSIX info() on main starts with the command text from ps and reads the kernel link only if os.path.exists(link) is true. The host-free unlinked-image test makes that existence check false, so the recorded executable stays the command text; the table still reads /runtime/engine (deleted) directly. It models both a full-path command and a basename, without running or unlinking a real binary.

Recorded command text Equal calendar stamps Re-rendered calendar stamps
/runtime/engine Same process Cannot say
engine Cannot say Cannot say

No case says “another process”. ProcfsExecutableTests.test_unlinked_image_comm_record_is_conservative exercises the actual unchanged info() body against fake OS boundaries.

Finite test domains

These domains overlap; they are not additional unittest test counts.

Domain Cases
Comparison partition: nine stamps per side, five executables per side, two platforms 4,050
Toolhelp row counts, walk endings, executable fidelity, margin and self readability 432
Recorded source scenarios, including changed stamp/path on each platform 32
Record shapes: 336 malformed records and 24 valid controls 360
Parent order, source, row order and self placement 54
Duplicate PID, source, row order and self position 12
Windows creation-margin boundaries 6
Numeric source spellings 37
Live executable fidelity across both platforms 8
Empty, lossy and marker-only recorded paths with distinct calendar/counter stamps 6
Kernel-link failure kinds 2
Deleted-suffix normalisation on both sides 4
Noncanonical leading-zero stamps, both families and directions 4
Calendar/procfs source changes, both directions and executable equality states 4
In-place program replacement with a re-rendered calendar stamp 1
Procfs confirmation: stable, changed metadata, changed stamp, failed second read 4
Known procfs same-tick replacement limit, equal/different executable paths 2
Denied procfs executable link with readable stat values 1
Known calendar-shape ambiguity: two rows, four record combinations each 8 observations
ps shape: fourteen rejected rows and two valid locale/spacing controls 16
Unlinked-image command shape and calendar rendering 4
POSIX observation boundaries skipped under simulated Windows 10

Both executable alphabets in the comparison partition contain U+FFFD and marker-only text. The partition retains five disjoint stamp/path combinations, but its two unordered combinations now share the “cannot say” result. The source walks retain changed calendar stamp/path cases as uncertainty controls, not evidence of reuse. POSIX-only observation classes and the POSIX parent-clock method are skipped on Windows; Windows-independent comparisons and fake Windows clock tests remain active.

Reverted mutations

Each row below names one source line and a mutation that produced a failing test. ComparisonCells is in test_process_observation.py; the other classes are in test_process_table.py.

Line in omp_strata/procs.py Mutation reverted Test that fails
131, if not valid_identity(recorded): Invert the condition RecordedIdentityShapeWalk.test_malformed_records_are_never_absent_reused_or_an_exception
134, if pid in self.unidentified: Change in to not in SnapshotBoundaryTests.test_enumerated_unreadable_pid_is_not_reported_absent
137, if live is None: Change is None to is not None RecordedObservationWalk.test_four_recorded_outcomes_and_self_readability_on_both_sources
140, unreadable-identity guard Remove not _readable_executable(live_exe) or ComparisonCells.test_comparison_cells_partition_the_generated_domain
140, unreadable-identity guard Remove or not _readable_executable(recorded_exe) ProcessTextTests.test_lossy_recorded_executable_never_claims_pid_reuse and ComparisonCells.test_comparison_cells_partition_the_generated_domain
143, equal-stamp condition Change == to != ComparisonCells.test_equal_stamp_equal_executable_is_same
144, equal-stamp return Change the equal-executable result from SAME to UNKNOWN ComparisonCells.test_equal_stamp_equal_executable_is_same and ComparisonCells.test_equal_procfs_stamp_after_reboot_is_indistinguishable
144, equal-stamp return Change the changed-executable result from UNKNOWN to OTHER ComparisonCells.test_equal_stamp_changed_executable_is_unknown
146, counter-family condition Remove live_clock is not None and ComparisonCells.test_comparison_cells_partition_the_generated_domain
146, counter-family condition Remove recorded_clock is not None and ComparisonCells.test_comparison_cells_partition_the_generated_domain
146, counter-family condition Change family equality from == to != ComparisonCells.test_distinct_counter_stamps_prove_reuse
147, different-counter return Change OTHER to UNKNOWN ComparisonCells.test_distinct_counter_stamps_prove_reuse
148, unordered-stamp return Change UNKNOWN to OTHER ComparisonCells.test_different_unordered_stamps_same_executable_are_unknown and ComparisonCells.test_different_unordered_stamps_changed_executable_are_unknown; also the calendar replacement, mixed-source, missing-live-stamp and unlinked-image tests

Additional source mutations fail these tests in test_process_observation.py:

Source Mutation reverted Test that fails
procs.py:585-588 Remove the second-read confirmation block ProcfsSnapshotTests.test_procfs_identity_rechecks_start_stamp_after_link
procs.py:587 Remove the failed-second-read check ProcfsSnapshotTests.test_procfs_identity_rechecks_start_stamp_after_link
procs.py:587 Remove the changed-stamp check ProcfsSnapshotTests.test_procfs_identity_rechecks_start_stamp_after_link
procs.py:548 Replace shape validation with token count PsRowShapeTests.test_ps_creation_tokens_have_lstart_shape
procs.py:526 Require English weekday/month names PsRowShapeTests.test_ps_creation_tokens_have_lstart_shape
procs.py:527 Require a two-digit day PsRowShapeTests.test_ps_creation_tokens_have_lstart_shape
POSIX skip decorators in the observation module Remove the decorators ObservationPortabilityTests.test_posix_boundaries_are_skipped_on_windows
procs.py:528 Remove the three-component clock check PsRowShapeTests.test_ps_creation_tokens_have_lstart_shape
procs.py:529 Remove the ASCII-digit clock check PsRowShapeTests.test_ps_creation_tokens_have_lstart_shape
procs.py:585 Replace the readable-identity guard with if True ProcfsSnapshotTests.test_denied_procfs_executable_link_is_unidentified_without_confirmation

The three targeted guard mutations now fail: removing clock arity gives one assertion failure; removing clock ASCII validation gives one assertion failure; bypassing the readable-identity guard raises AttributeError in the denied-link test. Each mutation was reverted in memory. The two known-limit tests also fail under mutations that reject a repeated-tick match or impose semantic day validation. Receipt: remediation-r1b-mutations.log.

Added limit tests

  • ProcfsSnapshotTests.test_known_limit_same_tick_reuse_can_match_a_dead_record models two lifetimes sharing a tick; it is a stated limitation, not a safety guarantee.
  • ProcfsSnapshotTests.test_denied_procfs_executable_link_is_unidentified_without_confirmation supplies readable stat values but denies the link; the PID is unidentified without raising or attempting confirmation.
  • PsRowShapeTests.test_known_limit_date_shapes_and_digit_prefixed_commands_can_be_identified pins two ambiguous row shapes and eight comparison outcomes, none “another process”.
  • PsRowShapeTests.test_ps_creation_tokens_have_lstart_shape also rejects 12:34 and 12:ab:56.

Source checkpoint and evidence

Commit 15b459a2da96f080a0ec1f33def0895732def551 is signed and immediately verified (U); this batch was not amended or pushed. Only docstrings change in omp_strata/procs.py against 139d62d04c6ca229d11ffd4da35fa55e5a268442: both docstring-stripped syntax trees have SHA256 a6df7f61311829c8f84507b94fb42effb9db006aa4b6fef98ee144938d8e5a2b and compare identically. Against main, the module remains 328 added lines and zero removed lines; the frozen baseline is untouched and matches main.

Receipts: remediation-r1b-mutations.log, remediation-r1b-source-evidence.log and remediation-r1b-signature.log.

Verification

The two focused modules passed once through the limiter: 49 tests in 1.594 seconds, no failures or skips, exit zero, including all four structural tests. Public hygiene passed before the signed commit. Receipt: remediation-r1b-focused.log.

The full suite passed once through the limiter at 15b459a2da96f080a0ec1f33def0895732def551: 1,294 discovered, 1,287 run in 460.750 seconds, ten skips, four expected failures, no failures or errors, exit zero. It used Python 3.13.18 and the retained stock OMP/Strata environment for profile win11-rtx5090-coder-iq1m-131k-strata0.1.30-omp18.4.6, with the pinned Strata commit and OMP size/hash checked before discovery. Finished at 2026-11-14T10:15:14Z; receipt: remediation-r1b-full.log.

- Replace generated self-comparisons with four frozen-baseline structural tests.
- Pin unreadable executable guards, empty live stamps, and the reboot collision limit.
- Clarify counter clocks and the POSIX split-read limit without changing runtime logic.
- Restrict another-process evidence to different stamps in one canonical counter clock.
- Bracket procfs image reads with start-time checks and validate localized ps field shapes.
- Cover unlinked-image records and skip POSIX observation boundaries on Windows.
- State common host/namespace provenance, repeated-tick and calendar-shape limits.
- Cover clock arity, ASCII components and denied-link confirmation boundaries.
- Preserve production behavior and the frozen main baseline.
@alphastorm
alphastorm merged commit afc2d42 into main Nov 14, 2026
11 checks passed
@alphastorm
alphastorm deleted the feat/process-table-complete branch November 14, 2026 14:05
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