Files
gstack/test/test-pr-profile.test.ts
Garry Tanandcapy-ai[bot] ada251bbc0 v1.91.96.0 fix: honest install and self-upgrade on Capy (field wave A, items 1-5) (#3164)
* docs(designs): gstack field wave plan (2026-10-12) and the shared simulated Capy host fixture

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(doctor): --min-revision, a launch Bun found off PATH, planning-only pins SKIP

gstack-doctor --check gains --min-revision <v>|unknown: below it the revision
row FAILs with REVISION_BELOW_MINIMUM naming the Capy wrapper or
bin/gstack-upgrade; unknown says so and never claims the minimum. The runtime
and pins rows name a supported Bun found in $BUN_INSTALL/bin (not on PATH)
with the export/GSTACK_LAUNCH fix (gstack_bun_launch_dir, one helper in
bin/gstack-bun-version.sh). --for a planning-only workflow (autoplan, the plan
reviews, office-hours) reports a repo test-pin mismatch as SKIP pins
(planning-only; ...). New result codes UPGRADE_REFUSED, UPGRADE_FETCH_FAILED,
REVISION_BELOW_MINIMUM, CAPY_WRAPPER_STALE, INSTALL_UNVERIFIED with
troubleshooting anchors; REVISION_UNMET's fix names bin/gstack-upgrade.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(install): install verdict and install admission at skill start

bin/gstack-install-verdict.sh (Bash) and lib/install-verdict.ts (TypeScript)
are the one reader of the install verdict gstack-capy-install writes to
<state root>/install-verdicts/<sha256(checkout realpath)>.json (checkout,
HEAD, workflow and required components, planning-only pins, trailer). The
source checkout and capy/support.env resolve through gstack_source_root /
sourceRoot, which follow an installed root's .source-path.

gstack-skill-start, after SESSION_KIND: an unattended session (any host)
refuses on a PATH Bun below the supported minimum; with GSTACK_CAPY=1 an
unattended or explicit spawned session also refuses without a passing
verdict for this checkout, HEAD and workflow (INSTALL_UNVERIFIED). A refusal
prints the INSTALL: row, an install-refused instruction block bound to its
SESSION_ID, GSTACK_RESULT ... status=refused run=- and exits 3. Ambient
spawned sessions warn; GSTACK_ALLOW_UNSUPPORTED_RUNTIME=1 admits and says so.
capy/support.env declares GSTACK_MIN_REVISION and GSTACK_CAPY_MIN_WRAPPER.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(capy-install): launch PATH, Bun reuse and CI pins, setup skip on HEAD, verdict, --check

The GSTACK_LAUNCH line carries PATH=<dir>:$PATH when the certified Bun is not
first on PATH, plus GSTACK_CAPY=1 and GSTACK_INSTALL_VERDICT, and
GSTACK_LAUNCH_PATH: <dir>; the doctor runs with that PATH. A supported Bun in
$BUN_INSTALL/bin is reused instead of downloaded again. Project pins are read
with bin/gstack-runtime-pins.ts (CI lanes included): when every exact pin is
gstack's verified version the archive is installed alongside a different PATH
Bun; any other exact pin is RUNTIME_PIN_CONFLICT. Both ./setup runs are
skipped when this HEAD was set up with the same hosts, model and browser flag
and the check passes (never after a fast-forward); a failed setup ends with
gstack: fail setup and is retried next run. --check certifies only;
GSTACK_CAPY_LOCK_HELD=1 accepts the bootstrapper's held lock; result anchors
come from the generated components table; REV_NOTE names bin/gstack-upgrade.

Intentional pin change: test/gstack-capy-install.test.ts --revision trailer
now names <root>/bin/gstack-upgrade (the old text named a command that never
existed).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(upgrade): bin/gstack-upgrade, the unattended fast-forward every fix line names

--check fetches and prints current|behind <installed> -> <remote> (<n>
commits); the default fast-forwards to the remote default branch tip and
reinstalls (bin/gstack-capy-install on a Capy install, else ./setup
--refresh-registered), completing a pending reinstall on the next run. It
refuses (UPGRADE_REFUSED, exit 3, nothing changed) a dirty tracked byte, a
diverged commit, a pinned checkout, the incoming Bun floor and a held
.setup-lock; never stashes or resets; an unreachable remote is
UPGRADE_FETCH_FAILED. Fetches are receipted (fail-open). The unattended
skill-end UPGRADE_AVAILABLE line is followed by UPGRADE_COMMAND naming it.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(capy): vendored Capy skill, frozen bootstrapper and full wrapper bin/gstack-capy-session

capy/skill/gstack/ is the Drive skill's source of truth. scripts/install.sh
is a frozen bootstrapper: it prints gstack-capy-skill: wrapper <n> (<path>),
clones or fetches under .gstack-capy-install.lock, reads the remote
capy/support.env (FETCH_HEAD), fast-forwards a clean unpinned checkout below
GSTACK_MIN_REVISION (refusing dirty, diverged or pinned checkouts with the
exact commands; GSTACK_CAPY_AUTO_UPGRADE=0 disables), and execs the
checkout's own bin/gstack-capy-session with GSTACK_CAPY_LOCK_HELD=1 so the
held lock is never taken twice. Offline it says the remote minimum is
unknown. A Drive copy older than GSTACK_CAPY_MIN_WRAPPER prints an owner
action (CAPY_WRAPPER_STALE). SKILL.md: check at session start, install
lazily before the first workflow, the GSTACK_LAUNCH line, the trailer rule,
the subagent first-report line, gstack-pregate sealed before any push, and
the autoplan/DRIVER.md pointer. The context-budget fixture gains the skill's
entry.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* docs: Capy install layers, lazy install, snapshot bake, forward-only recovery, raising the minimum

docs/capy-install.md describes the three layers (Drive bootstrapper, full
wrapper, installer), the lazy install, the GSTACK_LAUNCH line, install
admission, baking gstack into a Capy snapshot, and that recovery after an
interrupted fast-forward completes or refuses the pending install stages
(checking out an older commit is not a rollback). docs/CHANGELOG_STYLE.md
(the release doc; there is no docs/RELEASING.md) says when
GSTACK_MIN_REVISION may be raised.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* refactor(capy): the stale-copy owner action moves from the frozen bootstrapper to bin/gstack-capy-session

The checkout-owned full wrapper reads GSTACK_CAPY_MIN_WRAPPER through
gstack_support_env_get(gstack_source_root) and compares it with the
bootstrapper revision it was handed, so the rule can change without
recopying the Drive skill. The bootstrapper keeps only what a stale checkout
cannot do: clone, fetch, read the remote minimum, fast-forward, exec.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* v1.91.96.0: honest install and self-upgrade on Capy; supported minimum 1.91.96.0

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test: drop the helper-only Capy host fixture test (test-of-test ratchet); lane tests exercise the helper

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test: bound the new sync spawns in the install-verdict and wrapper tests (spawnSync tripwire)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* ci(paid-pr-profile): the vendored Capy skill is free-only; free-only files are not prompts needing paid coverage

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* chore(harness): non-behavioral HARNESS_VERSION decision for the PR-profile free-only rule

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(doctor): lane A runtime and pins cases are platform-neutral (bash paths; a lane-free .bun-version pin)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* docs(designs): field wave plan with amendments and the gate rev 2-3 review record (ARTIFACT_VALID, 3 gate revisions)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(capy-install): follow a project's exact Bun pin above the minimum when gstack has its verified archive (adds Bun 1.4.3)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* docs: the installer follows a verified exact project Bun pin (capy-install, troubleshooting, changelog)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(capy-install): the install reason names the project's pin and gstack's real minimum

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-10-13 14:41:58 +00:00

256 lines
15 KiB
TypeScript

import { describe, expect, test } from 'bun:test';
import * as fs from 'fs';
import * as path from 'path';
import { CASE_TEST_NAMES, fileCaseRegistration } from '../scripts/lib/paid-cases';
import {
PR_PROFILE_CASE_IDS, PR_PROFILE_FILES, PR_PROFILE_MAPS, caseNameAddressable, formatPrCoverageSummary, packageChangeOnlyVersion, selectPrProfile, validatePrProfileInventory,
type PrProfileMaps,
} from '../scripts/test-pr-profile';
const maps: PrProfileMaps = {
e2eTouchfiles: {
'ceo-smoke': ['plan-ceo-review/**'],
'ceo-full': ['plan-ceo-review/**'],
'ceo-periodic': ['plan-ceo-review/**'],
'autoplan-full': ['autoplan/**'],
'browse-smoke': ['browse/**'],
},
tiers: {
'ceo-smoke': 'gate', 'ceo-full': 'gate', 'ceo-periodic': 'periodic',
'autoplan-full': 'periodic', 'browse-smoke': 'gate',
},
judgeTouchfiles: {
'plan-ceo-review/SKILL.md modes': ['plan-ceo-review/**'],
'browse quality': ['browse/**'],
},
globalTouchfiles: ['test/helpers/shared-runner.ts'],
};
const profile = ['ceo-smoke', 'browse-smoke'];
const select = (options: Partial<Parameters<typeof selectPrProfile>[0]> = {}) => selectPrProfile({
maps, profile, selectedE2E: ['ceo-smoke', 'ceo-full', 'ceo-periodic'],
selectedJudges: ['plan-ceo-review/SKILL.md modes'],
changedFiles: ['plan-ceo-review/SKILL.md.tmpl'], ...options,
});
describe('fast PR coverage policy', () => {
test('canonical short probes exist in the unchanged broad gate census', () => {
expect(() => validatePrProfileInventory()).not.toThrow();
expect(PR_PROFILE_CASE_IDS).toContain('plan-review-report');
expect(PR_PROFILE_CASE_IDS).toContain('auq-format-gate');
for (const tier of Object.values(PR_PROFILE_MAPS.tiers)) expect(['gate', 'periodic', 'marathon']).toContain(tier);
});
test('keeps relevant short probes and the failing CEO quality obligation; reports broad work', () => {
const result = select();
expect(result.mode).toBe('pr');
expect(result.e2e).toEqual(['ceo-smoke']);
expect(result.judges).toEqual(['plan-ceo-review/SKILL.md modes']);
expect(result.deferred.map(({ id, tier }) => ({ id, tier }))).toEqual([
{ id: 'ceo-full', tier: 'gate' }, { id: 'ceo-periodic', tier: 'periodic' },
]);
expect(result.needsFullValidation).toBe(false);
});
test('the vendored Capy skill (capy/skill/**) is free-only: no paid case reads it, so it needs no full validation', () => {
const result = select({ selectedE2E: [], selectedJudges: [], changedFiles: ['capy/skill/gstack/SKILL.md', 'capy/skill/gstack/scripts/install.sh'], derived: null });
expect(result.needsFullValidation).toBe(false);
expect(result.missingCoverage).toEqual([]);
expect(result.mode).toBe('pr');
expect(result.e2e).toEqual([]);
const prompt = select({ selectedE2E: [], selectedJudges: [], changedFiles: ['plan-ceo-review/SKILL.md.tmpl'], derived: null });
expect(prompt.needsFullValidation || prompt.deferredPromptFiles.length > 0 || prompt.e2e.length > 0).toBe(true);
});
test('does not add unrelated short probes or drop selected quality judges', () => {
const result = select({ selectedJudges: ['browse quality', 'plan-ceo-review/SKILL.md modes'] });
expect(result.e2e).not.toContain('browse-smoke');
expect(result.judges).toEqual(['browse quality', 'plan-ceo-review/SKILL.md modes']);
});
test('unknown source dependencies restore the full gate and judges, but never launch periodic work', () => {
const result = select({ changedFiles: ['lib/new-runtime.ts'] });
expect(result.mode).toBe('full-fallback');
expect(result.unknownFiles).toEqual(['lib/new-runtime.ts']);
expect(result.e2e).toEqual(['browse-smoke', 'ceo-full', 'ceo-smoke']);
expect(result.judges).toEqual(['browse quality', 'plan-ceo-review/SKILL.md modes']);
expect(result.deferred.map(x => x.id)).toEqual(['autoplan-full', 'ceo-periodic']);
expect(result.reasons[0]).toContain('Unknown dependencies');
});
test('unknown runner helpers and paid test files also trigger broad fallback', () => {
for (const file of ['test/helpers/new-runner.ts', 'test/fixtures/new-prompt.ts', 'test/skill-e2e-new.test.ts', 'bun.lock']) {
expect(select({ changedFiles: [file] }).mode).toBe('full-fallback');
}
});
test('docs, free tests and touchfile-map edits do not accidentally spend on the full gate', () => {
for (const file of ['README.md', 'docs/testing.md', 'VERSION', 'AGENTS.md', 'CLAUDE.md', 'agents-digest/gstack-AGENTS.md', 'test/new-parser.test.ts', 'test/helpers/touchfiles-data.ts']) {
expect(select({ changedFiles: [file], selectedE2E: [], selectedJudges: [] }).mode).toBe('pr');
}
});
test('only verified package version metadata is safe to ignore', () => {
const old = JSON.stringify({ version: '1', scripts: { test: 'bun test' }, dependencies: { bun: '1' } });
expect(packageChangeOnlyVersion(old, old.replace('"version":"1"', '"version":"2"'))).toBe(true);
expect(packageChangeOnlyVersion(old, old.replace('bun test', 'bun skip'))).toBe(false);
expect(packageChangeOnlyVersion(old, old.replace('"bun":"1"', '"bun":"2"'))).toBe(false);
expect(packageChangeOnlyVersion(old, '{}')).toBe(false);
expect(packageChangeOnlyVersion(old, 'broken')).toBe(false);
});
test('a periodic-only prompt reports deferred coverage instead of a quick-check claim', () => {
const result = select({ changedFiles: ['autoplan/SKILL.md.tmpl'], selectedE2E: ['autoplan-full'], selectedJudges: [] });
expect(result.e2e).toEqual([]);
expect(result.deferred.map(x => x.id)).toEqual(['autoplan-full']);
expect(result.missingCoverage).toEqual([]);
expect(result.deferredPromptFiles).toEqual(['autoplan/SKILL.md.tmpl']);
expect(result.needsFullValidation).toBe(false);
});
test('an unrelated retained check does not satisfy a changed prompt', () => {
const result = select({ changedFiles: ['autoplan/sections/phase-close.md'], selectedE2E: ['browse-smoke'], selectedJudges: ['browse quality'] });
expect(result.needsFullValidation).toBe(false);
expect(result.missingCoverage).toEqual([]);
expect(result.deferredPromptFiles).toEqual(['autoplan/sections/phase-close.md']);
});
test('verified template identity covers its generated artifact while reporting the original path', () => {
const generatedMaps = { ...maps,
e2eTouchfiles: { ...maps.e2eTouchfiles, 'generated-broad': ['generated/SKILL.md.tmpl'] },
tiers: { ...maps.tiers, 'generated-broad': 'periodic' as const },
};
const result = select({ maps: generatedMaps, selectedE2E: ['generated-broad'], selectedJudges: [],
changedFiles: ['generated/SKILL.md'], sourceAliases: { 'generated/SKILL.md': 'generated/SKILL.md.tmpl' } });
expect(result.unknownFiles).toEqual([]);
expect(result.deferredPromptFiles).toEqual(['generated/SKILL.md']);
expect(result.needsFullValidation).toBe(false);
expect(select({ maps: generatedMaps, selectedE2E: ['generated-broad'], selectedJudges: [],
changedFiles: ['generated/SKILL.md'] }).needsFullValidation).toBe(true);
});
test('an unknown new skill is visibly unvalidated even after broad fallback', () => {
const result = select({ changedFiles: ['new-skill/SKILL.md.tmpl'] });
expect(result.mode).toBe('full-fallback');
expect(result.needsFullValidation).toBe(true);
});
test('a selected judge alone can cover a changed prompt with broad behavioral work deferred', () => {
const result = select({ selectedE2E: ['ceo-periodic'], selectedJudges: ['plan-ceo-review/SKILL.md modes'] });
expect(result.e2e).toEqual([]);
expect(result.needsFullValidation).toBe(false);
expect(result.deferred).toHaveLength(1);
});
test('a missing selected prompt dependency is detected even when there are no selected cases', () => {
const result = select({ selectedE2E: [], selectedJudges: [] });
expect(result.needsFullValidation).toBe(true);
const globalPrompt = select({ maps: { ...maps, globalTouchfiles: ['plan-ceo-review/**'] }, selectedE2E: [], selectedJudges: [] });
expect(globalPrompt.needsFullValidation).toBe(true);
});
test('null selections expand inventories while an empty selection remains empty', () => {
expect(select({ selectedE2E: null, selectedJudges: null }).e2e).toEqual(['browse-smoke', 'ceo-smoke']);
const empty = select({ selectedE2E: [], selectedJudges: [], changedFiles: ['README.md'] });
expect(empty.e2e).toEqual([]);
expect(empty.judges).toEqual([]);
expect(empty.needsFullValidation).toBe(false);
});
test('normalizes Windows paths and deduplicates selection and changes', () => {
const result = select({ changedFiles: ['plan-ceo-review\\SKILL.md.tmpl', 'plan-ceo-review/SKILL.md.tmpl'], selectedE2E: ['ceo-smoke', 'ceo-smoke'] });
expect(result.e2e).toEqual(['ceo-smoke']);
expect(result.unknownFiles).toEqual([]);
expect(result.needsFullValidation).toBe(false);
});
test('marathon cases are deferred to their non-blocking lane, even on full fallback', () => {
const marathon: PrProfileMaps = { ...maps, tiers: { ...maps.tiers, 'ceo-full': 'marathon' } };
for (const changedFiles of [['plan-ceo-review/SKILL.md.tmpl'], ['lib/new-runtime.ts']]) {
const result = select({ maps: marathon, changedFiles });
expect(result.e2e).not.toContain('ceo-full');
expect(result.deferred.find(({ id }) => id === 'ceo-full')).toEqual({ id: 'ceo-full', tier: 'marathon',
reason: 'Full end-to-end marathon coverage; non-blocking lane, not executed by the PR gate' });
}
expect(() => select({ maps: marathon, profile: ['ceo-full'] })).toThrow('broad gate census');
});
test('every audited PR-profile case is addressable by its Bun test name', () => {
// The PR lane runs each audited file with -t built from CASE_TEST_NAMES[id] ?? id;
// office-hours-auto-mode's test is named differently and matched 0 tests (#3077 eval-slices run 37741434771).
const unaddressable = Object.entries(PR_PROFILE_FILES).flatMap(([file, ids]) => {
const source = fs.readFileSync(path.join(import.meta.dir, '..', file), 'utf8');
const computed = fileCaseRegistration(file, source).computed;
return ids.filter((id) => {
const name = CASE_TEST_NAMES[id] ?? id;
return !caseNameAddressable(name, source) && !(computed && source.includes(`'${name}'`));
}).map(id => `${file}: ${id}`);
});
expect(unaddressable).toEqual([]);
});
test('rejects stale profile IDs, incorrect tiers, missing cadence, and unknown selections', () => {
expect(() => select({ profile: ['missing'] })).toThrow('broad gate census');
expect(() => select({ profile: ['ceo-periodic'] })).toThrow('broad gate census');
expect(() => select({ profile: ['ceo-smoke', 'ceo-smoke'] })).toThrow('Duplicate');
expect(() => select({ maps: { ...maps, tiers: { 'ceo-smoke': 'gate' } } })).toThrow('broad gate census');
expect(() => select({ maps: { ...maps, tiers: { ...maps.tiers, 'ceo-full': undefined! } } })).toThrow('no broad');
expect(() => select({ selectedE2E: ['missing'] })).toThrow('Unregistered');
expect(() => select({ selectedJudges: ['missing judge'] })).toThrow('Unregistered');
});
test('job summary states the mode, case counts and reuse; a fallback names each file with its fix (CEO-13)', () => {
const fallback = select({ changedFiles: ['lib/new-runtime.ts', 'test/fixtures/new.json'] });
const fallbackLines = formatPrCoverageSummary({ profile: 'pr', selection: { e2e: fallback.e2e, judges: fallback.judges }, prCoverage: fallback },
{ total: 9, reused: 4 }).join('\n');
expect(fallbackLines).toContain('- Mode: `full-fallback`');
expect(fallbackLines).toContain('- Selected: 3 E2E case(s), 2 judge(s); 2 deferred');
expect(fallbackLines).toContain('- Reused: 4 of 9 rule/judge record(s)');
expect(fallbackLines).toContain('Full gate restored by 2 file(s) (fix: docs/TESTING_INTERNALS.md#pr-paid-lane-fallback)');
expect(fallbackLines).toContain('`lib/new-runtime.ts` (real unknown dependency): register lib/new-runtime.ts under the cases that consume it');
expect(fallbackLines).toContain('`test/fixtures/new.json` (needs touchfile entry):');
expect(fallbackLines).toContain('FREE_FIXTURES');
const pr = select();
const prLines = formatPrCoverageSummary({ profile: 'pr', selection: { e2e: pr.e2e, judges: pr.judges }, prCoverage: pr }).join('\n');
expect(prLines).toContain('- Mode: `pr`');
expect(prLines).toContain('- Selected: 1 E2E case(s), 1 judge(s); 2 deferred');
expect(prLines).not.toContain('Reused:');
expect(prLines).not.toContain('Full gate restored');
});
test('DX-11: an edited paid test file selects its own name-addressable gate cases outside the profile', () => {
const direct: PrProfileMaps = { ...maps,
e2eTouchfiles: { ...maps.e2eTouchfiles, 'own-named': ['test/skill-e2e-own.test.ts'], 'own-prose': ['test/skill-e2e-own.test.ts'] },
tiers: { ...maps.tiers, 'own-named': 'gate', 'own-prose': 'gate' } };
const readSource = () => "describeE2E('own', () => {\n testIfSelected('own-named', async () => {});\n test('a prose name', async () => {});\n});";
const result = select({ maps: direct, readSource, changedFiles: ['test/skill-e2e-own.test.ts'],
selectedE2E: ['own-named', 'own-prose'], selectedJudges: [] });
expect(result.mode).toBe('pr');
expect(result.e2e).toEqual(['own-named']);
expect(result.directCases).toEqual(['own-named']);
expect(result.deferred.find(item => item.id === 'own-prose')?.reason).toContain("name its Bun test 'own-prose'");
expect(result.reasons).toContain('Edited paid test files select their own gate cases: own-named');
// A dependency edit (not the case's own test file) still keeps the audited profile only.
const viaHelper = select({ maps: { ...direct, e2eTouchfiles: { ...direct.e2eTouchfiles, 'own-named': ['test/skill-e2e-own.test.ts', 'own/**'] } },
readSource, changedFiles: ['own/x.ts'], selectedE2E: ['own-named'], selectedJudges: [] });
expect(viaHelper.e2e).toEqual([]);
});
test('DX-11: name addressing ignores comments and near-miss names', () => {
expect(caseNameAddressable('a-b', " testIfSelected('a-b', async () => {})")).toBe(true);
expect(caseNameAddressable('a-b', ' test(`a-b`, async () => {})')).toBe(true);
expect(caseNameAddressable('a-b', ' testConcurrentIfSelected("a-b", async () => {})')).toBe(true);
expect(caseNameAddressable('a-b', ' * test (`a-b` in E2E_TIERS)')).toBe(false);
expect(caseNameAddressable('a-b', "/* testIfSelected('a-b') */")).toBe(false);
expect(caseNameAddressable('a-b', " testIfSelected('a-bc', async () => {})")).toBe(false);
});
test('the summary lists derived dependents and files no paid case reaches', () => {
const lines = formatPrCoverageSummary({ profile: 'pr', selection: { e2e: ['a'], judges: [] }, prCoverage: { mode: 'dependents', deferred: [], unknownFiles: [],
derivedFiles: [{ file: 'design/src/evolve.ts', e2e: 12, judges: 1 }], noConsumerFiles: ['scripts/typecheck-test.ts'] } }).join('\n');
expect(lines).toContain('- Mode: `dependents`');
expect(lines).toContain(' - `design/src/evolve.ts`: 12 case(s), 1 judge(s)');
expect(lines).toContain('- No paid case reaches: `scripts/typecheck-test.ts`');
});
});