refactor(stammbaum): TestNode type alias drops generation cast (#361)
All checks were successful
CI / Unit & Component Tests (pull_request) Successful in 3m25s
CI / OCR Service Tests (pull_request) Successful in 25s
CI / Backend Unit Tests (pull_request) Successful in 4m14s
CI / fail2ban Regex (pull_request) Successful in 45s
CI / Semgrep Security Scan (pull_request) Successful in 21s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m4s
CI / Unit & Component Tests (push) Successful in 3m49s
CI / OCR Service Tests (push) Successful in 22s
CI / Backend Unit Tests (push) Successful in 3m37s
CI / fail2ban Regex (push) Successful in 44s
CI / Semgrep Security Scan (push) Successful in 22s
CI / Compose Bucket Idempotency (push) Successful in 1m5s
All checks were successful
CI / Unit & Component Tests (pull_request) Successful in 3m25s
CI / OCR Service Tests (pull_request) Successful in 25s
CI / Backend Unit Tests (pull_request) Successful in 4m14s
CI / fail2ban Regex (pull_request) Successful in 45s
CI / Semgrep Security Scan (pull_request) Successful in 21s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m4s
CI / Unit & Component Tests (push) Successful in 3m49s
CI / OCR Service Tests (push) Successful in 22s
CI / Backend Unit Tests (push) Successful in 3m37s
CI / fail2ban Regex (push) Successful in 44s
CI / Semgrep Security Scan (push) Successful in 22s
CI / Compose Bucket Idempotency (push) Successful in 1m5s
Introduces a local `type TestNode = { id: string; generation: number | null }`
so the three AC3 test fixtures can write `generation: null` directly,
without the awkward `as number | null` cast next to the literal `generation:
2`. Sara cycle-3 cosmetic; same predicate, cleaner reading.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit was merged in pull request #693.
This commit is contained in:
@@ -7,6 +7,11 @@ import canonicalFixture from './stammbaum.json';
|
||||
// buildLayout.test.ts relies on. Adding or removing a gate without updating
|
||||
// these tests is the failure we want to catch.
|
||||
|
||||
// Lets `generation: null` typecheck without an inline `as number | null`
|
||||
// cast — the AC3 predicate cares specifically about the unseeded-node
|
||||
// branch, so the test fixtures need to express it directly.
|
||||
type TestNode = { id: string; generation: number | null };
|
||||
|
||||
function networkWithNodes(count: number) {
|
||||
return {
|
||||
nodes: Array.from({ length: count }, (_, i) => ({ id: `n${i}`, generation: i % 6 })),
|
||||
@@ -87,9 +92,9 @@ describe('findAc3Candidates — AC3 revisit-trigger predicate (#361, Elicit cycl
|
||||
});
|
||||
|
||||
it('flags_an_unseeded_person_whose_seeded_parent_is_in_graph_and_who_has_a_spouse', () => {
|
||||
const nodes = [
|
||||
const nodes: TestNode[] = [
|
||||
{ id: 'parent', generation: 2 },
|
||||
{ id: 'child', generation: null as number | null },
|
||||
{ id: 'child', generation: null },
|
||||
{ id: 'spouse', generation: 3 }
|
||||
];
|
||||
const edges = [parentEdge('parent', 'child'), spouseEdge('child', 'spouse')];
|
||||
@@ -100,9 +105,9 @@ describe('findAc3Candidates — AC3 revisit-trigger predicate (#361, Elicit cycl
|
||||
// Unseeded + seeded parent in graph, but no SPOUSE_OF — not AC3 (the
|
||||
// layout branch that hurts is the *loose spouse* branch). The capture
|
||||
// warn must not fire here.
|
||||
const nodes = [
|
||||
const nodes: TestNode[] = [
|
||||
{ id: 'parent', generation: 2 },
|
||||
{ id: 'child', generation: null as number | null }
|
||||
{ id: 'child', generation: null }
|
||||
];
|
||||
const edges = [parentEdge('parent', 'child')];
|
||||
expect(findAc3Candidates({ nodes, edges })).toEqual([]);
|
||||
@@ -112,9 +117,9 @@ describe('findAc3Candidates — AC3 revisit-trigger predicate (#361, Elicit cycl
|
||||
// "Parents in graph" in the AC3 sense means at least one *seeded*
|
||||
// parent. If both parent and child are unseeded the heuristic
|
||||
// fallback already handles the case without AC3 ever firing.
|
||||
const nodes = [
|
||||
{ id: 'parent', generation: null as number | null },
|
||||
{ id: 'child', generation: null as number | null },
|
||||
const nodes: TestNode[] = [
|
||||
{ id: 'parent', generation: null },
|
||||
{ id: 'child', generation: null },
|
||||
{ id: 'spouse', generation: 3 }
|
||||
];
|
||||
const edges = [parentEdge('parent', 'child'), spouseEdge('child', 'spouse')];
|
||||
|
||||
Reference in New Issue
Block a user