Historical local qualification: Source 7cf4b26e focused Core 22/22 and Dashboard 26/26 checks passed. The historical bounded local record keeps their exact scope. Historical source 7cf4b26e passed the 3,286/3,286 full checks and all 36 installed families. Independent bounded local evidence acceptance passed; exact-final-head CI is recorded separately from this frozen local proof. Module-specific and broader limits remain below.
Runs each frozen process check of one sealed Candidate once under the accepted Confined executor and stores at most one sf-repository-observation/1 Evidence record per check under the repository-scope pins Repository Assurance judges. It observes; it never judges, never runs Candidate or base code in its own process, never reads or writes Git and never writes the journal. Beside it, a write-once snapshot store keeps a Slice's frozen fixture inputs.
Status: In progress. The resource-drift correction passed eight focused native cases and independent Source review. All34 earlier combined Collector checks retain their snapshot. Historical 7cf installed/full native execution and independent bounded local evidence acceptance passed under the current review commission. Earlier receipts retain their historical scope. No live Slice or delivery-owner qualification.
- Source:
src/repository-collector.ts - Tests:
test/repository-collector.test.ts(21; real sandboxed processes, with deliberate executor substitutions for attribution, unresolved, refusal and malformed-result controls) and the independent adversarial filetest/repository-collector-adversarial.test.ts(6: other spellings of a readable directory, pins the sealed Candidate was not sealed for, and what the sandbox receives); its import boundary is asserted intest/delivery-boundaries.test.ts. - Resource-drift regression: eight Source cases retain genuine prior Evidence, current observed/unresolved/not-started facts, missing-resource causes, ordinary collection, preflight refusal and native fence priority. The lost-acknowledgement case deliberately throws after a real executor result; it does not prove a physically unkillable process.
- Helper:
test/helpers/collector.ts(an owned bare store with a stub tool, a Candidate sealed from an authored program, fixture inputs, pins, a real Evidence store, executor root and fence hold; the expected stdout is derived on the host and appears in the acceptance only as a digest).
Intelligence: none — Runs frozen checks under pinned source or compiled resources; drift blocks dispatch and attribution. It observes and never judges.
The private collector adoption draft adds compiled resource identities and a standalone consumer. Current acceptance and review evidence: build review. Historical acceptance receipts remain unchanged. New draft evidence is recorded separately.
What it hides
- Candidate-as-program runs. A check of stage
baseruns the base tree B, materialised byte-exactly from the repository snapshot (materialiseBase); a check of stagecandidateruns the exported Candidate M's files. Either tree is only bytes handed toConfinedExecutor.runas its program, with the check'sentryandargs; the input is the one fixture snapshot the check names. Nothing else is given to the sandbox: the expected stdout exists only asstdoutDigestin the frozen acceptance, held by the host. - Validation before anything starts (
TypeError, nothing started or stored): the pins parse; the hold is one this process holds (validatedHoldIdentity) on a fence whoserunIdis the pinned Product; the recipe/collector protocol pair matches this exact source or compiled entry, and the pinnedrecipe.collector.closureiscollectorClosure(), so records are never attributed to other code; the sealed Candidate's canonical manifest hashes topins.candidateDigestand names the pinned store (canonically equal) and Product, Slice id and revision, base and commit, and the digests of the pinned acceptance, recipe and environment records (the bindingsjudgeRepositoryauthenticates, so nothing runs under records the Candidate was not sealed for); the Candidate files, the base (Git tree id recomputed) and every input a process check names give their pinned snapshot digests; the deadline is an ISO timestamp. All bytes are copied at this point, so later changes to the caller's objects change nothing that runs (test "Candidate files changed after sealing…"). - Before each executor process, in this order: the signal is not aborted;
gate.current()says proceed (a refusal, an unreadable gate or a malformed answer makes that check and every later one not-started, and the gate is not asked again; a read still unanswered when the signal aborts or the deadline passes is abandoned, with the same effect and the reason "aborted before the run" or "the deadline … passed while the gate was read"); the hold is still active; installed resources retain their validated bytes and per-operation file identities;describeRuntime()succeeds and the environment record (runtime, profile, platform, node) equals the pinned one;placementProblemfinds no protected path the profile can read; the entry is a file of the stage's tree; program and input fit the executor's 16 MiB (elseoversized); and at least 1 ms remains before the deadline. A resource change rejects the collection before dispatch or new Evidence. Other pre-launch failures become not-started observations with their reason. - One run.
startedAtandendedAtcome from the collector's clock immediately aroundexecutor.run. The effective timeout ismin(recipe timeoutMs, time remaining), and the run's signal also aborts when the deadline passes (AbortSignal.any([signal, AbortSignal.timeout(remaining)])). An executorTypeErroris recorded as not-started, relying on the executor's documented contract that it throwsTypeErroronly before anything is touched; any other throw isunresolved. - At most one record per check. Each completed attempt, started or not, becomes one
ObservationFactsdocument (check, stage, Candidate, status, attributability, problems, the executor's identities, process facts, namespace disposition, output lengths). While ownership and resources remain valid, it is encoded with stdout/stderr and submitted once toEvidenceStore.putwithpins = evidencePinsOf(pins)andobservation = observationOf(facts). A run that did not start, was unresolved, was not attributable, or whose identities differ from the pinned program, input, runtime, profile or bounds (with the effective timeout) carries a collector error;judgeRepositorycan then only find it Inconclusive. In each problem text, control characters U+0000–U+001F and U+007F become?(other characters are kept); each is at most 1,024 characters and there are at most 16. - Placement.
profileReadable(runtime)is what the pinned profile lets a program read: the subtrees/System/Library,/usr/liband the directory of every runtime.dylib(files and aliases), and the individual paths of every runtime file and alias, the executable,/,/dev/null,/dev/randomand/dev/urandom, each as written and as it resolves now.placementProblem(protectedPaths, runtime)takes each protected path as given (the collector keeps it unnormalised, so a..after a symbolic link is resolved by the file system, not removed as text), finds its longest existing prefix, and refuses it when:- it cannot be placed: that prefix cannot be examined or resolved with
realpath(a/.vol/<device>/<inode>path exists but does not resolve), the next component is a link that does not resolve now (dangling, or into/.vol), or a readable path that exists cannot be placed; - by device and inode: the prefix, or any directory above it as the kernel resolves
..(from a Data-volume firmlink such as/System/Volumes/Data/System/Library/Caches,..leads to/System/Library), is a readable subtree; or the whole path exists and is a readable subtree or file, or a directory above one; - by name: as written (normalised) or as the prefix resolves with the rest appended, it equals, lies below or contains a readable subtree, or equals or contains a readable file, compared without regard to case; or it lies under
/System/Volumesor/.vol, whose paths are second names for directories elsewhere. The collector checks itsprotectedPathsthis way at construction (a problem is aTypeError) and again before every executor process, so a path that becomes readable after setup, or during a collection, stops the next launch (tests "a protected path the profile can read…" and "placement compares device and inode…", and the adversarial file's Data-volume,/.voland..rows).
- it cannot be placed: that prefix cannot be examined or resolved with
Public interface
Runtime imports: node:buffer, node:crypto, node:fs, node:path; validatedHoldIdentity from ./attempt-fence.ts; canonicalJson from ./canonical-json.ts; CONFINED_PROFILE, ConfinedExecutor, MAX_SNAPSHOT_BYTES, confinedProfile, describeRuntime and snapshotDigest from ./confined-executor.ts; EvidenceStore from ./evidence.ts; ENVIRONMENT_PROTOCOL, OBSERVATION_FORMAT, RECIPE_PROTOCOL, REPOSITORY_COLLECTOR, REPOSITORY_RESOURCE_MODE, acceptanceDigest, encodeObservation, environmentDigest, evidencePinsOf, listingDigest, observationOf, parseRepositoryPins and recipeDigest from ./repository-assurance.ts. Candidate and snapshot types come from the neutral ./repository-protocol.ts leaf. The test asserts these exact imports, so the collector itself imports no journal, Git, node:child_process or network module; its module graph still loads node:child_process through confined-executor.ts (the sandboxed spawn) but no longer loads Repository's Git implementation: Assurance also imports the pure protocol leaf.
- Constants:
SNAPSHOT_LIMITS = {maxFiles: 256, maxBytes: 15 MiB}(frozen),SNAPSHOT_FORMAT = "sf-delivery-snapshot/1",MAX_PROTECTED_PATHS = 256,COLLECTOR_SOURCES(the eightsrc/files loaded with the collector:attempt-fence.ts,canonical-json.ts,confined-executor.ts,errors.ts,evidence.ts,repository-assurance.ts,repository-collector.ts,repository-protocol.ts; closed under runtime relative imports, asserted by test).COMPILED_COLLECTOR_RESOURCESlists the corresponding eight actual.jsfiles, andCOLLECTOR_RESOURCE_MODEissourceorcompiled. new RepositoryCollector({store: EvidenceStore, executor: ConfinedExecutor, protectedPaths: string[], now?: () => Date}):protectedPathsis 1–256 absolute paths the Candidate must never read (the journal, every delivery directory, registered checkouts and their common directories, fixture input directories, the operator's answer key), kept as given. The constructor refuses (TypeError) a listplacementProblemfinds a problem with now, or any list when the runtime cannot be described to place it; placement is decided again before every launch.collect(request: CollectRequest, gate: CollectGate, hold: FenceHold, signal: AbortSignal): Promise<CollectResult>:CollectRequest {pins, sealed: SealedCandidate, base: SourceSnapshot, inputs: ReadonlyMap<listing digest, SnapshotFile[]>, deadline};CollectGate {current(): Promise<{proceed: true} | {proceed: false; reason}>}.CollectResult {runs, evidence, environmentBefore, environmentAfter}: oneCollectedRun {check, evidence: string | null, status: "observed" | "unresolved" | "not-started" | "storage-failed", identities, problems, diagnostics: readonly CollectorDiagnostic[]}per process check in acceptance order (before, after, guardrails; review checks are reserved and never run), the stored ids in run order, and the environment record at the start and end (nullwhen the runtime could not be described).
CollectorResourceDriftError {code: "resource-drift", progress, cause}: diagnostic rejection atbefore-launchorbefore-evidence.CollectorResourceDriftProgressretains the check ID, original parsed pins, exact completed-run prefix, acknowledged Evidence IDs, currentunwrittenObservation(facts and copied stdout/stderr, or null), unenterednotAttemptedsuffix and originalenvironmentBefore. It is not aCollectResult, Verdict or resume token.currentEnvironment(): EnvironmentRecord:{protocol: "sf-confined-environment/1", runtime: describeRuntime().digest, profile: confinedProfile().digest, platform: "<platform>/<arch>", node: <version>}; throws when the runtime cannot be described.profileReadable(runtime),placementProblem(protectedPaths, runtime): string | undefined: as above; both take adescribeRuntime()result.materialiseBase(snapshot, {commit, tree}): {files, listing: BaseListing}: byte-exact, frozen; each file's UTF-8 bytes must give its recorded size, SHA-256 and Git blob id, paths must be in order, and the Git tree built from them must betreeatcommit.listingDigest(listing.files)equalssnapshotDigest(files).collectorClosure(): string:"sha256:"of canonical{collector, files: [{path, sha256}]}. Source mode preserves/1andsrc/<name>.ts; compiled mode uses/2anddist/<name>.js. It refuses absent, linked, non-regular or concurrently replaced files. Every hash uses a no-follow descriptor and stable device/inode/size/timestamps; every launch and Evidence write rechecks the held resource witness.SnapshotStore(root):put(files, expected): SnapshotManifestandread(digest): SnapshotFile[];SnapshotError {code: "missing" | "corrupt" | "conflict" | "unavailable"}. See the invariants.
Invariants and guarantees
- At most one process per check, one record per run. No retry, no second attempt in the same collection, and no fallback to anything but the pinned executor. The stored ids are exactly the Evidence store's new objects (tests count them).
- Only the pinned trees run. The base run's program digest is
pins.baseSnapshot, the Candidate'spins.candidateSnapshot, both checked on private copies before the first run and recorded by the executor. - Collector errors are never outcomes. Every refusal before launch, executor refusal (a full root is
retained-limit), namespace change, identity difference, unresolved or thrown executor, stopped run (timeout, output limit, abort) and deadline overrun is a record the judge rejects or finds inconclusive; tests show each givesInconclusive, neverVerifiedorFailed. - The hold bounds storage. The hold is asserted before every executor process (after the gate read) and before every
put. Once it has ended, nothing further is started or stored andcollectrejects withFenceErrorreleased; records stored earlier stand and are inert (theirattemptIdis this epoch's). - Storage failure stops the collection. A record that cannot be encoded or stored makes that run
storage-failed; nothing further is started or stored and later checks are reported not-started with evidencenull. The composition must then issue no Verdict for this epoch (spec V6/V8). - Deadline. Checked before each launch; the recorded
timeoutMsis the effective one, which the executor enforced (its identities carry it), so a capped run still qualifies; a run whoseendedAtby the collector's clock is past the deadline never does. - Hostile Candidates (test "a hostile Candidate…"): reads of the answer key, the Evidence store, the repository's config, the fence and a canary beside them; listings of those directories, the executor root, the home directory and its own namespace's parent; and writes into the Evidence store, the executor root and the scenario directory are all denied (
EPERM); no canary bytes reach any record; a forged observation header printed on stdout stays inside the stdout bytes, after the collector's own facts. A runtime library directory is readable, which is why protected paths may not be placed there. - Snapshot store (
<root>=<snapshots>/<productId>, created0700):putrefuses, withTypeErrorbefore any write, files that do not giveexpected, more than 256 files or 15 MiB, or anything the executor's snapshot rules refuse. It writes<root>/tmp-<hex>(O_EXCL,0400, fsynced; a leftover temporary from an interrupted put is replaced, never adopted), publishes it with a non-replacinglinkto<root>/<hex>, removes the temporary name and fsyncs the directory. An equal entry replays; different bytes under the name areconflict. The file holdssf-delivery-snapshot/1\n<length>\n<canonical SnapshotManifest>and the files' bytes in path order; the manifest is exactly whatDeliveryLedger.recordSnapshotManifestaccepts.readopens without following links, re-hashes every file and recomputes the digest; anything else iscorruptand is never repaired. A root that is not a canonical private directory of this user isunavailable.
Result diagnostics
Each CollectedRun exposes a frozen, unique diagnostics array of CollectorDiagnostic codes. These are result-only facts: they are not written into ObservationFacts, Evidence bytes, metadata or Verdicts, and give no permission to retry.
Codes distinguish deadline, cancelled, gate-refused, collector-refused, executor-refused, execution-unresolved and storage-failed. Observed executor facts can also report timeout, output-limit, limits-mismatch, control-malformed, process-signalled, identities-mismatch or unattributable. Success can have no diagnostic. The codes contain no free-text errors or Candidate output. A signal does not identify an out-of-memory cause.
Later checks skipped after a collection halt retain that halt's category. Native fence refusal and resource-drift errors retain their existing identity, priority and progress; they are not converted into results. Judgement reads the original Evidence contract, never these codes. Changing current collector source or emitted bytes changes its resource closure; old recipes and receipts remain unchanged and grant no new dispatch authority.
The parallel-help qualification records source, installed and independent qualification separately. No live Slice is qualified by this correction.
Failure semantics
TypeError for invalid options, requests, pins, Candidate/snapshot binding, foreign or fabricated holds and invalid initial resources remains a preflight refusal before collection launches or stores anything.
After preparation, resource revalidation failure throws CollectorResourceDriftError, including missing/unreadable files with their original native cause. Earlier acknowledged Evidence IDs and run statuses remain in progress. At the pre-Evidence boundary, the current observation remains unwritten; its observed, unresolved or not-started status is preserved. Only the unentered suffix is listed as notAttempted; no unknown run becomes known not-started. The error stops further launch/storage and issues no Verdict or retry permission.
The current observation's facts are diagnostic only: even attributable: true reflects the executor observation before collector resource qualification completed, not valid Evidence. Collector-produced progress containers/arrays and its current facts object are shallow-frozen; nested facts keep existing guarantees and output arrays are mutable private copies. The public error constructor can accept caller-created progress and is not an authenticity boundary. Only genuine Evidence-store readback supplies its existing record brand.
The preceding hold check retains priority: a released hold still throws its native FenceError without this progress payload. A caller clock that throws or becomes invalid after effects can also reject outside the resource checks, including with TypeError. Do not infer “nothing started” from an arbitrary rejection or error class. No new clock, ownership or recovery policy is introduced. Storage failure retains its existing storage-failed result; SnapshotError remains the snapshot-store storage error.
Trust scope
- Established locally: the rules above on this Mac (darwin/arm64, Node 26.8.1, the pinned profile), with real owned bare stores, real sealed Candidates, the real executor and Evidence store, and real fence holds.
- Not established: any composition (the gate reads, re-exports around a collection and the Verdict are increment 4); protection from a hard link to a protected file placed where the profile can read (identities are compared for directories above a path and for the path itself, not searched for other names), from a component created between one placement check and the launch it guards (the next check catches it), or from a writer with access to the protected paths (the collector's facts are attribution, not authentication); an executor that throws
TypeErrorafter starting something (recorded as not-started, still Inconclusive); stopping a run when the hold ends mid-run (the run completes, then nothing is stored); a check after an await undoing a write already in progress when the hold ended; stopping later checks after an unresolved run (each launches under the same pre-launch rules); a snapshot store shared by concurrent writers (one writer, the owner, at a time).
Composition
- Depends on: Confined executor (
run,describeRuntime,confinedProfile,snapshotDigest), Evidence / Assurance (EvidenceStore.put), Repository Assurance (pins, observation encoding,listingDigest), Attempt fence (validatedHoldIdentity,FenceHold), Command journal's canonical JSON, and shared neutral Candidate/snapshot types inrepository-protocol.ts. Repository and delivery-records reexport their previous type names; the collector has no dependency on their implementations. - Used by: nothing in
src/yet. The delivery composition (step 1, increment 4) is to re-export the Candidate before and aftercollect, pass the gate's current state as theCollectGate, judge{pins, evidence: runs with a record as {ref, check}}withjudgeRepository, retain original Attempt facts and issue no Verdict when storage, resources, environment or Candidate validation prevents a complete proof.
Changing it safely
- Run
node --test test/repository-collector.test.ts test/repository-collector-adversarial.test.ts, thentest/repository-assurance.test.tsandtest/delivery-boundaries.test.ts, thennpm run check. - Any change to a file in
COLLECTOR_SOURCESchangescollectorClosure(): old pins refuse new dispatch. New work needs a freshly verified recipe and Slice revision; historical Verdicts still rejudge with their original records and pins. - Keep the placement subtrees in step with the executor's
PROFILE_TEMPLATE; never narrow the rule without a new boundary review.
Recipe compatibility
The pinned runtime closure contains repository-protocol.ts instead of repository.ts. A change to the protocol leaf changes the closure; a change confined to Repository's Git implementation does not. The import-closure test checks the complete runtime graph. repository-protocol.ts now also carries the neutral FileEdit/Proposal types that Producers import; that type-only addition changed its source hash and so the source-mode collector closure, and source recipes pinned to the earlier closure are refused. The draft evidence records the compiled repository-protocol.js and compiled closure as unchanged.
An old recipe retains its old closure and is refused for new collection. Do not rewrite its pin or frozen Slice. New execution needs a freshly verified recipe and a new Slice revision. Historical evidence remains historical; this refactor migrates no stored recipe.
Private compiled adoption draft
The package exposes software-factory/repository-collector and software-factory/repository-assurance, using the shared Evidence/fence/executor modules. Node development declarations are explicit. The compiler proves the exact eight-file emitted runtime closure; no Repository, Product gate or Factory implementation is bundled through their former type imports.
The actual-tarball consumer checks useful execution and output failure, genuine store branding, missing/corrupt Evidence, cross-Product and ownership refusal, cancellation, all eight resource mutation/absence/link/replacement cases, and a fresh controller rejudging old proof without dispatch. Its Candidate is a caller-supplied canonical data contract, not a grant of Git integration authority. Collection has no durable replay policy of its own.
These file checks assume trusted installed controller code. They cannot authenticate a modified installation, freeze already-loaded JavaScript or remove a filesystem race after a final check. Drift while a child runs prevents new Evidence but cannot reverse that launch. Pure historical rejudgement remains distinct from permission to execute with current resources.
The resource-drift correction changes current Source and emitted collector bytes/declarations. Earlier package receipts do not qualify it; the eight runtime resource names and existing observation/recipe protocols remain unchanged. Preserve every old receipt, pin and historical record.
