Plectis
This page

Paper module

Cold Clone Probe

The cold-clone probe validates the first public source-root bootstrap path: src import, secret-exclusion scan, first-wave pattern-binding fixture replay, public result record refs, and ignored local result record emission.

Contains 19 sections · 1 diagram · 5 references

The write-up

Probe is first

The probe is the first script a fresh clone runs, checking whether it can bootstrap the first-wave contract from source without leaking anything private. cold_clone_probe is the first script a reader runs after cloning the public checkout. It answers one question: can this clone bootstrap the bounded first-wave contract from source, without leaking anything private, before the reader installs the package or reads the long component inventory?

Imports from src

It imports from src/, checks fixture inputs, scans for secrets, replays the pattern-binding fixture, and writes one ignored local record; a pass proves only the first bounded action. The probe imports the package from src/, checks that the first-wave fixture inputs are present, runs a secret-exclusion scan, replays the pattern-binding fixture, and then writes one small result record. That record is ignored local state, not a tracked artifact. A pass means the first local action from a fresh clone works and stays inside the public boundary. It is not an install proof, a launch proof, or a statement about the rest of the system.

Purpose

Pulling the first-step check to the front

A public checkout must prove its own first step, so the probe pulls the bootstrap check ahead of install or inventory into one command, one record, four typed failure modes. A public checkout has to prove its own first step. If the reader's first action is make install or a long tour of the component inventory, a broken or leaky bootstrap is discovered late and off to the side. The probe pulls that check to the front and makes it concrete: one command, one result record, four typed failure modes.

Why a bare import-and-ok is not enough

A probe that only imports and prints "ok" would pass on missing fixtures, an unavailable scan, or absent result records, so each failure gets a distinct blocked status and code instead. "Loose" here means a probe that only imports the package and prints "ok". That would pass on a clone that is missing its fixtures, or one whose secret scan is unavailable, or one where the pattern-binding result records never materialize. The probe refuses to call any of those a pass. Each is a distinct blocked status with its own code, so the reader learns which part of the bootstrap is wrong.

How it works

run_probe predicate and main wrapper

The proof predicate run_probe runs a fixed sequence and never raises, while the CLI wrapper main parses flags, writes the --emit record, and sets the exit code. The runtime is one file, src/microcosm_core/cold_clone_probe.py. The proof predicate is run_probe(root, suite, emit_ref). It runs a fixed sequence over the checkout root and returns a result dict; it never raises. The CLI wrapper main parses --suite and --emit, calls run_probe on the current directory, writes the returned record, and exits 0 on pass or 1 otherwise. The one file that writes the --emit record is main, not run_probe.

A reproducible command stamp before four gates

run_probe stamps the base record with a reproducible ./bootstrap.sh command quoted through shlex.quote, then walks four gates in order. run_probe builds a metadata-only base record stamped with the reproducible command string from _bootstrap_command(suite, emit_ref), which returns ./bootstrap.sh --suite <suite> --emit <path> with both arguments quoted through shlex.quote. It then walks four gates in order:

Function or constantRole
SUPPORTED_SUITESThe only accepted suite is first-wave; anything else is rejected before fixture or scanner state is touched.
REQUIRED_INPUTSThe four fixture files the first-wave suite needs; each must be a readable file under the root.
validate_secret_exclusion_scanImported scan that must return status == "pass" before any pattern replay runs.
validate_pattern_bindingImported validator that replays the first-wave fixture into a scratch directory under .microcosm/.
_mirror_missing_pattern_receiptsCopies the five PATTERN_RECEIPTS from the scratch run into their canonical clone-root slots.
DEFAULT_EMIT_REFThe default result path, .microcosm/cold_clone_probe.json, which stays ignored local state.

Gate order and result record mirroring

The gates run suite, inputs, secret scan, then replay so the boundary check gates fixture work, after which _mirror_missing_pattern_receipts copies missing result records into their canonical slots. The order matters. run_probe checks the suite first, then REQUIRED_INPUTS, then the secret scan, and only then the pattern-binding replay. The scan runs before replay on purpose: the boundary check gates the fixture work, not the other way around. After validate_pattern_binding writes into the scratch directory, _mirror_missing_pattern_receipts(root_path, source_dir) copies each canonical result record that is absent at the root but present in the scratch output. It skips destinations that already exist and sources that are not files, using _path_exists and _path_is_file, two probes that swallow OSError and report missing rather than crashing on a fresh clone with odd permissions. When it copies the validation-result result record it rewrites that file's receipt_paths field to the canonical PATTERN_RECEIPTS list, so the mirrored record points at the stable slots.

What a pass record carries

A pass record lists the emit path, the five result record refs, and the secret-scan summary with no private bodies, also aliased under private_state_scan for older readers. A pass record lists the emit path first, then the five pattern-binding result record refs, and carries the secret-exclusion scan summary with no private bodies copied in. The scan summary is also exposed under private_state_scan as a compatibility alias for older readers.

Diagram of the mechanism (12 steps).
Fresh public checkoutFresh public checkoutrun_probe(root, suite, emit_ref)run_probe(root, suite, emit_ref)suite in SUPPORTED_SUITES?suite in SUPPORTED_SUITES?blocked_invalid_inputUNKNOWN_COLD_CLONE_SUITEblocked_invalid_input UNKNOWN_COLD_CLONE_SUITEREQUIRED_INPUTS present?REQUIRED_INPUTS present?MISSING_FIXTURE_INPUTMISSING_FIXTURE_INPUTValidate secret exclusion scanValidate secret exclusion scanCOMMAND_UNAVAILABLECOMMAND_UNAVAILABLESECRET_EXCLUSION_SCAN_BLOCKEDSECRET_EXCLUSION_SCAN_BLOCKEDValidate pattern bindingValidate pattern bindingMISSING_PATTERN_BINDING_RECEIPTMISSING_PATTERN_BINDING_RECEIPTstatus passemit ref + five result record refsstatus pass emit ref + five result record refs
Diagram source & refs

Source refs

MISSING_FIXTURE_INPUT
blocked_dependency_missing
Validate secret exclusion scan
validate_secret_exclusion_scan
COMMAND_UNAVAILABLE
blocked_command_unavailable
SECRET_EXCLUSION_SCAN_BLOCKED
blocked_secret_exclusion
Validate pattern binding
validate_pattern_binding + mirror
MISSING_PATTERN_BINDING_RECEIPT
blocked_dependency_missing
flowchart TD A["Fresh public checkout"] --> B["run_probe(root, suite, emit_ref)"] B --> C{"suite in SUPPORTED_SUITES?"} C -- no --> X1["blocked_invalid_input UNKNOWN_COLD_CLONE_SUITE"] C -- yes --> D{"REQUIRED_INPUTS present?"} D -- no --> X2["blocked_dependency_missing MISSING_FIXTURE_INPUT"] D -- yes --> E["validate_secret_exclusion_scan"] E -- raises --> X3["blocked_command_unavailable COMMAND_UNAVAILABLE"] E -- status not pass --> X4["blocked_secret_exclusion SECRET_EXCLUSION_SCAN_BLOCKED"] E -- pass --> F["validate_pattern_binding + mirror"] F -- fail or missing --> X5["blocked_dependency_missing MISSING_PATTERN_BINDING_RECEIPT"] F -- all present --> P["status pass emit ref + five result record refs"]

Negative cases

Run probe never

run_probe never raises. run_probe never raises. Every failure is a typed record the reader can read:

  • blocked_invalid_input with code UNKNOWN_COLD_CLONE_SUITE: the requested suite is not first-wave. It also returns the supported list.
  • blocked_dependency_missing with code MISSING_FIXTURE_INPUT: one or more of REQUIRED_INPUTS is absent. The record names the missing files.
  • blocked_command_unavailable with code COMMAND_UNAVAILABLE: the secret scan raised, so the boundary cannot be checked. The exception text is recorded.
  • blocked_secret_exclusion with code SECRET_EXCLUSION_SCAN_BLOCKED: the scan ran but did not pass. The scan summary is attached, without leaking findings.
  • blocked_dependency_missing with code MISSING_PATTERN_BINDING_RECEIPT: the pattern-binding validator did not pass, or one of the five PATTERN_RECEIPTS is still absent after mirroring. The record names the missing result records.

Prior Art Grounding

Reproducible builds, twelve-factor, clean-checkout CI

The shape borrows from reproducible builds, the twelve-factor dependency rule, and clean-checkout CI, applied to one bounded first action from source. The shape borrows from three public practices. Reproducible builds recreate outputs from declared sources and a constrained environment (reproducible-builds.org). The Twelve-Factor dependency rule declares dependencies rather than relying on ambient system packages (12factor.net). Clean-checkout CI on hosted runners is the common way to prove a fresh clone builds and smoke-tests (GitHub Actions). The probe keeps the clean-checkout, declared-input, gated shape and applies it to one bounded first action from source.

Validation Result record Path

Run ./bootstrap.sh from the public root. Use --dry-run first to print the exact command and the ignored result target without writing anything, then run it for real and check the focused tests:

./bootstrap.sh --dry-run
./bootstrap.sh
PYTHONPATH=src ../repo-pytest \
  tests/test_cold_clone_probe.py \
  tests/test_bootstrap_script.py \
  tests/test_public_entry_docs.py \
  -q --basetemp /tmp/microcosm-cold-clone-probe

The result record and what green pytest means

The normal run writes an ignored result record, and a green pytest line means the predicate, wrapper, and public-entry docs agree, though a pass installs nothing and certifies no launch. The normal run writes ignored .microcosm/cold_clone_probe.json evidence with status=pass, the five public result record refs, and the secret-scan summary. Pass --emit <path> only to refresh an intentional local target; the default stays ignored local state. A green pytest line means the predicate, the root wrapper, and the public-entry docs all agree with the current checkout. These are the validation result records for this module; a pass here does not install the package, certify launch, or aggregate any wider coverage.

Scope boundary

Scope limit

The bounded bootstrap claim and its ceiling

The strongest claim is that a fresh clone can bootstrap the first-wave suite from src/ with typed failure codes; the boundary stops there, authorizing no launch or deployment. The strongest claim the evidence supports: a fresh public clone can bootstrap the first-wave suite from src/, with the fixture inputs present, the secret-exclusion scan passing, the pattern-binding fixture replaying, and all five pattern-binding result records materialized, and it records that with typed failure codes when any step is wrong. The proof boundary stops there. The probe excludes launch, hosted deployment, public sharing, external model access, secret export, package distribution, whole-system equivalence, or whole-system correctness. Its result record is ignored local state, not a tracked claim, and the scope limit for this module is the source-root bootstrap check plus its metadata-only result record. The generated Mermaid and Atlas views are projections of the source record, not independent authority.

Context & evidence

Source

Source Source module: src/microcosm_core/cold_clone_probe.py · Design note · Source registry