Skip to content

test(mech): random properties for what a session hands its target and leaves in the registry - #125

Merged
donislawdev merged 1 commit into
mainfrom
test/property-search-mech
Oct 19, 2026
Merged

donislawdev merged 1 commit into
mainfrom
test/property-search-mech

Conversation

@donislawdev

Copy link
Copy Markdown
Owner

Step 2e of the random-property plan, the last of step 2: chrono-mech, the crate that touches the system - what a session hands its target (the command line, the environment block) and what it leaves in the machine registry (the WebView2 policy value of --elevated-embedded).

Properties (3, each in a mod properties beside its code)

where property history it calibrates on
lib.rs a program reads back the arguments it was started with P9
policy_value a value is its writer's to every reader, and a look takes only what a session wrote the live-owner scan (wv2 entries)
environment the block holds the environment and the session's variables and nothing else R4-N17

The oracles are the system's or a model's, not the code under test:

  • Command line. The line launch_line builds is read back by CommandLineToArgvW, the system's own reader (imported with raw-dylib in the test, as loader_failure.rs does, so the windows crate gets no new feature). Program paths are drawn from pieces of names Windows takes, every mark a command line could take for its own among them (spaces, &, %, ^, !, parentheses, ;, =, Polish letters, CJK, emoji, a share, a verbatim drive, a relative path). Arguments are drawn from pieces holding every separator a parser might split on, quotes, and runs of backslashes before a quote, the end, a letter and a space. A zero character, by name in the path, the working folder or an argument, is refused naming where it stood (R4-N16).
  • Registry. On a scratch key under HKCU with the calls production makes, as the unit tests of policy_value.rs do. The * value is absent, not text, or switches with gaps of every kind - the port switch in each form, near misses, whole markers of other cores, broken ones. Beside it stand the tester's values, numbers, and values written the way a session writes one, by cores alive or gone, the key's default value among the names. The road is the one production takes: the session's own look for leftovers, the write, another session's look with the writer alive or gone, the removal. After every step the key holds exactly what the model says, value for value, and exists exactly when it should.
  • Environment. Names that differ in more than case, drive-directory entries, values with unpaired surrogate halves at both ends of each range, a session's variables in another case or given twice. The model is a map by the name in capitals, so the order owed is the byte order of ASCII capitals, independent of the code's sort key. Names outside ASCII are left out on purpose: the system's order for them has no model independent of the code, and the code's comment says Windows environment names are ASCII in practice.

Fixed

The registry property found two faults on its first cases:

  • The first marker of a value was read. A session copies * into its value and puts its own marker last, so a * that carries a marker - a tester who copied a session's value there - made the value look like another core's. The session then left its value in the machine registry while saying it was removed, and another session's look removed it while it ran. A broken marker in * hid a dead session's value from every later look. The last marker is read now.
  • A look removed * when it carried the marker of a core that is gone, though no session writes under * (or under the key's default value). Names no session writes under are skipped.

CHANGELOG.md names both. Each has a unit test of its own.

Weekly search

A mechanism part in search.yml with its canary (crates/mech/src/search.rs) and the path that runs it on a pull request - so search.yml runs on this one. The registry property takes about 2.5 ms a case, so the part searches 150 000 cases, about six minutes on the machine that measured it. The floor of weekly_search.rs goes from four places with properties to five.

Measured

  • Fixed seed: chrono-mech --lib 129 to 135 tests, the three properties in 0.7 s. The guards hygiene, names, shape, weekly_search, components, architecture, wire_keys, clippy, clippy-pin and lint-ps green.
  • Random seed, 50 000 cases each property before this was opened: 125 s for the three, nothing beyond the findings above.
  • Mutation registry 956 to 961, all five new entries caught: one from the history of each property (P9, the live-owner scan, R4-N17) and one for each fix. The anchor of r4-15 s15 without surrogate repair had gone stale in step 2a (c859e29) - that line gained a ? - and is put right, caught again.

Not in this step

A batch script's line: the interpreter is its own reader, and a script cannot write back an argument holding &, | or ^, so the measured rows in batch.rs stay its guard. tree::descendants (its three hazards have unit tests, and a reachability model would restate the code), host_zone (checked against the system for every year a SYSTEMTIME holds), and the session family of ending.rs, a candidate for step 5, sequences on a live core.

🤖 Generated with Claude Code

… leaves in the registry - and the policy value read by its writer's marker

Step 2e of the random-property plan, the mechanism crate: three properties, each beside its code,
with oracles from a model or from the system itself.

- The command line: whatever the program path and the arguments hold, `CommandLineToArgvW` - the
  system's own reader, imported in the test - reads back the path and every argument unchanged. A
  zero character is refused naming where it stood (R4-N16).
- The WebView2 policy value, on a scratch key of HKCU with the calls production makes: the look a
  session takes before it writes, the write, another session's look, the removal - after each step
  the key holds exactly what the model says.
- The environment block: every entry the session does not name reaches it unit for unit, every
  variable of the session's stands once with its last value, sorted by name without regard to case.

The registry property found two faults, fixed here and named in CHANGELOG.md:

- The first marker of a value was read, and a session puts its own last, after whatever `*` held.
  A `*` carrying a marker made a session's value somebody else's - left in the registry while the
  session said it was removed, or removed by another session while its writer ran - and a broken
  one hid a dead session's value from every later look. The last marker is read.
- A look removed `*` when it carried the marker of a core that is gone. Names no session writes
  under are skipped.

The weekly search gets a mechanism part with its canary, a path for pull requests, and the guard's
floor goes from four places to five. Mutation registry 956 to 961: one entry from the history of
each property (P9, the live-owner scan, R4-N17) and one for each fix, all caught. The anchor of
`r4-15 s15 without surrogate repair` had gone stale in step 2a and is put right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: a5d7bda5-e985-43ab-adf7-941ce42c5f15
📥 Commits

Reviewing files that changed from the base of the PR and between de11436 and 13c4c69.

⛔ Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock, !**/Cargo.lock
📒 Files selected for processing: 9
  • .github/workflows/search.yml
  • CHANGELOG.md
  • crates/cli/tests/weekly_search.rs
  • crates/mech/Cargo.toml
  • crates/mech/src/environment.rs
  • crates/mech/src/lib.rs
  • crates/mech/src/policy_value.rs
  • crates/mech/src/search.rs
  • tests/mutation/entries.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@donislawdev
donislawdev merged commit 44fab76 into main Oct 19, 2026
23 checks passed
@donislawdev
donislawdev deleted the test/property-search-mech branch October 19, 2026 22:14
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