rungate 0.6.0 → 0.7.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/lib/affected-tests.ts +398 -0
- package/lib/agent-audit.ts +2 -3
- package/lib/agent-worktree.ts +287 -0
- package/lib/agents-md-sections.ts +81 -16
- package/lib/behavioral-cache.ts +150 -2
- package/lib/branch-protection.ts +790 -0
- package/lib/brief-ac-alignment.ts +104 -0
- package/lib/brief-references.ts +205 -0
- package/lib/bun-version.ts +93 -14
- package/lib/check-remedy.ts +140 -0
- package/lib/ci-checkout.ts +17 -0
- package/lib/ci-history-depth.ts +159 -0
- package/lib/ci-setup-step.ts +96 -0
- package/lib/claude-code-action.ts +85 -0
- package/lib/claude-tool-vocabulary.ts +188 -0
- package/lib/cli-commands.ts +15 -0
- package/lib/commit-sha.ts +42 -0
- package/lib/commit-subject.ts +90 -0
- package/lib/compliance-report.ts +377 -45
- package/lib/compliance.ts +191 -17
- package/lib/config-loader.ts +39 -1
- package/lib/config-trackable.ts +391 -0
- package/lib/conformity.ts +1087 -100
- package/lib/containment.ts +238 -0
- package/lib/content-hash.ts +24 -0
- package/lib/create-sc.ts +249 -16
- package/lib/dev-liveness.ts +180 -0
- package/lib/discovery-branch-points.ts +432 -0
- package/lib/discovery-stability.ts +481 -0
- package/lib/distribution-currency.ts +186 -0
- package/lib/doc-routing.ts +157 -0
- package/lib/evidence-prevalidator.ts +224 -2
- package/lib/evidence-satisfiability.ts +534 -12
- package/lib/failure-intake.ts +317 -0
- package/lib/fallow-availability.ts +157 -0
- package/lib/fs-write-capabilities.ts +232 -0
- package/lib/gate-run-split.ts +147 -0
- package/lib/generators/agents-md.ts +140 -32
- package/lib/git-isolation.ts +140 -0
- package/lib/github.ts +15 -0
- package/lib/google-auth-action.ts +93 -0
- package/lib/harness-project.ts +48 -0
- package/lib/harness-provenance.ts +255 -0
- package/lib/hook-evidence.ts +235 -0
- package/lib/hook-scopes.ts +386 -0
- package/lib/hook-target-tree.ts +398 -0
- package/lib/hook-trees.ts +447 -0
- package/lib/js-top-level-code.ts +78 -10
- package/lib/junit-checks.ts +52 -0
- package/lib/launch-base.ts +253 -0
- package/lib/line-citation.ts +372 -0
- package/lib/orphan-reaper.ts +468 -0
- package/lib/parity-binding.ts +205 -0
- package/lib/per-test-timeouts.ts +219 -0
- package/lib/plan-coverage.ts +151 -0
- package/lib/prior-branch.ts +201 -8
- package/lib/process-table.ts +146 -0
- package/lib/project-state-derivation.ts +219 -0
- package/lib/project-state-root.ts +258 -0
- package/lib/published-artifact.ts +525 -0
- package/lib/readdir-sorted.ts +45 -0
- package/lib/review-execution-reading.ts +206 -0
- package/lib/review-tool-agreement.ts +433 -0
- package/lib/rule-promotion.ts +234 -0
- package/lib/rule-retirement.ts +525 -0
- package/lib/run-branch.ts +612 -0
- package/lib/rungate-schema.ts +19 -0
- package/lib/runner-home.ts +274 -0
- package/lib/sc-id-cross-tree.ts +19 -7
- package/lib/sc-ids.ts +121 -13
- package/lib/sc-reservations.ts +289 -0
- package/lib/scaffold/ai-review-findings.ts +403 -0
- package/lib/scaffold/ai-review-step.ts +4661 -64
- package/lib/scaffold/managed-workflow.ts +587 -192
- package/lib/scaffold/owned-files.ts +152 -45
- package/lib/scaffold/pre-push-hook.ts +49 -5
- package/lib/scaffold/steps.ts +1413 -244
- package/lib/scaffold/workflow-census.ts +217 -0
- package/lib/scaffold/workflow-drift.ts +217 -0
- package/lib/scaffold/write-steps.ts +4 -0
- package/lib/scan-budget.ts +247 -0
- package/lib/scanner.ts +43 -51
- package/lib/scratch-roots.ts +50 -5
- package/lib/screenshot-discovery.ts +121 -0
- package/lib/screenshot-upload.ts +41 -1
- package/lib/secret-patterns.ts +511 -8
- package/lib/ship-mode.ts +219 -0
- package/lib/source-slice.ts +294 -0
- package/lib/stale-cleanup.ts +37 -3
- package/lib/suite-flake.ts +278 -0
- package/lib/suite-measurement.ts +23 -4
- package/lib/suite-run-reading.ts +241 -1
- package/lib/suite-timeout-margin.ts +193 -0
- package/lib/test-case-bodies.ts +883 -0
- package/lib/test-case-deletion.ts +653 -0
- package/lib/test-census.ts +97 -29
- package/lib/test-command-positions.ts +274 -0
- package/lib/test-suite-lock.ts +159 -16
- package/lib/tool-probe.ts +31 -9
- package/lib/top-level-cd.ts +393 -0
- package/lib/tree-entries.ts +89 -0
- package/lib/ts-ast.ts +200 -0
- package/lib/walk-test-files.ts +97 -0
- package/lib/workflow-actions.ts +263 -0
- package/lib/worktree-collect.ts +177 -5
- package/lib/worktree-repo.ts +36 -1
- package/package.json +2 -1
- package/scripts/ai-review-findings.ts +45 -0
- package/scripts/create-sc.ts +21 -1
- package/scripts/extract-constraints.ts +107 -7
- package/scripts/generate-code-map.ts +23 -30
- package/scripts/scaffold-project.ts +8 -1
- package/scripts/sync-sc-status.ts +77 -16
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { existsSync, readFileSync, writeFileSync, readdirSync } from "fs";
|
|
18
|
+
|
|
19
|
+
import { walkTestFiles } from "../lib/walk-test-files";
|
|
18
20
|
import { commentMask, enclosingComment, stripJsComments } from "../lib/strip-js-comments";
|
|
19
21
|
import { commentClaimForm, titleCall, type ClaimForm } from "../lib/sc-claim-forms";
|
|
20
22
|
import { join } from "path";
|
|
21
23
|
import { execSync } from "child_process";
|
|
22
24
|
import { matchPattern, isBehavioralSC, type ParsedSC } from "../lib/conformity";
|
|
23
|
-
import { readFreshCache } from "../lib/behavioral-cache";
|
|
25
|
+
import { behavioralCachePath, readFreshCache } from "../lib/behavioral-cache";
|
|
24
26
|
import { detectDrift } from "./detect-sc-drift";
|
|
25
27
|
import {
|
|
26
28
|
ambiguityOf,
|
|
@@ -32,6 +34,7 @@ import {
|
|
|
32
34
|
requiresQualification,
|
|
33
35
|
scDeclarationPattern,
|
|
34
36
|
scMentionPattern as scIdMentionPattern,
|
|
37
|
+
unenumeratedScRegistry,
|
|
35
38
|
type ScRegistry,
|
|
36
39
|
} from "../lib/sc-ids";
|
|
37
40
|
|
|
@@ -55,13 +58,28 @@ export interface UncheckedSC {
|
|
|
55
58
|
* Built from the same spec scan `findUncheckedSCs` walks, so the ids a test
|
|
56
59
|
* can be credited for and the ids a spec declares are the same set by
|
|
57
60
|
* construction rather than by two regexes agreeing.
|
|
61
|
+
*
|
|
62
|
+
* ## An absent `specs/` is UNENUMERATED, not "declares nothing" (#606)
|
|
63
|
+
*
|
|
64
|
+
* This is the one producer feeding `allocateScNumber` in the live CLI
|
|
65
|
+
* (`scripts/create-sc.ts`), and it returned `buildScRegistry([])` for a tree
|
|
66
|
+
* with no `specs/` at all. That registry says "this tree declares nothing",
|
|
67
|
+
* which the allocator then reported as a consulted width contributing zero
|
|
68
|
+
* ids. A fix on the reading side alone cannot see this: the registry leg
|
|
69
|
+
* would faithfully report an enumeration flag nobody had ever set wrong.
|
|
58
70
|
*/
|
|
59
71
|
export function readScRegistry(specsDir?: string): ScRegistry {
|
|
60
72
|
const dir = specsDir || SPECS_DIR;
|
|
61
|
-
if (!existsSync(dir)) return
|
|
73
|
+
if (!existsSync(dir)) return unenumeratedScRegistry(`${dir} does not exist`);
|
|
62
74
|
const specs: Array<{ file: string; content: string }> = [];
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
try {
|
|
76
|
+
for (const file of new Bun.Glob("**/*.md").scanSync({ cwd: dir, absolute: false })) {
|
|
77
|
+
specs.push({ file, content: readFileSync(join(dir, file), "utf-8") });
|
|
78
|
+
}
|
|
79
|
+
} catch (err) {
|
|
80
|
+
// A directory that exists and cannot be listed or read. Same fact as an
|
|
81
|
+
// absent one from the allocator's side, and a different reason.
|
|
82
|
+
return unenumeratedScRegistry(`${dir} could not be enumerated: ${(err as Error).message}`);
|
|
65
83
|
}
|
|
66
84
|
return buildScRegistry(specs);
|
|
67
85
|
}
|
|
@@ -313,6 +331,9 @@ export function findTestFilesForSCs(
|
|
|
313
331
|
const dir = testDir || TEST_DIR;
|
|
314
332
|
const out = new Map<string, ScCredit[]>();
|
|
315
333
|
if (!existsSync(dir)) return out;
|
|
334
|
+
// Tree-wide, and taken before any file is read: whether a criterion has a
|
|
335
|
+
// running test anywhere is not a question a single file can answer (#810).
|
|
336
|
+
const intended = new Set(intendedOnly(dir).keys());
|
|
316
337
|
|
|
317
338
|
const wanted = new Map<string, string[]>();
|
|
318
339
|
for (const sc of scs) {
|
|
@@ -321,7 +342,7 @@ export function findTestFilesForSCs(
|
|
|
321
342
|
wanted.set(sc.id, specs);
|
|
322
343
|
}
|
|
323
344
|
|
|
324
|
-
for (const file of
|
|
345
|
+
for (const file of walkTestFiles(dir)) {
|
|
325
346
|
const source = readFileSync(join(dir, file), "utf-8");
|
|
326
347
|
const credits: ScCredit[] = [];
|
|
327
348
|
for (const { id, at, kind, form } of coverageClaimSites(source)) {
|
|
@@ -334,6 +355,21 @@ export function findTestFilesForSCs(
|
|
|
334
355
|
// crediting, and a todo is the clearest case there is: nothing can go
|
|
335
356
|
// red, so nothing can be measured.
|
|
336
357
|
if (kind === "unrun-title") continue;
|
|
358
|
+
// #810. That refusal was per-POSITION, so it dropped the todo's own
|
|
359
|
+
// claim and then accepted a comment in ANOTHER file for the same id —
|
|
360
|
+
// two statements about one criterion, and the weaker one decided. A
|
|
361
|
+
// todo is a statement about execution; a comment is not. `intendedOnly`
|
|
362
|
+
// is the one binding that answers it, so there is one thing to mutate.
|
|
363
|
+
//
|
|
364
|
+
// Deliberately NOT `kind === "comment" && intended.has(id)`. The first
|
|
365
|
+
// draft was, it reads as the narrower and therefore safer form, and it
|
|
366
|
+
// is unreachable: `intendedOnly` excludes any id with a running title,
|
|
367
|
+
// so the only kinds that can reach here for an id it names are the ones
|
|
368
|
+
// the conjunct would have admitted anyway. Measured — the battery row
|
|
369
|
+
// for widening it to this was 0 of 10, which is the fourth shape in
|
|
370
|
+
// `.claude/rules/checks-must-be-able-to-fail.md` and the reason AC-2
|
|
371
|
+
// had no witness until the conjunct came out.
|
|
372
|
+
if (intended.has(id)) continue;
|
|
337
373
|
for (const specFile of wanted.get(id) ?? []) {
|
|
338
374
|
if (requiresQualification(id, reg) && !(kind === "title" && isQualifiedBy(source, at, specFile))) continue;
|
|
339
375
|
if (!credits.some(c => c.id === id && c.specFile === specFile)) {
|
|
@@ -350,24 +386,48 @@ export function findTestFilesForSCs(
|
|
|
350
386
|
* Ids whose only declaring position in the test tree is a title that never
|
|
351
387
|
* runs (#574), with the files that name them.
|
|
352
388
|
*
|
|
353
|
-
* An id that ALSO has a running title
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
389
|
+
* An id that ALSO has a running title anywhere is not here: the question is
|
|
390
|
+
* whether anything can measure it, not whether a todo exists. That
|
|
391
|
+
* distinction is the whole report — otherwise every criterion with a todo
|
|
392
|
+
* beside a real test would be listed as unmeasured and the list would be
|
|
393
|
+
* ignored within a week.
|
|
394
|
+
*
|
|
395
|
+
* ## A declaring comment used to count as measurement, and it does not (#810)
|
|
396
|
+
*
|
|
397
|
+
* It was the natural reading and it is wrong in one direction only, which is
|
|
398
|
+
* why nobody noticed: a comment is where this project DECLARES coverage, so a
|
|
399
|
+
* declaring comment plus a todo read as "somebody wrote the test and left a
|
|
400
|
+
* stale todo beside it". The population it actually describes is the
|
|
401
|
+
* opposite — a file about something else quoting the criterion as fixture
|
|
402
|
+
* input, in a docstring, on its own line, which is a declaring form.
|
|
403
|
+
*
|
|
404
|
+
* Measured on this tree at the time of #810: **five** ids were in that state
|
|
405
|
+
* and **zero** of them had a running title. Four were `SC-1930`, `SC-1940`,
|
|
406
|
+
* `SC-1943` and `SC-1944`, cited by `audit-specs-fallback-scope.test.ts` and
|
|
407
|
+
* `audit-specs-rewrite-fidelity.test.ts` — both tests of the spec-rewriting
|
|
408
|
+
* tool, neither a test of a rule-lifecycle criterion. `sync-sc-status.ts`
|
|
409
|
+
* ticked all four, and the tick then broke the citing file's own premise,
|
|
410
|
+
* which asserts the spec still reads `- [ ] SC-1940: …`.
|
|
411
|
+
*
|
|
412
|
+
* So the comparison this makes is between a statement about EXECUTION and a
|
|
413
|
+
* statement about intent. A comment is neither, and crediting it here made
|
|
414
|
+
* `SC-1957`'s invariant — *"an id is reported unmeasured AND credited by a
|
|
415
|
+
* test claim"* — true by construction: an id with a declaring comment could
|
|
416
|
+
* not enter this report, so the two readings could not disagree. Narrowing
|
|
417
|
+
* `measured` is what gives that case something to see.
|
|
358
418
|
*/
|
|
359
419
|
export function intendedOnly(testDir: string): Map<string, string[]> {
|
|
360
420
|
const out = new Map<string, string[]>();
|
|
361
421
|
if (!existsSync(testDir)) return out;
|
|
362
422
|
const measured = new Set<string>();
|
|
363
423
|
const intended = new Map<string, string[]>();
|
|
364
|
-
for (const file of
|
|
424
|
+
for (const file of walkTestFiles(testDir)) {
|
|
365
425
|
for (const site of coverageClaimSites(readFileSync(join(testDir, file), "utf-8"))) {
|
|
366
426
|
if (site.kind === "unrun-title") {
|
|
367
427
|
const files = intended.get(site.id) ?? [];
|
|
368
428
|
if (!files.includes(file)) files.push(file);
|
|
369
429
|
intended.set(site.id, files);
|
|
370
|
-
} else if (site.kind === "title"
|
|
430
|
+
} else if (site.kind === "title") {
|
|
371
431
|
measured.add(site.id);
|
|
372
432
|
}
|
|
373
433
|
}
|
|
@@ -508,9 +568,10 @@ export function checkConformitySCs(uncheckedSCs: UncheckedSC[], root: string): C
|
|
|
508
568
|
const failing = new Set<string>();
|
|
509
569
|
const unmatchable = new Set<string>();
|
|
510
570
|
|
|
511
|
-
// Read behavioral cache for behavioral SCs
|
|
512
|
-
|
|
513
|
-
|
|
571
|
+
// Read behavioral cache for behavioral SCs. Same binding the conformity
|
|
572
|
+
// suite asserts through, so the tick-decider and the gate cannot disagree
|
|
573
|
+
// about where the evidence lives (#328).
|
|
574
|
+
const behavioralCache = readFreshCache(behavioralCachePath(root));
|
|
514
575
|
|
|
515
576
|
for (const sc of uncheckedSCs) {
|
|
516
577
|
const statement = sc.statement || "";
|
|
@@ -661,7 +722,7 @@ if (isDirectExecution) {
|
|
|
661
722
|
// Mentions that look like claims and are not credited. Visible on purpose:
|
|
662
723
|
// under-crediting is the safe direction and still a measurement error.
|
|
663
724
|
const unqualified = new Map<string, string>();
|
|
664
|
-
for (const file of
|
|
725
|
+
for (const file of walkTestFiles(TEST_DIR)) {
|
|
665
726
|
for (const u of unqualifiedClaims(readFileSync(join(TEST_DIR, file), "utf-8"), registry)) {
|
|
666
727
|
unqualified.set(`${file} ${u.id}`, ` ${file}: ${u.id} — ${u.reason}`);
|
|
667
728
|
}
|