dsh-triage 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +435 -6
- package/dist/cli.js.map +1 -1
- package/dist/outcomes/config.d.ts +96 -0
- package/dist/outcomes/config.d.ts.map +1 -0
- package/dist/outcomes/config.js +175 -0
- package/dist/outcomes/config.js.map +1 -0
- package/dist/outcomes/prior.d.ts +34 -0
- package/dist/outcomes/prior.d.ts.map +1 -0
- package/dist/outcomes/prior.js +55 -0
- package/dist/outcomes/prior.js.map +1 -0
- package/dist/outcomes/purge.d.ts +71 -0
- package/dist/outcomes/purge.d.ts.map +1 -0
- package/dist/outcomes/purge.js +166 -0
- package/dist/outcomes/purge.js.map +1 -0
- package/dist/outcomes/store.d.ts +102 -0
- package/dist/outcomes/store.d.ts.map +1 -0
- package/dist/outcomes/store.js +230 -0
- package/dist/outcomes/store.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prior.js","sourceRoot":"","sources":["../../src/outcomes/prior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAqD,MAAM,kBAAkB,CAAA;AAC3H,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEhE;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAM7B;IACC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC1G,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,I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AG,CAAC,OAAO,UAAU,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,SAAS,MAAM,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,WAAW,KAAK,CAAC,GAAG,CAAC,UAAU,MAAM,KAAK,CAAC,GAAG,CAAC,YAAY,QAAQ,KAAK,CAAC,CAAC,MAAM,MAAM,eAAe,QAAQ,gBAAgB,SAAS,cAAc,IAAI,IAAI,CAAA;AAC/R,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `outcomes --purge` and `outcomes --status` (spec §11).
|
|
3
|
+
*
|
|
4
|
+
* THE ONLY DELETION PATH IN THE PRODUCT, AND ITS RULES:
|
|
5
|
+
* - it works whether or not recording is enabled: deleting must never require opting in;
|
|
6
|
+
* - it never creates anything. Purging a store that does not exist is a no-op with exit 0,
|
|
7
|
+
* not an implicit mkdir (control N5);
|
|
8
|
+
* - it enumerates the directory and deletes what this tool owns, so a file added in a
|
|
9
|
+
* later version is deleted too; anything NOT owned is left alone and listed in
|
|
10
|
+
* `remaining[]` (control N6 asserts the list is empty when we are the only writer);
|
|
11
|
+
* - its output never contains a record, a package name or a path: this is the text most
|
|
12
|
+
* likely to be pasted into an issue (control N13);
|
|
13
|
+
* - twice in a row is fine: the second run reports `noop: true` and `deleted_records: 0`.
|
|
14
|
+
*
|
|
15
|
+
* No network client is imported here, and none may ever be (spec §12).
|
|
16
|
+
*/
|
|
17
|
+
import { type OutcomeMode } from './config.js';
|
|
18
|
+
export interface PurgeReport {
|
|
19
|
+
readonly schema_version: 1;
|
|
20
|
+
readonly purge: {
|
|
21
|
+
readonly noop: boolean;
|
|
22
|
+
readonly deleted_records: number;
|
|
23
|
+
readonly deleted_files: readonly string[];
|
|
24
|
+
/** Lines that were already unreadable; they are deleted with the file, never repaired. */
|
|
25
|
+
readonly rejected_lines_dropped: number;
|
|
26
|
+
readonly directory_removed: boolean;
|
|
27
|
+
/** Entries we do not own, as basenames only. Empty means nothing of ours (or theirs) is left. */
|
|
28
|
+
readonly remaining: readonly string[];
|
|
29
|
+
};
|
|
30
|
+
readonly store_root_exists: boolean;
|
|
31
|
+
readonly at: string;
|
|
32
|
+
}
|
|
33
|
+
export type PurgeResult = {
|
|
34
|
+
readonly ok: true;
|
|
35
|
+
readonly report: PurgeReport;
|
|
36
|
+
} | {
|
|
37
|
+
readonly ok: false;
|
|
38
|
+
readonly detail: string;
|
|
39
|
+
};
|
|
40
|
+
export interface StatusReport {
|
|
41
|
+
readonly schema_version: 1;
|
|
42
|
+
readonly mode: OutcomeMode;
|
|
43
|
+
readonly records: number;
|
|
44
|
+
readonly rejected_lines: number;
|
|
45
|
+
readonly oldest_at: string | null;
|
|
46
|
+
readonly newest_at: string | null;
|
|
47
|
+
readonly store_root_exists: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Delete the store.
|
|
51
|
+
*
|
|
52
|
+
* `directory_removed` means "the directory is not there any more", which is true both when we
|
|
53
|
+
* removed it and when it never existed - the invariant triple (§11) is
|
|
54
|
+
* `remaining == []` + `directory_removed == true` + `store_root_exists == false`, and `noop`
|
|
55
|
+
* is what tells the two cases apart.
|
|
56
|
+
*/
|
|
57
|
+
export declare function purgeOutcomes(options: {
|
|
58
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
59
|
+
readonly platform?: string;
|
|
60
|
+
readonly at: string;
|
|
61
|
+
}): PurgeResult;
|
|
62
|
+
/** `outcomes --status`: how many records exist, and how many lines were unreadable. */
|
|
63
|
+
export declare function outcomeStatus(options: {
|
|
64
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
65
|
+
readonly platform?: string;
|
|
66
|
+
}): StatusReport;
|
|
67
|
+
/** Text rendering of a purge, with no record content, no package name and no path (§11). */
|
|
68
|
+
export declare function renderPurge(report: PurgeReport): string;
|
|
69
|
+
/** Text rendering of a status line. Counts only. */
|
|
70
|
+
export declare function renderStatus(report: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AG,IAAI,CAAA;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAA;CACpC;AAID;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAC3D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CACpB,GAAG,WAAW,CAkFd;AAED,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAC3D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAC3B,GAAG,YAAY,CA4Bf;AAED,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAmBvD;AAED,oDAAoD;AACpD,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAGzD"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `outcomes --purge` and `outcomes --status` (spec §11).
|
|
3
|
+
*
|
|
4
|
+
* THE ONLY DELETION PATH IN THE PRODUCT, AND ITS RULES:
|
|
5
|
+
* - it works whether or not recording is enabled: deleting must never require opting in;
|
|
6
|
+
* - it never creates anything. Purging a store that does not exist is a no-op with exit 0,
|
|
7
|
+
* not an implicit mkdir (control N5);
|
|
8
|
+
* - it enumerates the directory and deletes what this tool owns, so a file added in a
|
|
9
|
+
* later version is deleted too; anything NOT owned is left alone and listed in
|
|
10
|
+
* `remaining[]` (control N6 asserts the list is empty when we are the only writer);
|
|
11
|
+
* - its output never contains a record, a package name or a path: this is the text most
|
|
12
|
+
* likely to be pasted into an issue (control N13);
|
|
13
|
+
* - twice in a row is fine: the second run reports `noop: true` and `deleted_records: 0`.
|
|
14
|
+
*
|
|
15
|
+
* No network client is imported here, and none may ever be (spec §12).
|
|
16
|
+
*/
|
|
17
|
+
import { existsSync, readdirSync, rmdirSync, unlinkSync } from 'node:fs';
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
import process from 'node:process';
|
|
20
|
+
import { errorCodeOf, readOutcomeConfig, resolveStoreRoot, STORE_OWNED_FILES, } from './config.js';
|
|
21
|
+
import { readOutcomeRecords } from './store.js';
|
|
22
|
+
const isOwned = (name) => STORE_OWNED_FILES.includes(name);
|
|
23
|
+
/**
|
|
24
|
+
* Delete the store.
|
|
25
|
+
*
|
|
26
|
+
* `directory_removed` means "the directory is not there any more", which is true both when we
|
|
27
|
+
* removed it and when it never existed - the invariant triple (§11) is
|
|
28
|
+
* `remaining == []` + `directory_removed == true` + `store_root_exists == false`, and `noop`
|
|
29
|
+
* is what tells the two cases apart.
|
|
30
|
+
*/
|
|
31
|
+
export function purgeOutcomes(options) {
|
|
32
|
+
const env = options.env ?? process.env;
|
|
33
|
+
const platform = options.platform ?? process.platform;
|
|
34
|
+
const located = resolveStoreRoot(env, platform);
|
|
35
|
+
// An unresolvable store location is indistinguishable from "nothing of ours is there".
|
|
36
|
+
if (!located.ok) {
|
|
37
|
+
return {
|
|
38
|
+
ok: true,
|
|
39
|
+
report: {
|
|
40
|
+
schema_version: 1,
|
|
41
|
+
purge: {
|
|
42
|
+
noop: true,
|
|
43
|
+
deleted_records: 0,
|
|
44
|
+
deleted_files: [],
|
|
45
|
+
rejected_lines_dropped: 0,
|
|
46
|
+
directory_removed: true,
|
|
47
|
+
remaining: [],
|
|
48
|
+
},
|
|
49
|
+
store_root_exists: false,
|
|
50
|
+
at: options.at,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const root = located.root;
|
|
55
|
+
if (!existsSync(root)) {
|
|
56
|
+
return {
|
|
57
|
+
ok: true,
|
|
58
|
+
report: {
|
|
59
|
+
schema_version: 1,
|
|
60
|
+
purge: {
|
|
61
|
+
noop: true,
|
|
62
|
+
deleted_records: 0,
|
|
63
|
+
deleted_files: [],
|
|
64
|
+
rejected_lines_dropped: 0,
|
|
65
|
+
directory_removed: true,
|
|
66
|
+
remaining: [],
|
|
67
|
+
},
|
|
68
|
+
store_root_exists: false,
|
|
69
|
+
at: options.at,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const read = readOutcomeRecords(root);
|
|
75
|
+
const deletedFiles = [];
|
|
76
|
+
for (const entry of readdirSync(root, { withFileTypes: true })) {
|
|
77
|
+
if (!entry.isFile() || !isOwned(entry.name))
|
|
78
|
+
continue;
|
|
79
|
+
unlinkSync(join(root, entry.name));
|
|
80
|
+
deletedFiles.push(entry.name);
|
|
81
|
+
}
|
|
82
|
+
const remaining = readdirSync(root, { withFileTypes: true })
|
|
83
|
+
.map((entry) => entry.name)
|
|
84
|
+
.sort();
|
|
85
|
+
let directoryRemoved = false;
|
|
86
|
+
if (remaining.length === 0) {
|
|
87
|
+
rmdirSync(root);
|
|
88
|
+
directoryRemoved = true;
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
ok: true,
|
|
92
|
+
report: {
|
|
93
|
+
schema_version: 1,
|
|
94
|
+
purge: {
|
|
95
|
+
noop: false,
|
|
96
|
+
deleted_records: read.records.length,
|
|
97
|
+
// Basenames only: this object is the most pasteable thing we print (§11).
|
|
98
|
+
deleted_files: deletedFiles.sort(),
|
|
99
|
+
rejected_lines_dropped: read.rejected,
|
|
100
|
+
directory_removed: directoryRemoved,
|
|
101
|
+
remaining,
|
|
102
|
+
},
|
|
103
|
+
store_root_exists: existsSync(root),
|
|
104
|
+
at: options.at,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
// A permission problem is a failure (exit 1), not a silent "gone".
|
|
110
|
+
return { ok: false, detail: errorCodeOf(error) };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** `outcomes --status`: how many records exist, and how many lines were unreadable. */
|
|
114
|
+
export function outcomeStatus(options) {
|
|
115
|
+
const env = options.env ?? process.env;
|
|
116
|
+
const platform = options.platform ?? process.platform;
|
|
117
|
+
const reading = readOutcomeConfig(env, platform);
|
|
118
|
+
if (reading.root === null) {
|
|
119
|
+
return {
|
|
120
|
+
schema_version: 1,
|
|
121
|
+
mode: reading.mode,
|
|
122
|
+
records: 0,
|
|
123
|
+
rejected_lines: 0,
|
|
124
|
+
oldest_at: null,
|
|
125
|
+
newest_at: null,
|
|
126
|
+
store_root_exists: false,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const read = readOutcomeRecords(reading.root);
|
|
130
|
+
const timestamps = read.records.map((record) => record.at).sort();
|
|
131
|
+
return {
|
|
132
|
+
schema_version: 1,
|
|
133
|
+
mode: reading.mode,
|
|
134
|
+
// Only validated lines count as records; bad lines are reported separately so they never
|
|
135
|
+
// inflate the number the user reads as "how much did you keep about me".
|
|
136
|
+
records: read.records.length,
|
|
137
|
+
rejected_lines: read.rejected,
|
|
138
|
+
oldest_at: timestamps[0] ?? null,
|
|
139
|
+
newest_at: timestamps.at(-1) ?? null,
|
|
140
|
+
store_root_exists: existsSync(reading.root),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** Text rendering of a purge, with no record content, no package name and no path (§11). */
|
|
144
|
+
export function renderPurge(report) {
|
|
145
|
+
const files = report.purge.deleted_files.length;
|
|
146
|
+
const records = report.purge.deleted_records;
|
|
147
|
+
const head = report.purge.noop
|
|
148
|
+
? 'purged 0 outcome records · 0 files · nothing was there'
|
|
149
|
+
: `purged ${records} outcome record${records === 1 ? '' : 's'} · ${files} file${files === 1 ? '' : 's'} · ${report.purge.directory_removed ? 'directory removed' : 'directory kept'}`;
|
|
150
|
+
/*
|
|
151
|
+
* The count, not the names: `remaining[]` in `--json` lists the basenames because the spec
|
|
152
|
+
* asks for it, but the human text stays a count so that a paste into an issue cannot carry
|
|
153
|
+
* a file name the user chose (control N13 is stricter than "no paths").
|
|
154
|
+
*/
|
|
155
|
+
const kept = report.purge.remaining.length;
|
|
156
|
+
const store = report.store_root_exists || kept > 0
|
|
157
|
+
? `store kept (${kept} file${kept === 1 ? '' : 's'} not ours)`
|
|
158
|
+
: 'store absent';
|
|
159
|
+
return `${head}\n${store}\n`;
|
|
160
|
+
}
|
|
161
|
+
/** Text rendering of a status line. Counts only. */
|
|
162
|
+
export function renderStatus(report) {
|
|
163
|
+
const window = report.oldest_at === null ? '' : ` · ${report.oldest_at} … ${report.newest_at}`;
|
|
164
|
+
return `outcomes ${report.mode} · ${report.records} record(s) · ${report.rejected_lines} unreadable line(s)${window}\n`;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=purge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purge.js","sourceRoot":"","sources":["../../src/outcomes/purge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAElB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AA8B/C,MAAM,OAAO,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAE3E;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,OAI7B;IACC,MAAM,GAAG,GAAG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
|
|
3
|
+
*
|
|
4
|
+
* WHAT THIS FILE IS ALLOWED TO DO: turn a verdict this process already computed into ONE
|
|
5
|
+
* line of `outcomes.jsonl`, through `sanitizeOutcome`, and append it. Nothing else.
|
|
6
|
+
*
|
|
7
|
+
* WHAT IT MUST NEVER DO:
|
|
8
|
+
* - change a `conclusion`, a `confidence` or an exit code. Recording is a side channel; a
|
|
9
|
+
* failed write prints one line on stderr and the command returns what it would have
|
|
10
|
+
* returned anyway (control N14).
|
|
11
|
+
* - write anything when the mode is `off` - not even `mkdir` (controls N1 / N4 / N6).
|
|
12
|
+
* - hold paths, usernames, env values, log tails or free text: the record is built from the
|
|
13
|
+
* whitelist in `@dsh-triage/core` and validated by `sanitizeOutcome` before it is written,
|
|
14
|
+
* so a mistake here is a rejected record, not a leak.
|
|
15
|
+
* - lock the file. `O_APPEND` + one `write` per line + a 1024-byte cap is the whole
|
|
16
|
+
* concurrency story, and a lock file would survive a purge (controls N11 / N6).
|
|
17
|
+
*
|
|
18
|
+
* No network client is imported here, and none may ever be (spec §12).
|
|
19
|
+
*/
|
|
20
|
+
import { type Conclusion, type EnvFingerprint, type OutcomeArch, type OutcomeKey, type OutcomeOs, type OutcomeProfileKind, type OutcomeRecord, type OutcomeSource, type TimingBucket, type Verdict } from '@dsh-triage/core';
|
|
21
|
+
import { type OutcomeMode } from './config.js';
|
|
22
|
+
/** One command may add at most this many records; `probe` is structurally one (§9). */
|
|
23
|
+
export declare const MAX_RECORDS_PER_RUN = 200;
|
|
24
|
+
/** One subject to record. `version` is the exact version; `null` means "cannot key it". */
|
|
25
|
+
export interface OutcomeSubject {
|
|
26
|
+
readonly verdict: Verdict;
|
|
27
|
+
readonly version: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface ProbeFacts {
|
|
30
|
+
/** Sum of the probe's step durations, in ms. Bucketed before it is written (§3.2). */
|
|
31
|
+
readonly totalMs: number | null;
|
|
32
|
+
/** Spawn → first sample, in ms. Bucketed; `null` for a surface without HTTP + render. */
|
|
33
|
+
readonly bootMs: number | null;
|
|
34
|
+
/** The profile name the run measured, so `profile_kind` is about the measured surface. */
|
|
35
|
+
readonly profile: string;
|
|
36
|
+
}
|
|
37
|
+
export interface RecordOutcomesInput {
|
|
38
|
+
readonly source: OutcomeSource;
|
|
39
|
+
readonly subjects: readonly OutcomeSubject[];
|
|
40
|
+
/** ISO timestamp from the caller (`--stamp`), never a clock read here (§5.4). */
|
|
41
|
+
readonly at: string;
|
|
42
|
+
/** Only for `source: 'probe'`. */
|
|
43
|
+
readonly probe: ProbeFacts | null;
|
|
44
|
+
/** `--outcomes off|local`: per-invocation override, never persisted. */
|
|
45
|
+
readonly flag: OutcomeMode | null;
|
|
46
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
47
|
+
readonly platform?: string;
|
|
48
|
+
readonly stderr: (line: string) => void;
|
|
49
|
+
/** Test seam for the random id; production always uses 16 CSPRNG bytes. */
|
|
50
|
+
readonly idFactory?: () => string;
|
|
51
|
+
}
|
|
52
|
+
export interface OutcomeRecordingReport {
|
|
53
|
+
readonly mode: OutcomeMode;
|
|
54
|
+
readonly root: string | null;
|
|
55
|
+
readonly written: number;
|
|
56
|
+
readonly rejected: number;
|
|
57
|
+
readonly skipped: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Platform → outcome vocabulary. `other` is a real value, not a failure: the key must be
|
|
61
|
+
* exact, and inventing `linux` for an unknown platform would merge two different worlds.
|
|
62
|
+
*/
|
|
63
|
+
export declare function outcomeOsOf(platform: string): OutcomeOs;
|
|
64
|
+
export declare function outcomeArchOf(arch: string): OutcomeArch;
|
|
65
|
+
export declare function nodeMajorOf(version: string): number;
|
|
66
|
+
/**
|
|
67
|
+
* Which surface a profile has (spec §2's seventh position).
|
|
68
|
+
*
|
|
69
|
+
* The profile NAME is the only evidence available here, so an unrecognised name becomes
|
|
70
|
+
* `unknown` - and an `unknown` profile kind never matches a prior (§2).
|
|
71
|
+
*/
|
|
72
|
+
export declare function profileKindOf(profile: string): OutcomeProfileKind;
|
|
73
|
+
/** Coarse timing bucket. The boundaries are fixed at 5s / 20s / 60s (`ADR-0006`). */
|
|
74
|
+
export declare function timingBucketOf(ms: number | null): TimingBucket | null;
|
|
75
|
+
/** The seven-tuple for a verdict computed on this machine. */
|
|
76
|
+
export declare function outcomeKeyFor(verdict: Verdict, version: string | null): OutcomeKey;
|
|
77
|
+
/** The same tuple for a candidate named without a verdict (the prior path). */
|
|
78
|
+
export declare function outcomeKeyOfEnv(env: EnvFingerprint, packageName: string, version: string | null): OutcomeKey;
|
|
79
|
+
/**
|
|
80
|
+
* Record the verdicts of one command. NEVER throws and never changes what the command
|
|
81
|
+
* returns: every failure ends in one stderr line.
|
|
82
|
+
*/
|
|
83
|
+
export declare function recordOutcomes(input: RecordOutcomesInput): OutcomeRecordingReport;
|
|
84
|
+
export interface ReadOutcomesResult {
|
|
85
|
+
readonly records: readonly OutcomeRecord[];
|
|
86
|
+
/** Lines that failed validation. Counted, never repaired and never surfaced as records. */
|
|
87
|
+
readonly rejected: number;
|
|
88
|
+
/** Complete lines seen (valid + rejected), so "0 records" is distinguishable from "no file". */
|
|
89
|
+
readonly lines: number;
|
|
90
|
+
/** Whether `outcomes.jsonl` could be read at all. */
|
|
91
|
+
readonly read: boolean;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Read the store back for counting (status, purge, prior).
|
|
95
|
+
*
|
|
96
|
+
* A line that fails `assertOutcomeLine` is skipped and counted: one corrupted line must not
|
|
97
|
+
* destroy a library, and it must never look like a record either (spec §6 runtime row).
|
|
98
|
+
*/
|
|
99
|
+
export declare function readOutcomeRecords(root: string): ReadOutcomesResult;
|
|
100
|
+
/** Counts by conclusion, for `outcomes --status` and for the recorded (artifact) summaries. */
|
|
101
|
+
export declare function countConclusions(records: readonly OutcomeRecord[]): Record<Conclusion, number>;
|
|
102
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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AC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAA;IAC1C,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,gGAAgG;IAChG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAsBnE;AAED,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAI9F"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append-only local outcome store (spec §8 / §9).
|
|
3
|
+
*
|
|
4
|
+
* WHAT THIS FILE IS ALLOWED TO DO: turn a verdict this process already computed into ONE
|
|
5
|
+
* line of `outcomes.jsonl`, through `sanitizeOutcome`, and append it. Nothing else.
|
|
6
|
+
*
|
|
7
|
+
* WHAT IT MUST NEVER DO:
|
|
8
|
+
* - change a `conclusion`, a `confidence` or an exit code. Recording is a side channel; a
|
|
9
|
+
* failed write prints one line on stderr and the command returns what it would have
|
|
10
|
+
* returned anyway (control N14).
|
|
11
|
+
* - write anything when the mode is `off` - not even `mkdir` (controls N1 / N4 / N6).
|
|
12
|
+
* - hold paths, usernames, env values, log tails or free text: the record is built from the
|
|
13
|
+
* whitelist in `@dsh-triage/core` and validated by `sanitizeOutcome` before it is written,
|
|
14
|
+
* so a mistake here is a rejected record, not a leak.
|
|
15
|
+
* - lock the file. `O_APPEND` + one `write` per line + a 1024-byte cap is the whole
|
|
16
|
+
* concurrency story, and a lock file would survive a purge (controls N11 / N6).
|
|
17
|
+
*
|
|
18
|
+
* No network client is imported here, and none may ever be (spec §12).
|
|
19
|
+
*/
|
|
20
|
+
import { randomBytes } from 'node:crypto';
|
|
21
|
+
import { appendFileSync, mkdirSync, readFileSync } from 'node:fs';
|
|
22
|
+
import process from 'node:process';
|
|
23
|
+
import { sanitizeOutcome, assertOutcomeLine, } from '@dsh-triage/core';
|
|
24
|
+
import { errorCodeOf, effectiveOutcomeMode, outcomesPathOf, } from './config.js';
|
|
25
|
+
/** One command may add at most this many records; `probe` is structurally one (§9). */
|
|
26
|
+
export const MAX_RECORDS_PER_RUN = 200;
|
|
27
|
+
const recordId = () => randomBytes(16).toString('hex');
|
|
28
|
+
/**
|
|
29
|
+
* Platform → outcome vocabulary. `other` is a real value, not a failure: the key must be
|
|
30
|
+
* exact, and inventing `linux` for an unknown platform would merge two different worlds.
|
|
31
|
+
*/
|
|
32
|
+
export function outcomeOsOf(platform) {
|
|
33
|
+
return platform === 'win32' || platform === 'darwin' || platform === 'linux' || platform === 'freebsd'
|
|
34
|
+
? platform
|
|
35
|
+
: 'other';
|
|
36
|
+
}
|
|
37
|
+
export function outcomeArchOf(arch) {
|
|
38
|
+
return arch === 'x64' || arch === 'arm64' || arch === 'ia32' ? arch : 'other';
|
|
39
|
+
}
|
|
40
|
+
export function nodeMajorOf(version) {
|
|
41
|
+
const major = Number.parseInt(version.split('.')[0] ?? '', 10);
|
|
42
|
+
return Number.isInteger(major) ? major : 0;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Which surface a profile has (spec §2's seventh position).
|
|
46
|
+
*
|
|
47
|
+
* The profile NAME is the only evidence available here, so an unrecognised name becomes
|
|
48
|
+
* `unknown` - and an `unknown` profile kind never matches a prior (§2).
|
|
49
|
+
*/
|
|
50
|
+
export function profileKindOf(profile) {
|
|
51
|
+
const name = profile.trim().toLowerCase();
|
|
52
|
+
if (name.includes('headless'))
|
|
53
|
+
return 'headless';
|
|
54
|
+
if (name.includes('tui'))
|
|
55
|
+
return 'tui';
|
|
56
|
+
if (name.includes('web'))
|
|
57
|
+
return 'web';
|
|
58
|
+
return 'unknown';
|
|
59
|
+
}
|
|
60
|
+
/** Coarse timing bucket. The boundaries are fixed at 5s / 20s / 60s (`ADR-0006`). */
|
|
61
|
+
export function timingBucketOf(ms) {
|
|
62
|
+
if (ms === null || !Number.isFinite(ms) || ms < 0)
|
|
63
|
+
return null;
|
|
64
|
+
if (ms < 5_000)
|
|
65
|
+
return 'lt5s';
|
|
66
|
+
if (ms < 20_000)
|
|
67
|
+
return '5to20s';
|
|
68
|
+
if (ms < 60_000)
|
|
69
|
+
return '20to60s';
|
|
70
|
+
return 'gte60s';
|
|
71
|
+
}
|
|
72
|
+
/** The seven-tuple for a verdict computed on this machine. */
|
|
73
|
+
export function outcomeKeyFor(verdict, version) {
|
|
74
|
+
return outcomeKeyOfEnv(verdict.env, verdict.subject.name, version);
|
|
75
|
+
}
|
|
76
|
+
/** The same tuple for a candidate named without a verdict (the prior path). */
|
|
77
|
+
export function outcomeKeyOfEnv(env, packageName, version) {
|
|
78
|
+
return {
|
|
79
|
+
package: packageName,
|
|
80
|
+
version: version ?? '',
|
|
81
|
+
dsh: env.dsh,
|
|
82
|
+
os: outcomeOsOf(env.platform),
|
|
83
|
+
arch: outcomeArchOf(env.arch),
|
|
84
|
+
node_major: nodeMajorOf(env.node),
|
|
85
|
+
profile_kind: profileKindOf(env.profile),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const uniqueSorted = (values) => [...new Set(values)].sort();
|
|
89
|
+
/** The whitelisted projection of one verdict, still unvalidated. `sanitizeOutcome` decides. */
|
|
90
|
+
function outcomeCandidate(input) {
|
|
91
|
+
const key = outcomeKeyFor(input.verdict, input.version);
|
|
92
|
+
let probe = null;
|
|
93
|
+
if (input.source === 'probe' && input.probe !== null) {
|
|
94
|
+
const total = timingBucketOf(input.probe.totalMs);
|
|
95
|
+
if (total !== null) {
|
|
96
|
+
const kind = profileKindOf(input.probe.profile);
|
|
97
|
+
probe = {
|
|
98
|
+
total_ms_bucket: total,
|
|
99
|
+
// A surface with no HTTP + no render has no boot→sample number (`BS-23`).
|
|
100
|
+
boot_ms_bucket: kind === 'web' ? timingBucketOf(input.probe.bootMs) : null,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
schema_version: 1,
|
|
106
|
+
id: input.id,
|
|
107
|
+
at: input.at,
|
|
108
|
+
source: input.source,
|
|
109
|
+
package: key.package,
|
|
110
|
+
version: key.version,
|
|
111
|
+
dsh_version: key.dsh,
|
|
112
|
+
os: key.os,
|
|
113
|
+
arch: key.arch,
|
|
114
|
+
node_major: key.node_major,
|
|
115
|
+
profile_kind: key.profile_kind,
|
|
116
|
+
conclusion: input.verdict.conclusion,
|
|
117
|
+
reason_message_ids: uniqueSorted(input.verdict.reasons.map((reason) => reason.messageId)),
|
|
118
|
+
evidence_tiers: uniqueSorted(input.verdict.evidence.map((evidence) => evidence.tier)),
|
|
119
|
+
probe,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Record the verdicts of one command. NEVER throws and never changes what the command
|
|
124
|
+
* returns: every failure ends in one stderr line.
|
|
125
|
+
*/
|
|
126
|
+
export function recordOutcomes(input) {
|
|
127
|
+
const report = {
|
|
128
|
+
mode: 'off',
|
|
129
|
+
root: null,
|
|
130
|
+
written: 0,
|
|
131
|
+
rejected: 0,
|
|
132
|
+
skipped: 0,
|
|
133
|
+
};
|
|
134
|
+
try {
|
|
135
|
+
const reading = effectiveOutcomeMode({ flag: input.flag, env: input.env ?? process.env, platform: input.platform ?? process.platform });
|
|
136
|
+
report.mode = reading.mode;
|
|
137
|
+
report.root = reading.root;
|
|
138
|
+
for (const problem of reading.problems)
|
|
139
|
+
input.stderr(`outcomes: off (${problem})\n`);
|
|
140
|
+
if (reading.mode === 'off' || reading.root === null)
|
|
141
|
+
return report;
|
|
142
|
+
// "Rather record nothing than half a batch" (§9): the cap is checked before any write.
|
|
143
|
+
if (input.subjects.length > MAX_RECORDS_PER_RUN) {
|
|
144
|
+
input.stderr(`outcomes: skipped (subjects=${input.subjects.length} > cap ${MAX_RECORDS_PER_RUN})\n`);
|
|
145
|
+
return report;
|
|
146
|
+
}
|
|
147
|
+
const makeId = input.idFactory ?? recordId;
|
|
148
|
+
const lines = [];
|
|
149
|
+
for (const subject of input.subjects) {
|
|
150
|
+
// A verdict without an exact version cannot be keyed; it is not repaired into one.
|
|
151
|
+
if (subject.version === null) {
|
|
152
|
+
report.skipped += 1;
|
|
153
|
+
input.stderr('outcomes: skipped (no exact version, so the key is incomplete)\n');
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const candidate = outcomeCandidate({
|
|
157
|
+
verdict: subject.verdict,
|
|
158
|
+
version: subject.version,
|
|
159
|
+
source: input.source,
|
|
160
|
+
at: input.at,
|
|
161
|
+
id: makeId(),
|
|
162
|
+
probe: input.probe,
|
|
163
|
+
});
|
|
164
|
+
const sanitized = sanitizeOutcome(candidate);
|
|
165
|
+
if (!sanitized.ok) {
|
|
166
|
+
report.rejected += 1;
|
|
167
|
+
input.stderr(`outcomes: 1 record rejected (${sanitized.reason}: ${sanitized.field ?? 'record'})\n`);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
lines.push(JSON.stringify(sanitized.record));
|
|
171
|
+
}
|
|
172
|
+
if (lines.length === 0)
|
|
173
|
+
return report;
|
|
174
|
+
// The directory is created only when there is a record to write (N1: off means nothing,
|
|
175
|
+
// and "on but nothing to say" must not leave an empty store behind either).
|
|
176
|
+
mkdirSync(reading.root, { recursive: true });
|
|
177
|
+
const path = outcomesPathOf(reading.root);
|
|
178
|
+
for (const line of lines) {
|
|
179
|
+
// One `write` per line with `O_APPEND`: two processes appending concurrently each get a
|
|
180
|
+
// complete line, and there is no lock file to survive a purge (N11 / §8).
|
|
181
|
+
appendFileSync(path, `${line}\n`, { flag: 'a', encoding: 'utf8' });
|
|
182
|
+
report.written += 1;
|
|
183
|
+
}
|
|
184
|
+
return report;
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
// Read-only directory, full disk, a store path that is a file: one line, exit code untouched.
|
|
188
|
+
input.stderr(`outcomes: could not record (${errorCodeOf(error)})\n`);
|
|
189
|
+
return report;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Read the store back for counting (status, purge, prior).
|
|
194
|
+
*
|
|
195
|
+
* A line that fails `assertOutcomeLine` is skipped and counted: one corrupted line must not
|
|
196
|
+
* destroy a library, and it must never look like a record either (spec §6 runtime row).
|
|
197
|
+
*/
|
|
198
|
+
export function readOutcomeRecords(root) {
|
|
199
|
+
let text;
|
|
200
|
+
try {
|
|
201
|
+
text = readFileSync(outcomesPathOf(root), 'utf8');
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
return { records: [], rejected: 0, lines: 0, read: false };
|
|
205
|
+
}
|
|
206
|
+
const records = [];
|
|
207
|
+
let rejected = 0;
|
|
208
|
+
let lines = 0;
|
|
209
|
+
for (const raw of text.split('\n')) {
|
|
210
|
+
const line = raw.trim();
|
|
211
|
+
if (line === '')
|
|
212
|
+
continue;
|
|
213
|
+
lines += 1;
|
|
214
|
+
const parsed = assertOutcomeLine(line);
|
|
215
|
+
if (!parsed.ok) {
|
|
216
|
+
rejected += 1;
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
records.push(parsed.record);
|
|
220
|
+
}
|
|
221
|
+
return { records, rejected, lines, read: true };
|
|
222
|
+
}
|
|
223
|
+
/** Counts by conclusion, for `outcomes --status` and for the recorded (artifact) summaries. */
|
|
224
|
+
export function countConclusions(records) {
|
|
225
|
+
const counts = { go: 0, risky: 0, blocked: 0, unknown: 0 };
|
|
226
|
+
for (const record of records)
|
|
227
|
+
counts[record.conclusion] += 1;
|
|
228
|
+
return counts;
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/outcomes/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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AA;QACvB,IAAI,IAAI,KAAK,EAAE;YAAE,SAAQ;QACzB,KAAK,IAAI,CAAC,CAAA;QACV,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,QAAQ,IAAI,CAAC,CAAA;YACb,SAAQ;QACV,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;AACjD,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,gBAAgB,CAAC,OAAiC;IAChE,MAAM,MAAM,GAA+B,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAA;IACtF,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IAC5D,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-triage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "The judgment layer for DeepSeek Harness plugins: attribute why a plugin silently disappeared, judge a candidate against your exact environment, and keep a capability ledger. Offline, read-only, evidence-first.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@dsh-triage/core": "0.
|
|
64
|
-
"@dsh-triage/probe": "0.
|
|
65
|
-
"@dsh-triage/signals": "0.
|
|
63
|
+
"@dsh-triage/core": "0.2.0",
|
|
64
|
+
"@dsh-triage/probe": "0.2.0",
|
|
65
|
+
"@dsh-triage/signals": "0.2.0"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsc -b"
|