mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 19:41:20 -05:00
599a8ee11d
Retain unresolved process identity and launch evidence through retryable cleanup. Share capture path normalization and preserve failed filesystem observations. Bound child output and drain Windows pipes without one-chunk throttling. Reviewed fixes include #1628, #2632, #2644, #2784, #2928, #2931, #2965, #2992, and #3011. Validation: 92 focused source tests passed; four platform-specific skips. Real Windows and Hopper lifecycle coverage was not rerun.
142 lines
3.8 KiB
TypeScript
142 lines
3.8 KiB
TypeScript
import type { JsonValue } from "../jsonValue.js";
|
|
import { digestProcessCommitment } from "./processScenario.js";
|
|
|
|
const normalization = {
|
|
paths: true,
|
|
pids: true,
|
|
ports: true,
|
|
time_bucket_ms: 10,
|
|
patterns: [],
|
|
};
|
|
const scenario = { executable_sha256: "0".repeat(64) };
|
|
const comparisonContract = {};
|
|
|
|
/** Minimal valid process capture retained as a public contract example. */
|
|
export const EMPTY_PROCESS_CAPTURE_EXAMPLE = {
|
|
manifest: {
|
|
rea_version: "1.1.0",
|
|
provider_version: "3",
|
|
platform: "fixture",
|
|
architecture: "fixture",
|
|
pty_backend: "node-pty",
|
|
started_at: "2026-01-01T00:00:00.000Z",
|
|
completed_at: "2026-01-01T00:00:00.001Z",
|
|
scenario,
|
|
comparison_contract: comparisonContract,
|
|
full_scenario_sha256: digestProcessCommitment(scenario),
|
|
comparison_contract_sha256: digestProcessCommitment(comparisonContract),
|
|
selected_executable_sha256: "0".repeat(64),
|
|
executable_sha256: "0".repeat(64),
|
|
executable_identity: {
|
|
state: "path_metadata_unchanged",
|
|
reason: null,
|
|
},
|
|
normalization_sha256: digestProcessCommitment(normalization),
|
|
},
|
|
normalization,
|
|
frames: [],
|
|
rendered_frames: [],
|
|
interaction_events: [],
|
|
exit: { code: 0, signal: null, reason: "exited" },
|
|
settlement: {
|
|
state: "quiesced",
|
|
elapsed_ms: 50,
|
|
cleanup_outcome: "not_required",
|
|
},
|
|
process_samples: [],
|
|
filesystem_checkpoints: [
|
|
{ name: "before", at_ms: 0, files: [], effects: [], truncated: false },
|
|
{
|
|
name: "after_settlement",
|
|
at_ms: 50,
|
|
files: [],
|
|
effects: [],
|
|
truncated: false,
|
|
},
|
|
],
|
|
event_journal: [],
|
|
files_before: [],
|
|
files_after: [],
|
|
filesystem_effects: [],
|
|
truncated: false,
|
|
truncation_details: {
|
|
raw_terminal: {
|
|
budget_bytes: 1_000_000,
|
|
observed_bytes: 0,
|
|
retained_bytes: 0,
|
|
observed_frames: 0,
|
|
retained_frames: 0,
|
|
},
|
|
rendered_terminal: {
|
|
budget_bytes: 1_000_000,
|
|
observed_bytes: 0,
|
|
retained_bytes: 0,
|
|
observed_frames: 0,
|
|
retained_frames: 0,
|
|
},
|
|
filesystem_before: {
|
|
files_limit: 10_000,
|
|
depth_limit: 16,
|
|
enumeration_truncated: false,
|
|
enumeration_reasons: [],
|
|
enumeration_omissions: [],
|
|
hash_budget_bytes: 10_000_000,
|
|
hashed_bytes: 0,
|
|
hash_omissions: [],
|
|
},
|
|
filesystem_after: {
|
|
files_limit: 10_000,
|
|
depth_limit: 16,
|
|
enumeration_truncated: false,
|
|
enumeration_reasons: [],
|
|
enumeration_omissions: [],
|
|
hash_budget_bytes: 10_000_000,
|
|
hashed_bytes: 0,
|
|
hash_omissions: [],
|
|
},
|
|
process: {
|
|
sample_limit: 1_000,
|
|
sampling_partial: false,
|
|
retained_samples: 0,
|
|
sample_limit_reached: false,
|
|
sampling_failures: 0,
|
|
first_sampling_failure: null,
|
|
coverage: "sampled",
|
|
},
|
|
},
|
|
limitations: [],
|
|
residual_unknowns: [],
|
|
cleanup: {
|
|
owned_process_group: "verified",
|
|
temporary_root: "removed",
|
|
},
|
|
} satisfies JsonValue;
|
|
|
|
const finalizedScenario = { ...scenario, finalization_ms: 1_500 };
|
|
const finalizedComparisonContract = { finalization_ms: 1_500 };
|
|
|
|
/** Valid capture of a timeout that finalized: SIGTERM delivered, exit observed. */
|
|
export const FINALIZED_PROCESS_CAPTURE_EXAMPLE = {
|
|
...EMPTY_PROCESS_CAPTURE_EXAMPLE,
|
|
manifest: {
|
|
...EMPTY_PROCESS_CAPTURE_EXAMPLE.manifest,
|
|
scenario: finalizedScenario,
|
|
comparison_contract: finalizedComparisonContract,
|
|
full_scenario_sha256: digestProcessCommitment(finalizedScenario),
|
|
comparison_contract_sha256: digestProcessCommitment(
|
|
finalizedComparisonContract,
|
|
),
|
|
},
|
|
exit: {
|
|
code: null,
|
|
signal: 0,
|
|
reason: "timeout",
|
|
finalization: {
|
|
requested_ms: 1_500,
|
|
elapsed_ms: 12,
|
|
exit_code: 0,
|
|
signals: [{ signal: "SIGTERM", sent_at_ms: 0, delivery: "signaled" }],
|
|
},
|
|
},
|
|
} satisfies JsonValue;
|