instar 1.3.872 → 1.3.874

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.
@@ -1098,12 +1098,19 @@ run_verification() {
1098
1098
  # Run in a subshell so the resolved CWD + scrubbed env never disturb the hook itself.
1099
1099
  # Combined stdout+stderr is byte-capped AT THE SOURCE (head -c) so a runaway log can
1100
1100
  # never buffer whole. Exit code via ${PIPESTATUS[0]} (the command's, not head's).
1101
+ # SIGNAL-DEATH MAPPING (cardinal invariant): when the child dies from a SIGNAL —
1102
+ # e.g. SIGPIPE, the routine outcome once head -c hits the byte cap and closes the
1103
+ # pipe while the command is still writing — the perl runner must report 128+signal
1104
+ # (mirroring GNU timeout and shell $? semantics), NEVER `$?>>8` alone: the low byte
1105
+ # holds the signal and the HIGH byte is 0, so a bare `$?>>8` would map a
1106
+ # killed-by-signal FAILING check to exit 0 == PASS and allow a premature exit.
1107
+ # (Observed on macOS, where no GNU timeout exists and the perl rung is the default.)
1101
1108
  if [[ "$rc_runner" == "perl" ]]; then
1102
1109
  rc_raw=$(
1103
1110
  env "${rc_env_args[@]}" PATH="$rc_path" \
1104
1111
  bash -c '
1105
1112
  cd "$1" 2>/dev/null || true
1106
- "$5" -e '\''my($t,@c)=@ARGV; my $p=fork; if($p==0){setpgrp(0,0); exec @c or exit 127} $SIG{ALRM}=sub{kill("-KILL",$p); exit 124}; alarm($t); waitpid($p,0); exit($?>>8)'\'' "$2" bash -c "$3" 2>&1 | head -c "$4"
1113
+ "$5" -e '\''my($t,@c)=@ARGV; my $p=fork; if($p==0){setpgrp(0,0); exec @c or exit 127} $SIG{ALRM}=sub{kill("-KILL",$p); exit 124}; alarm($t); waitpid($p,0); exit(($?&127) ? 128+($?&127) : ($?>>8))'\'' "$2" bash -c "$3" 2>&1 | head -c "$4"
1107
1114
  exit "${PIPESTATUS[0]}"
1108
1115
  ' _ "$cwd" "$RC_TIMEOUT_S" "$cmd" "$RC_CAPTURE_BYTES" "$rc_runner_bin"
1109
1116
  )
@@ -1131,8 +1138,15 @@ run_verification() {
1131
1138
  # 1b. UTF-8 scrub: a source head -c byte-cap can split a multibyte char, leaving a lone
1132
1139
  # continuation byte that would later break jq --arg. iconv -c drops invalid bytes;
1133
1140
  # fall back to an LC_ALL=C printable-only filter when iconv is absent.
1141
+ # PORTABILITY: macOS (BSD/citrus) iconv -c EMITS the correctly-scrubbed prefix but
1142
+ # still EXITS NON-ZERO on a truncated trailing multibyte char — so the fallback must
1143
+ # key on "produced no output from non-empty input", never on iconv's exit code
1144
+ # (an exit-code `||` would APPEND the fallback's output to iconv's, duplicating text).
1134
1145
  if command -v iconv >/dev/null 2>&1; then
1135
- rc_utf8=$(printf '%s' "$rc_san" | iconv -c -f utf-8 -t utf-8 2>/dev/null || printf '%s' "$rc_san" | LC_ALL=C tr -cd '\11\12\15\40-\176')
1146
+ rc_utf8=$(printf '%s' "$rc_san" | iconv -c -f utf-8 -t utf-8 2>/dev/null || true)
1147
+ if [[ -z "$rc_utf8" && -n "$rc_san" ]]; then
1148
+ rc_utf8=$(printf '%s' "$rc_san" | LC_ALL=C tr -cd '\11\12\15\40-\176')
1149
+ fi
1136
1150
  else
1137
1151
  rc_utf8=$(printf '%s' "$rc_san" | LC_ALL=C tr -cd '\11\12\15\40-\176')
1138
1152
  fi
@@ -0,0 +1,116 @@
1
+ /**
2
+ * stallCoverageValidator — the single validator for framework stall-coverage
3
+ * matrices (docs/frameworks/<framework>-stall-coverage.md).
4
+ *
5
+ * Spec: docs/specs/framework-stall-coverage-matrix.md (§2.2, §3.1, §3.2)
6
+ *
7
+ * ONE module, TWO callsites (spec §3.2). This file implements the HERMETIC
8
+ * half only — the CI-ratchet callsite (tests/unit/stall-coverage-ratchet.test.ts):
9
+ * schema, status tokens, canonical-class completeness, symbol existence under
10
+ * the path jail, evidence containment + push-suite collection, ref FORMAT,
11
+ * and the calendar aging ratchet. The NON-hermetic checks (closePath/issueRef
12
+ * LIVENESS against the commitments ledger, guardKey posture cross-check
13
+ * against /guards) belong to the PR-B runtime-gate callsite; the `deps`
14
+ * injection seam below is where those checkers plug in without changing the
15
+ * result shape (issues/warnings arrays absorb new rules additively).
16
+ *
17
+ * Refusal hygiene (spec Frontloaded Decision 16): every issue message
18
+ * references the class id (only when canonical) + the rule name — rejected
19
+ * raw field content is NEVER echoed into messages.
20
+ */
21
+ /** One parsed `stall-coverage:` front-matter row (fields as authored). */
22
+ export interface StallMatrixRow {
23
+ class?: string;
24
+ status?: string;
25
+ reason?: string;
26
+ detector?: string;
27
+ recovery?: string;
28
+ guardKey?: string;
29
+ posture?: string;
30
+ evidence?: string;
31
+ issueRef?: string;
32
+ closePath?: string;
33
+ seededAt?: string;
34
+ acceptanceRef?: string;
35
+ revalidateOn?: string;
36
+ 'liveness-surface'?: string;
37
+ matchedClasses?: string[];
38
+ }
39
+ export interface StallMatrixIssue {
40
+ /** Canonical class id — set ONLY when the row's class is canonical (an
41
+ * unknown class id is rejected content and never echoed). */
42
+ classId?: string;
43
+ /** Stable kebab rule name. */
44
+ rule: string;
45
+ /** References class id + rule name only — never rejected raw field content. */
46
+ message: string;
47
+ }
48
+ /** Per-row verification record (spec §3.2): the validator's verdict is
49
+ * STRUCTURAL — `mechanically-verified: presence-only` on every row, so no
50
+ * downstream surface (the PR-B gate report included) can present `covered`
51
+ * as semantically proven. Whether a covered claim is TRUE stays with the
52
+ * overseer. */
53
+ export interface StallMatrixRowRecord {
54
+ classId: string;
55
+ status: string;
56
+ mechanicallyVerified: 'presence-only';
57
+ }
58
+ export interface StallMatrixResult {
59
+ framework: string;
60
+ filePath: string;
61
+ valid: boolean;
62
+ issues: StallMatrixIssue[];
63
+ warnings: StallMatrixIssue[];
64
+ rowCount: number;
65
+ /** One record per canonical-class row (spec §3.2 presence-only marker). */
66
+ rows: StallMatrixRowRecord[];
67
+ /** sha256 of the exact file bytes validated (single read). */
68
+ contentHash: string;
69
+ }
70
+ export interface StallMatrixSetResult {
71
+ valid: boolean;
72
+ /** Set-level issues (e.g. matrix-file-missing). */
73
+ issues: StallMatrixIssue[];
74
+ results: StallMatrixResult[];
75
+ }
76
+ /** Injection seam for tests AND for the PR-B non-hermetic checkers. */
77
+ export interface StallCoverageValidatorDeps {
78
+ /** Dotted guard-inventory keys (default: GUARD_MANIFEST keys). */
79
+ guardManifestKeys?: ReadonlySet<string>;
80
+ /** Manifest-exempt component → exemption reason (default: NOT_A_GUARD). */
81
+ notAGuardComponents?: ReadonlyMap<string, string>;
82
+ /** Canonical class ids (default: STALL_CLASSES ids). */
83
+ stallClassIds?: readonly string[];
84
+ /** Frameworks that must carry a matrix file (default: REQUIRED_MATRIX_FRAMEWORKS). */
85
+ requiredFrameworks?: readonly string[];
86
+ /** Repo-relative path of the push-suite vitest config (default vitest.push.config.ts). */
87
+ pushConfigPath?: string;
88
+ }
89
+ /** Minimal glob matcher supporting `**` and `*` — no new dependencies. */
90
+ export declare function globToRegExp(glob: string): RegExp;
91
+ /** Statically extract the include globs + FLAKY_TESTS entries from the push
92
+ * config TEXT (never executes the config). Null = unparseable (fails closed
93
+ * at the callsite via push-config-unparseable). */
94
+ export declare function parsePushSuiteSets(text: string): {
95
+ includes: RegExp[];
96
+ flaky: RegExp[];
97
+ } | null;
98
+ export declare function validateStallMatrixFile(args: {
99
+ repoRoot: string;
100
+ filePath: string;
101
+ now?: Date;
102
+ deps?: StallCoverageValidatorDeps;
103
+ }): StallMatrixResult;
104
+ export declare function validateAllStallMatrices(args: {
105
+ repoRoot: string;
106
+ now?: Date;
107
+ deps?: StallCoverageValidatorDeps;
108
+ }): StallMatrixSetResult;
109
+ export declare function validateSpecTableAgreement(args: {
110
+ repoRoot: string;
111
+ deps?: StallCoverageValidatorDeps;
112
+ }): {
113
+ valid: boolean;
114
+ issues: StallMatrixIssue[];
115
+ };
116
+ //# sourceMappingURL=stallCoverageValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stallCoverageValidator.d.ts","sourceRoot":"","sources":["../../src/core/stallCoverageVal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