@dogfood-lab/ingest 1.23.4 → 1.23.5
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/README.md +2 -2
- package/package.json +1 -1
- package/run.js +26 -3
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Flags:
|
|
|
56
56
|
|
|
57
57
|
- `--file <path>` / `--payload <path>` — the submission JSON to ingest (both spellings accepted).
|
|
58
58
|
- `--provenance=github` — confirm provenance against the GitHub Actions API (requires `GITHUB_TOKEN` / `GH_TOKEN`). **Production.**
|
|
59
|
-
- `--provenance=stub` — accept the claimed provenance without an API call. **Test/dev only — refused in CI
|
|
59
|
+
- `--provenance=stub` — accept the claimed provenance without an API call. **Test/dev only — refused in CI**, and a write needs an explicit `INGEST_REPO_ROOT` (a scratch root with a copy of `policies/`) so a stub record never enters this repository's own corpus. `--verify-only` needs no root.
|
|
60
60
|
- `--verify-only` — verify and report, write nothing.
|
|
61
61
|
|
|
62
62
|
Standalone audit verb (no submission, no stdin, no `--provenance` — fully offline):
|
|
@@ -69,7 +69,7 @@ Exit codes:
|
|
|
69
69
|
|
|
70
70
|
- `0` — the record was accepted (and, without `--verify-only`, persisted).
|
|
71
71
|
- `1` — the submission was verified but **not accepted** (rejected by a validator gate).
|
|
72
|
-
- `2` — an operator/runtime fault (missing/unreadable `--file`, missing `--provenance`, missing token in CI, downstream I/O failure). Every exit-2 path emits a structured `logStage('error', …)` event first so a log grep finds the cause.
|
|
72
|
+
- `2` — an operator/runtime fault (missing/unreadable `--file`, missing `--provenance`, missing token in CI, a stub write with no `INGEST_REPO_ROOT`, downstream I/O failure). Every exit-2 path emits a structured `logStage('error', …)` event first so a log grep finds the cause.
|
|
73
73
|
|
|
74
74
|
There is no exit code 3.
|
|
75
75
|
|
package/package.json
CHANGED
package/run.js
CHANGED
|
@@ -845,7 +845,11 @@ Input (exactly one; stdin used when neither flag is given):
|
|
|
845
845
|
|
|
846
846
|
Provenance (required for an ingest):
|
|
847
847
|
--provenance=github Confirm the source run via the GitHub API.
|
|
848
|
-
--provenance=stub No-network local confirm (dry-run / dev only).
|
|
848
|
+
--provenance=stub No-network local confirm (dry-run / dev only). Writes a
|
|
849
|
+
record only when INGEST_REPO_ROOT names the root.
|
|
850
|
+
|
|
851
|
+
Environment:
|
|
852
|
+
INGEST_REPO_ROOT Root for records/ and indexes/ (default: this checkout).
|
|
849
853
|
|
|
850
854
|
Modes:
|
|
851
855
|
--verify-only Run the full pipeline WITHOUT writing or rebuilding
|
|
@@ -878,8 +882,8 @@ if (isMain) {
|
|
|
878
882
|
// a brittle source-copy of this file (the setupTempRunJs run.js-copy in
|
|
879
883
|
// d1b-001-cli-toplevel-error-event.test.js) that rewrote __dirname's `../..`
|
|
880
884
|
// walk. A production caller passes the real root explicitly; a test passes a
|
|
881
|
-
// temp dir; the default
|
|
882
|
-
//
|
|
885
|
+
// temp dir; the default applies when the env var is unset, and a stub-
|
|
886
|
+
// provenance write refuses it (see the provenance resolution below). resolve() makes a relative override absolute so the downstream
|
|
883
887
|
// join()s stay anchored.
|
|
884
888
|
const repoRoot = process.env.INGEST_REPO_ROOT
|
|
885
889
|
? resolve(process.env.INGEST_REPO_ROOT)
|
|
@@ -1254,6 +1258,25 @@ if (isMain) {
|
|
|
1254
1258
|
});
|
|
1255
1259
|
process.exit(2);
|
|
1256
1260
|
}
|
|
1261
|
+
// Stub provenance confirms whatever the submission claims, so a stub record
|
|
1262
|
+
// written into the default root reads as provenance-confirmed and takes the
|
|
1263
|
+
// next seq in the integrity chain — a fork of the published chain once a
|
|
1264
|
+
// real ingest lands first. Writing a stub record therefore needs a root the
|
|
1265
|
+
// operator named; --verify-only writes nothing and stays free.
|
|
1266
|
+
if (!verifyOnlyFlag && !process.env.INGEST_REPO_ROOT) {
|
|
1267
|
+
emitCliErrorEvent({
|
|
1268
|
+
failedStage: 'cli_provenance_resolve',
|
|
1269
|
+
correlationId: cliCorrelationId,
|
|
1270
|
+
submissionId: submission && submission.run_id ? submission.run_id : null,
|
|
1271
|
+
err: new Error(
|
|
1272
|
+
'--provenance=stub writes a record only under an explicit INGEST_REPO_ROOT. ' +
|
|
1273
|
+
'Stub records are test/dev only and must not enter the real corpus. ' +
|
|
1274
|
+
'Set INGEST_REPO_ROOT to a scratch directory, add --verify-only, or use --provenance=github.'
|
|
1275
|
+
),
|
|
1276
|
+
humanPrefix: 'provenance precondition unmet'
|
|
1277
|
+
});
|
|
1278
|
+
process.exit(2);
|
|
1279
|
+
}
|
|
1257
1280
|
console.error('WARNING: Using stub provenance (test/dev only). Records will NOT have real provenance verification.');
|
|
1258
1281
|
provenance = stubProvenance;
|
|
1259
1282
|
} else if (provenanceMode === 'github') {
|