@opensip-cli/checks-typescript 0.1.6 → 0.1.8

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.
Files changed (78) hide show
  1. package/README.md +2 -2
  2. package/dist/__tests__/all-checks-execute.test.js +3 -0
  3. package/dist/__tests__/all-checks-execute.test.js.map +1 -1
  4. package/dist/__tests__/behavior-fixtures-2.test.js +3 -0
  5. package/dist/__tests__/behavior-fixtures-2.test.js.map +1 -1
  6. package/dist/__tests__/behavior-fixtures-3.test.js +3 -0
  7. package/dist/__tests__/behavior-fixtures-3.test.js.map +1 -1
  8. package/dist/__tests__/behavior-fixtures-4.test.js +3 -0
  9. package/dist/__tests__/behavior-fixtures-4.test.js.map +1 -1
  10. package/dist/__tests__/behavior-fixtures-5.test.js +3 -0
  11. package/dist/__tests__/behavior-fixtures-5.test.js.map +1 -1
  12. package/dist/__tests__/behavior-fixtures-6.test.js +3 -0
  13. package/dist/__tests__/behavior-fixtures-6.test.js.map +1 -1
  14. package/dist/__tests__/behavior-fixtures.test.js +4 -0
  15. package/dist/__tests__/behavior-fixtures.test.js.map +1 -1
  16. package/dist/__tests__/branch-fixtures-2.test.js +3 -0
  17. package/dist/__tests__/branch-fixtures-2.test.js.map +1 -1
  18. package/dist/__tests__/branch-fixtures-3.test.js +44 -0
  19. package/dist/__tests__/branch-fixtures-3.test.js.map +1 -1
  20. package/dist/__tests__/branch-fixtures.test.js +4 -3
  21. package/dist/__tests__/branch-fixtures.test.js.map +1 -1
  22. package/dist/__tests__/host-tool-runtime-import-boundary.test.js +1 -1
  23. package/dist/__tests__/host-tool-runtime-import-boundary.test.js.map +1 -1
  24. package/dist/__tests__/null-safety-typed.test.d.ts +2 -0
  25. package/dist/__tests__/null-safety-typed.test.d.ts.map +1 -0
  26. package/dist/__tests__/null-safety-typed.test.js +112 -0
  27. package/dist/__tests__/null-safety-typed.test.js.map +1 -0
  28. package/dist/__tests__/shared-program.test.d.ts +2 -0
  29. package/dist/__tests__/shared-program.test.d.ts.map +1 -0
  30. package/dist/__tests__/shared-program.test.js +41 -0
  31. package/dist/__tests__/shared-program.test.js.map +1 -0
  32. package/dist/__tests__/shipped-allowlists-are-generic.test.d.ts +2 -0
  33. package/dist/__tests__/shipped-allowlists-are-generic.test.d.ts.map +1 -0
  34. package/dist/__tests__/shipped-allowlists-are-generic.test.js +64 -0
  35. package/dist/__tests__/shipped-allowlists-are-generic.test.js.map +1 -0
  36. package/dist/__tests__/subprocess-correlation-required.test.d.ts +2 -0
  37. package/dist/__tests__/subprocess-correlation-required.test.d.ts.map +1 -0
  38. package/dist/__tests__/subprocess-correlation-required.test.js +114 -0
  39. package/dist/__tests__/subprocess-correlation-required.test.js.map +1 -0
  40. package/dist/checks/architecture/host-tool-runtime-import-boundary.d.ts.map +1 -1
  41. package/dist/checks/architecture/host-tool-runtime-import-boundary.js +2 -1
  42. package/dist/checks/architecture/host-tool-runtime-import-boundary.js.map +1 -1
  43. package/dist/checks/architecture/index.d.ts +2 -0
  44. package/dist/checks/architecture/index.d.ts.map +1 -1
  45. package/dist/checks/architecture/index.js +2 -0
  46. package/dist/checks/architecture/index.js.map +1 -1
  47. package/dist/checks/architecture/no-run-done-result.d.ts +27 -0
  48. package/dist/checks/architecture/no-run-done-result.d.ts.map +1 -0
  49. package/dist/checks/architecture/no-run-done-result.js +120 -0
  50. package/dist/checks/architecture/no-run-done-result.js.map +1 -0
  51. package/dist/checks/architecture/subprocess-correlation-required.d.ts +28 -0
  52. package/dist/checks/architecture/subprocess-correlation-required.d.ts.map +1 -0
  53. package/dist/checks/architecture/subprocess-correlation-required.js +159 -0
  54. package/dist/checks/architecture/subprocess-correlation-required.js.map +1 -0
  55. package/dist/checks/quality/code-structure/duplicate-utility-functions.d.ts +13 -1
  56. package/dist/checks/quality/code-structure/duplicate-utility-functions.d.ts.map +1 -1
  57. package/dist/checks/quality/code-structure/duplicate-utility-functions.js +7 -3
  58. package/dist/checks/quality/code-structure/duplicate-utility-functions.js.map +1 -1
  59. package/dist/checks/quality/data-integrity/null-safety.d.ts +63 -2
  60. package/dist/checks/quality/data-integrity/null-safety.d.ts.map +1 -1
  61. package/dist/checks/quality/data-integrity/null-safety.js +191 -102
  62. package/dist/checks/quality/data-integrity/null-safety.js.map +1 -1
  63. package/dist/checks/quality/patterns/result-pattern-consistency.d.ts +21 -0
  64. package/dist/checks/quality/patterns/result-pattern-consistency.d.ts.map +1 -1
  65. package/dist/checks/quality/patterns/result-pattern-consistency.js +16 -15
  66. package/dist/checks/quality/patterns/result-pattern-consistency.js.map +1 -1
  67. package/dist/checks/resilience/no-raw-fetch.d.ts +14 -0
  68. package/dist/checks/resilience/no-raw-fetch.d.ts.map +1 -1
  69. package/dist/checks/resilience/no-raw-fetch.js +7 -7
  70. package/dist/checks/resilience/no-raw-fetch.js.map +1 -1
  71. package/dist/display/architecture.d.ts.map +1 -1
  72. package/dist/display/architecture.js +2 -0
  73. package/dist/display/architecture.js.map +1 -1
  74. package/dist/shared/type-program.d.ts +23 -0
  75. package/dist/shared/type-program.d.ts.map +1 -0
  76. package/dist/shared/type-program.js +35 -0
  77. package/dist/shared/type-program.js.map +1 -0
  78. package/package.json +5 -5
@@ -0,0 +1,41 @@
1
+ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { RunScope, runWithScope } from '@opensip-cli/core';
5
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
6
+ import { getSharedTypeCheckedProgram } from '../shared/type-program.js';
7
+ let dir;
8
+ let file;
9
+ beforeEach(() => {
10
+ dir = mkdtempSync(join(tmpdir(), 'opensip-shared-prog-'));
11
+ file = join(dir, 'a.ts');
12
+ writeFileSync(file, 'export const x: string | null = null;\n');
13
+ });
14
+ afterEach(() => {
15
+ rmSync(dir, { recursive: true, force: true });
16
+ });
17
+ describe('getSharedTypeCheckedProgram', () => {
18
+ it('builds the Program once per run and reuses it across calls (memoized on the subscope cell)', async () => {
19
+ const scope = new RunScope();
20
+ // Minimal fitness subscope: the helper only reads `fitness.tsProgram`.
21
+ Object.assign(scope, { fitness: { tsProgram: { value: undefined } } });
22
+ await runWithScope(scope, () => {
23
+ const first = getSharedTypeCheckedProgram([file]);
24
+ const second = getSharedTypeCheckedProgram([file]);
25
+ expect(second).toBe(first); // same instance → built exactly once per run
26
+ return Promise.resolve();
27
+ });
28
+ });
29
+ it('builds a fresh, uncached Program when the run has no fitness subscope cell', async () => {
30
+ // A bare scope (no fitness subscope) overrides any ambient test scope; with
31
+ // no cell to memoize into, each call builds a fresh Program.
32
+ const scope = new RunScope();
33
+ await runWithScope(scope, () => {
34
+ const a = getSharedTypeCheckedProgram([file]);
35
+ const b = getSharedTypeCheckedProgram([file]);
36
+ expect(a).not.toBe(b);
37
+ return Promise.resolve();
38
+ });
39
+ });
40
+ });
41
+ //# sourceMappingURL=shared-program.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-program.test.js","sourceRoot":"","sources":["../../src/__tests__/shared-program.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAErE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAExE,IAAI,GAAW,CAAC;AAChB,IAAI,IAAY,CAAC;AAEjB,UAAU,CAAC,GAAG,EAAE;IACd,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAC1D,IAAI,GA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AAC,CAAC;YAC9C,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACtB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shipped-allowlists-are-generic.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shipped-allowlists-are-generic.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/shipped-allowlists-are-generic.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @fileoverview De-leak guard (b): the hardcoded allowlists shipped inside the
3
+ * generic @opensip-cli/checks-* packs must contain only language/library-generic
4
+ * entries — never project-specific symbols carried over from the private
5
+ * codebase this tool was extracted from. A leaked safe-symbol silently
6
+ * suppresses real findings in any adopter that happens to use that name.
7
+ *
8
+ * Companion to the source-text guard (a) in
9
+ * opensip-cli/fit/checks/shipped-checks-must-be-generic.mjs. This one inspects
10
+ * the live exported data structures, so it catches a leak the moment it is added
11
+ * to an array — independent of the dogfood run.
12
+ */
13
+ import { describe, expect, it } from 'vitest';
14
+ import { DOMAIN_SPECIFIC_FUNCTION_NAMES } from '../checks/quality/code-structure/duplicate-utility-functions.js';
15
+ import { SAFE_BUILDER_PREFIXES, SAFE_METHOD_PREFIXES, } from '../checks/quality/data-integrity/null-safety.js';
16
+ import { THROW_ALLOWED_PATHS } from '../checks/quality/patterns/result-pattern-consistency.js';
17
+ /**
18
+ * Distinctive project-specific identifiers / brand tokens from the original
19
+ * (pre-open-source) private codebase. None may appear in ANY shipped allowlist;
20
+ * adopters supply their own via recipe config (`additionalSafeBuilders`, etc.).
21
+ *
22
+ * Deliberately limited to UNAMBIGUOUS identifiers: generic-sounding names that
23
+ * legitimately appear in some allowlists (`getConfig`, `getLogger` are valid
24
+ * duplicate-name exemptions in DOMAIN_SPECIFIC_FUNCTION_NAMES) are NOT listed, so
25
+ * this stays false-positive-free.
26
+ */
27
+ const FOREIGN_ALLOWLIST_TOKEN = /Escrow|I18nError|getSqlite|getDatabase|getRegistry|getSync|getTenantId|TypedEventBus|CredentialConfig|ContextManager|stripThinkTags|getNumberFormatter|getDateFormatter|formatRelative|ensureError|extractErrorMessage|chronoswap|sanitizeForPrompt/i;
28
+ /**
29
+ * The only bare (non-member, non-call) identifiers allowed in
30
+ * SAFE_BUILDER_PREFIXES: documented library entry points. Every other entry
31
+ * must be member-qualified (`Object.`, `db.`) or a constructor/call (`new URL(`,
32
+ * `prepare(`). A bare camelCase identifier is almost always a project-specific
33
+ * getter and belongs in recipe config, not the shipped pack.
34
+ */
35
+ const REVIEWED_BARE_LIBRARY_BUILDERS = new Set(['createQueryBuilder', 'getRepository']); // TypeORM
36
+ function asStrings(entries) {
37
+ return [...entries].map((e) => (e instanceof RegExp ? e.source : e));
38
+ }
39
+ describe('shipped allowlists are generic (de-leak guard b)', () => {
40
+ // Count gate: any add/remove to the shipped safe-builder allowlist trips this,
41
+ // forcing the author to bump the count AND have a reviewer confirm the new
42
+ // entry is genuinely generic (not a project-specific symbol that belongs in
43
+ // an adopter's `additionalSafeBuilders` recipe config).
44
+ it('SAFE_BUILDER_PREFIXES holds exactly the reviewed number of generic entries', () => {
45
+ expect(SAFE_BUILDER_PREFIXES).toHaveLength(54);
46
+ });
47
+ it('every SAFE_BUILDER_PREFIXES entry is a language/library construct, not a bare project getter', () => {
48
+ const bareLeaks = SAFE_BUILDER_PREFIXES.filter((e) => !e.includes('.') && !e.includes('(') && !REVIEWED_BARE_LIBRARY_BUILDERS.has(e));
49
+ expect(bareLeaks).toEqual([]);
50
+ });
51
+ it('no shipped allowlist contains a foreign project-specific identifier', () => {
52
+ const arrays = {
53
+ SAFE_BUILDER_PREFIXES: asStrings(SAFE_BUILDER_PREFIXES),
54
+ SAFE_METHOD_PREFIXES: asStrings(SAFE_METHOD_PREFIXES),
55
+ THROW_ALLOWED_PATHS: asStrings(THROW_ALLOWED_PATHS),
56
+ DOMAIN_SPECIFIC_FUNCTION_NAMES: asStrings(DOMAIN_SPECIFIC_FUNCTION_NAMES),
57
+ };
58
+ for (const [name, entries] of Object.entries(arrays)) {
59
+ const leaked = entries.filter((e) => FOREIGN_ALLOWLIST_TOKEN.test(e));
60
+ expect(leaked, `${name} must not contain foreign-domain symbols`).toEqual([]);
61
+ }
62
+ });
63
+ });
64
+ //# sourceMappingURL=shipped-allowlists-are-generic.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shipped-allowlists-are-generic.test.js","sourceRoot":"","sources":["../../src/__tests__/shipped-allowlists-are-generic.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,8BAA8B,EAAE,MAAM,iEAAiE,CAAC;AACjH,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAE/F;;;;;;;;;GASG;AACH,MAAM,uBAAuB,GAC3B,sPAAsP,CAAC;AAEzP;;;;;;GAMG;AACH,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,UAAU;AAEnG,SAAS,SAAS,CAAC,OAAkC;IACnD,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,QAAQ,CAAC,kDAAkD,EAAE,GAAG,EAAE;IAChE,+EAA+E;IAC/E,2EAA2E;IAC3E,4EAA4E;I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ation-required.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subprocess-correlation-required.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/subprocess-correlation-required.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * @fileoverview Behaviour tests for the subprocess-correlation-required
3
+ * architecture check (ADR-0054 readiness; subprocess-correlation-telemetry spec).
4
+ */
5
+ import { runCheckOnFixture } from '@opensip-cli/test-support';
6
+ import { describe, expect, it } from 'vitest';
7
+ import { analyzeSubprocessCorrelationRequired } from '../checks/architecture/subprocess-correlation-required.js';
8
+ import { checks } from '../index.js';
9
+ const SHARD_RUNNER = 'packages/graph/engine/src/cli/orchestrate/shard-runner.ts';
10
+ const WORKSPACE_RUNNER = 'packages/graph/engine/src/cli/workspace-runner.ts';
11
+ const HEAP_PREFLIGHT = 'packages/graph/engine/src/cli/heap-preflight.ts';
12
+ const OUT_OF_SCOPE = 'packages/core/src/runtime/subprocess-transport.ts';
13
+ function check() {
14
+ const c = checks.find((x) => x.config.slug === 'subprocess-correlation-required');
15
+ if (!c)
16
+ throw new Error('check not found: subprocess-correlation-required');
17
+ return c;
18
+ }
19
+ async function findingsFor(file) {
20
+ const run = await runCheckOnFixture(check(), { files: [file] });
21
+ return run.findings.length;
22
+ }
23
+ describe('analyzeSubprocessCorrelationRequired (AST)', () => {
24
+ it('flags a worker spawn that forwards env but not correlation', () => {
25
+ const v = analyzeSubprocessCorrelationRequired([
26
+ "import { spawn } from 'node:child_process';",
27
+ 'export function spawnShardWorker(cliScript: string, specPath: string): void {',
28
+ " spawn(process.execPath, [cliScript, 'graph-shard-worker', specPath], {",
29
+ ' env: { ...process.env },',
30
+ ' });',
31
+ '}',
32
+ ].join('\n'), SHARD_RUNNER);
33
+ expect(v).toHaveLength(1);
34
+ expect(v[0]?.message).toContain('RunCorrelation');
35
+ expect(v[0]?.severity).toBe('error');
36
+ });
37
+ it('allows a worker spawn that merges correlationToEnv', () => {
38
+ const v = analyzeSubprocessCorrelationRequired([
39
+ "import { spawn } from 'node:child_process';",
40
+ "import { correlationToEnv, currentScope } from '@opensip-cli/core';",
41
+ 'export function spawnShardWorker(cliScript: string, specPath: string): void {',
42
+ ' const correlation = currentScope()?.correlation;',
43
+ " spawn(process.execPath, [cliScript, 'graph-shard-worker', specPath], {",
44
+ ' env: { ...process.env, ...(correlation ? correlationToEnv(correlation) : {}) },',
45
+ ' });',
46
+ '}',
47
+ ].join('\n'), SHARD_RUNNER);
48
+ expect(v).toEqual([]);
49
+ });
50
+ it('allows a worker fork that writes a correlation field on the descriptor', () => {
51
+ const v = analyzeSubprocessCorrelationRequired([
52
+ "import { fork } from 'node:child_process';",
53
+ 'export function forkWorker(command: string, specPath: string, correlation: unknown): void {',
54
+ ' const descriptor = {',
55
+ " argv: ['graph-run-worker', specPath],",
56
+ ' correlation,',
57
+ ' };',
58
+ ' void descriptor;',
59
+ " fork(command, ['graph-run-worker', specPath], { env: { ...process.env } });",
60
+ '}',
61
+ ].join('\n'), SHARD_RUNNER);
62
+ expect(v).toEqual([]);
63
+ });
64
+ it('does NOT flag a plain (non-worker) subcommand spawn', () => {
65
+ const v = analyzeSubprocessCorrelationRequired([
66
+ "import { spawn } from 'node:child_process';",
67
+ 'export function spawnGraphChild(cliScript: string, rootDir: string): void {',
68
+ " spawn(process.execPath, [cliScript, 'graph', rootDir, '--json'], {",
69
+ ' env: process.env,',
70
+ ' });',
71
+ '}',
72
+ ].join('\n'), WORKSPACE_RUNNER);
73
+ expect(v).toEqual([]);
74
+ });
75
+ it('does NOT flag a same-process re-exec (no worker subcommand literal)', () => {
76
+ const v = analyzeSubprocessCorrelationRequired([
77
+ "import { spawn } from 'node:child_process';",
78
+ 'export function elevate(): void {',
79
+ ' spawn(process.execPath, process.argv.slice(1), {',
80
+ ' env: { ...process.env, NODE_OPTIONS: "--max-old-space-size=4096" },',
81
+ ' stdio: "inherit",',
82
+ ' });',
83
+ '}',
84
+ ].join('\n'), HEAP_PREFLIGHT);
85
+ expect(v).toEqual([]);
86
+ });
87
+ });
88
+ describe('subprocess-correlation-required (gate)', () => {
89
+ it('flags an uncorrelated worker spawn under packages/graph', async () => {
90
+ expect(await findingsFor({
91
+ path: SHARD_RUNNER,
92
+ content: [
93
+ "import { spawn } from 'node:child_process';",
94
+ 'export function spawnShardWorker(cliScript: string, specPath: string): void {',
95
+ " spawn(process.execPath, [cliScript, 'graph-shard-worker', specPath], {",
96
+ ' env: { ...process.env },',
97
+ ' });',
98
+ '}',
99
+ ].join('\n'),
100
+ })).toBeGreaterThanOrEqual(1);
101
+ });
102
+ it('does NOT flag spawn/fork sites outside the gated packages', async () => {
103
+ expect(await findingsFor({
104
+ path: OUT_OF_SCOPE,
105
+ content: [
106
+ "import { fork } from 'node:child_process';",
107
+ 'export function forkWorker(command: string, specPath: string): void {',
108
+ " fork(command, ['graph-run-worker', specPath], { env: { ...process.env } });",
109
+ '}',
110
+ ].join('\n'),
111
+ })).toBe(0);
112
+ });
113
+ });
114
+ //# sourceMappingURL=subprocess-correlation-required.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subprocess-correlation-required.test.js","sourceRoot":"","sources":["../../src/__tests__/subprocess-correlation-required.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAoB,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,oCAAoC,EAAE,MAAM,2DAA2D,CAAC;AACjH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,YAAY,GAAG,2DAA2D,CAAC;AACjF,MAAM,gBAAgB,GAAG,mDAAmD,CAAC;AAC7E,MAAM,cAAc,GAAG,iDAAiD,CAAC;AACzE,MAAM,YAAY,GAAG,mDAAmD,CAAC;AAEzE,SAAS,KAAK;IACZ,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC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MAAM,WAAW,CAAC;YAChB,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE;gBACP,6CAA6C;gBAC7C,+EAA+E;gBAC/E,0EAA0E;gBAC1E,8BAA8B;gBAC9B,OAAO;gBACP,GAAG;aACJ,CAAC,IAAI,CAAC,IAAI,CAAC;SACb,CAAC,CACH,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QACzE,MAAM,CACJ,MAAM,WAAW,CAAC;YAChB,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE;gBACP,4CAA4C;gBAC5C,uEAAuE;gBACvE,+EAA+E;gBAC/E,GAAG;aACJ,CAAC,IAAI,CAAC,IAAI,CAAC;SACb,CAAC,CACH,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"host-tool-runtime-import-boundary.d.ts","sourceRoot":"","sources":["../../../src/checks/architecture/host-tool-runtime-import-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA2EpF,wEAAwE;AACxE,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,cAAc,EAAE,CAyClB;AAED,eAAO,MAAM,6BAA6B,sCAYxC,CAAC"}
1
+ {"version":3,"file":"host-tool-runtime-import-boundary.d.ts","sourceRoot":"","sources":["../../../src/checks/architecture/host-tool-runtime-import-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA4EpF,wEAAwE;AACxE,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,cAAc,EAAE,CAyClB;AAED,eAAO,MAAM,6BAA6B,sCAYxC,CAAC"}
@@ -17,6 +17,7 @@ const IMPORT_RUNTIME = 'importToolRuntime';
17
17
  const POLICY_HELPER = 'hostRuntimeImportPolicyFor';
18
18
  const ALLOWED_CALLSITE_SUFFIXES = new Set([
19
19
  'packages/cli/src/bootstrap/admit-tool-package.ts',
20
+ 'packages/cli/src/bootstrap/register-tools.ts',
20
21
  'packages/cli/src/bootstrap/register-tools-discovery.ts',
21
22
  ]);
22
23
  function normalized(path) {
@@ -103,7 +104,7 @@ export function analyzeHostToolRuntimeImportBoundary(content, filePath) {
103
104
  `(ADR-0054 transition). Found host-process runtime import in ${normalized(filePath)}.`,
104
105
  severity: 'error',
105
106
  line,
106
- suggestion: 'Route tool runtime loading through admit-tool-package/register-tools-discovery, or the ADR-0054 worker boundary.',
107
+ suggestion: 'Route tool runtime loading through admit-tool-package/register-tools, or the ADR-0054 worker boundary.',
107
108
  });
108
109
  }
109
110
  else if (node.arguments.length < 2 || !isPolicyArg(node.arguments[1])) {
@@ -1 +1 @@
1
- {"version":3,"file":"host-tool-runtime-import-boundary.js","sourceRoot":"","sources":["../../../src/checks/architecture/host-tool-runtime-import-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,4LAA4L;AAC5L,OAAO,EAAE,WAAW,EAAE,UAAU,EAAuB,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAC1C,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAC3C,MAAM,aAAa,GAAG,4BAA4B,CAAC;AAEnD,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACxC,kDAAkD;IAClD,wDAAwD;CACzD,CAAC,CAAC;AAEH,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI,CAAC,UAAU,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C,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACxE,UAAU,CAAC,IAAI,CAAC;wBACd,OAAO,EACL,6EAA6E;4BAC7E,+EAA+E;wBACjF,QAAQ,EAAE,OAAO;wBACjB,IAAI;wBACJ,UAAU,EACR,gHAAgH;qBACnH,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QACD,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC;IACF,KAAK,CAAC,UAAU,CAAC,CAAC;IAClB,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CAAC;IACvD,EAAE,EAAE,sCAAsC;IAC1C,IAAI,EAAE,mCAAmC;IACzC,WAAW,EACT,wHAAwH;IAC1H,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE;IAC3D,IAAI,EAAE,CAAC,cAAc,CAAC;IACtB,SAAS,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;IACxB,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;QAC7B,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,EAAE,CAAC;QACrF,OAAO,oCAAoC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACjE,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"host-tool-runtime-import-boundary.js","sourceRoot":"","sources":["../../../src/checks/architecture/host-tool-runtime-import-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,4LAA4L;AAC5L,OAAO,EAAE,WAAW,EAAE,UAAU,EAAuB,MAAM,sBA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AC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,EAAE,CAAC;QACrF,OAAO,oCAAoC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACjE,CAAC;CACF,CAAC,CAAC"}
@@ -5,7 +5,9 @@ export * from './host-tool-runtime-import-boundary.js';
5
5
  export * from './missing-type-exports.js';
6
6
  export * from './module-coupling-fan-out.js';
7
7
  export * from './no-bootstrap-tool-import.js';
8
+ export * from './no-run-done-result.js';
8
9
  export * from './package-json-exports-field.js';
9
10
  export * from './phantom-dependency-detection.js';
11
+ export * from './subprocess-correlation-required.js';
10
12
  export * from './tsconfig-extends-validation.js';
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/checks/architecture/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/checks/architecture/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC"}
@@ -5,7 +5,9 @@ export * from './host-tool-runtime-import-boundary.js';
5
5
  export * from './missing-type-exports.js';
6
6
  export * from './module-coupling-fan-out.js';
7
7
  export * from './no-bootstrap-tool-import.js';
8
+ export * from './no-run-done-result.js';
8
9
  export * from './package-json-exports-field.js';
9
10
  export * from './phantom-dependency-detection.js';
11
+ export * from './subprocess-correlation-required.js';
10
12
  export * from './tsconfig-extends-validation.js';
11
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/checks/architecture/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/checks/architecture/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @fileoverview Run commands render via RunPresentation — no per-tool `*DoneResult`.
3
+ *
4
+ * The envelope-first-presentation plan (ADR-0011) collapsed the three
5
+ * near-identical per-tool run-result interfaces (one each for fit/sim/graph) into
6
+ * a single render-only `RunPresentation` (`type: 'run-presentation'`) on the
7
+ * `CommandResult` union. Each of those interfaces only wrapped a `SignalEnvelope`
8
+ * plus render-only adjuncts, so the union grew one variant per tool and
9
+ * `resultToView` carried one near-duplicate render case per tool. They were
10
+ * hard-removed in RP-3.
11
+ *
12
+ * This check guards the `@opensip-cli/contracts` command-result surface against a
13
+ * regression: re-declaring a per-tool run done-result interface/type (a name
14
+ * ending `…DoneResult` for fit/sim/graph) OR a discriminator property
15
+ * `type: 'fit-done' | 'sim-done' | 'graph-done'`. Run commands must render through
16
+ * the one `RunPresentation` variant.
17
+ *
18
+ * Path-gated to `packages/contracts/src/` (the contract surface) and test-exempt.
19
+ * AST-based so a `*-done` string appearing as TEXT (a comment, a doc example, an
20
+ * unrelated string) is not flagged — only a real type/interface declaration or a
21
+ * `type:` discriminator literal in a type declaration counts.
22
+ */
23
+ import { type CheckViolation } from '@opensip-cli/fitness';
24
+ /** Pure analysis over a parsed source file. Exported for unit tests. */
25
+ export declare function analyzeNoRunDoneResult(content: string, filePath: string): CheckViolation[];
26
+ export declare const noRunDoneResult: import("@opensip-cli/fitness").Check;
27
+ //# sourceMappingURL=no-run-done-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-run-done-result.d.ts","sourceRoot":"","sources":["../../../src/checks/architecture/no-run-done-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA0CpF,wEAAwE;AACxE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,EAAE,CAoC1F;AAED,eAAO,MAAM,eAAe,sCAqB1B,CAAC"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * @fileoverview Run commands render via RunPresentation — no per-tool `*DoneResult`.
3
+ *
4
+ * The envelope-first-presentation plan (ADR-0011) collapsed the three
5
+ * near-identical per-tool run-result interfaces (one each for fit/sim/graph) into
6
+ * a single render-only `RunPresentation` (`type: 'run-presentation'`) on the
7
+ * `CommandResult` union. Each of those interfaces only wrapped a `SignalEnvelope`
8
+ * plus render-only adjuncts, so the union grew one variant per tool and
9
+ * `resultToView` carried one near-duplicate render case per tool. They were
10
+ * hard-removed in RP-3.
11
+ *
12
+ * This check guards the `@opensip-cli/contracts` command-result surface against a
13
+ * regression: re-declaring a per-tool run done-result interface/type (a name
14
+ * ending `…DoneResult` for fit/sim/graph) OR a discriminator property
15
+ * `type: 'fit-done' | 'sim-done' | 'graph-done'`. Run commands must render through
16
+ * the one `RunPresentation` variant.
17
+ *
18
+ * Path-gated to `packages/contracts/src/` (the contract surface) and test-exempt.
19
+ * AST-based so a `*-done` string appearing as TEXT (a comment, a doc example, an
20
+ * unrelated string) is not flagged — only a real type/interface declaration or a
21
+ * `type:` discriminator literal in a type declaration counts.
22
+ */
23
+ // @fitness-ignore-file shipped-checks-must-be-generic -- opensip-internal dogfood guard for the envelope-first-presentation contract surface; AST precision keeps it from flagging the `*-done` literals that legitimately appear in prose. Needs @opensip-cli/lang-typescript, which a project-local .mjs cannot import.
24
+ import { defineCheck, isTestFile } from '@opensip-cli/fitness';
25
+ import { getSharedSourceFile } from '@opensip-cli/lang-typescript';
26
+ import * as ts from 'typescript';
27
+ /** The contract surface this check guards. */
28
+ const CONTRACTS_SRC_PATH = 'packages/contracts/src/';
29
+ /** A re-introduced per-tool run done-result type name (fit/sim/graph). */
30
+ const DONE_RESULT_NAME_RE = /^(?:Fit|Sim|Graph)DoneResult$/;
31
+ /** A re-introduced per-tool run done-result discriminator literal. */
32
+ const DONE_RESULT_DISCRIMINATOR = new Set([
33
+ 'fit-done',
34
+ 'sim-done',
35
+ 'graph-done',
36
+ ]);
37
+ const GUIDANCE = 'Run commands render via the single RunPresentation variant (ADR-0011 / ' +
38
+ 'envelope-first-presentation plan); do not re-introduce per-tool *DoneResult types.';
39
+ function normalized(path) {
40
+ return path.replaceAll('\\', '/');
41
+ }
42
+ /** A `type:` property whose value is a `fit-done|sim-done|graph-done` string literal. */
43
+ function isDoneDiscriminatorMember(member) {
44
+ if (!ts.isPropertySignature(member) || member.type === undefined)
45
+ return false;
46
+ if (!ts.isIdentifier(member.name) || member.name.text !== 'type')
47
+ return false;
48
+ if (!ts.isLiteralTypeNode(member.type) || !ts.isStringLiteral(member.type.literal)) {
49
+ return false;
50
+ }
51
+ return DONE_RESULT_DISCRIMINATOR.has(member.type.literal.text);
52
+ }
53
+ /** Walk a type node's members (interface body or type-literal) for a done discriminator. */
54
+ function membersOf(node) {
55
+ if (ts.isInterfaceDeclaration(node))
56
+ return node.members;
57
+ if (ts.isTypeAliasDeclaration(node) && ts.isTypeLiteralNode(node.type))
58
+ return node.type.members;
59
+ return undefined;
60
+ }
61
+ /** Pure analysis over a parsed source file. Exported for unit tests. */
62
+ export function analyzeNoRunDoneResult(content, filePath) {
63
+ const violations = [];
64
+ const sourceFile = getSharedSourceFile(filePath, content);
65
+ if (!sourceFile)
66
+ return violations;
67
+ const lineOf = (node) => sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1;
68
+ const visit = (node) => {
69
+ if (ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) {
70
+ const name = node.name.text;
71
+ if (DONE_RESULT_NAME_RE.test(name)) {
72
+ violations.push({
73
+ filePath,
74
+ line: lineOf(node),
75
+ message: `Type '${name}' re-introduces a per-tool run done-result. ${GUIDANCE}`,
76
+ severity: 'error',
77
+ suggestion: 'Render the run via the RunPresentation variant on CommandResult.',
78
+ });
79
+ }
80
+ else {
81
+ const members = membersOf(node);
82
+ if (members?.some(isDoneDiscriminatorMember)) {
83
+ violations.push({
84
+ filePath,
85
+ line: lineOf(node),
86
+ message: `Type '${name}' declares a per-tool run done-result discriminator. ${GUIDANCE}`,
87
+ severity: 'error',
88
+ suggestion: "Use the shared `type: 'run-presentation'` run variant instead.",
89
+ });
90
+ }
91
+ }
92
+ }
93
+ ts.forEachChild(node, visit);
94
+ };
95
+ visit(sourceFile);
96
+ return violations;
97
+ }
98
+ export const noRunDoneResult = defineCheck({
99
+ id: 'a3d9f1c4-7b2e-4f6a-9c1d-8e5b0a2f4d63',
100
+ slug: 'architecture-no-run-done-result',
101
+ description: 'Run commands render via the single RunPresentation variant; the contracts surface must not re-introduce a per-tool *DoneResult run type',
102
+ longDescription: `**Purpose:** Guard the \`@opensip-cli/contracts\` command-result surface against re-growing one run-result interface per tool.
103
+
104
+ **Detects (in \`packages/contracts/src/\` only):**
105
+ - A re-declared per-tool run done-result type/interface (name ending \`…DoneResult\` for fit/sim/graph).
106
+ - A discriminator property \`type: 'fit-done' | 'sim-done' | 'graph-done'\` on a type/interface declaration.
107
+
108
+ **Why it matters:** The envelope-first-presentation plan (ADR-0011) collapsed the three per-tool run results into one render-only \`RunPresentation\`. Re-introducing a per-tool done-result would re-grow the union and \`resultToView\` and diverge the human render from the envelope verdict.
109
+
110
+ **Scope:** Contracts package source only; test files exempt.`,
111
+ scope: { languages: ['typescript'], concerns: ['backend'] },
112
+ tags: ['architecture', 'contracts'],
113
+ fileTypes: ['ts'],
114
+ analyze: (content, filePath) => {
115
+ if (!normalized(filePath).includes(CONTRACTS_SRC_PATH) || isTestFile(filePath))
116
+ return [];
117
+ return analyzeNoRunDoneResult(content, filePath);
118
+ },
119
+ });
120
+ //# sourceMappingURL=no-run-done-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-run-done-result.js","sourceRoot":"","sources":["../../../src/checks/architecture/no-run-done-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,0TAA0T;AAC1T,OAAO,EAAE,WAAW,EAAE,UAAU,EAAuB,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,8CAA8C;AAC9C,MAAM,kBAAkB,GAAG,yBA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E,gEAAgE;qBAC7E,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QACD,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC;IACF,KAAK,CAAC,UAAU,CAAC,CAAC;IAClB,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;IACzC,EAAE,EAAE,sCAAsC;IAC1C,IAAI,EAAE,iCAAiC;IACvC,WAAW,EACT,yIAAyI;IAC3I,eAAe,EAAE;;;;;;;;6DAQ0C;IAC3D,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE;IAC3D,IAAI,EAAE,CAAC,cAAc,EAAE,WAAW,CAAC;IACnC,SAAS,EAAE,CAAC,IAAI,CAAC;IACjB,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;QAC7B,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,EAAE,CAAC;QAC1F,OAAO,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @fileoverview Guard that every CLI worker spawn/fork forwards the RunCorrelation bag.
3
+ *
4
+ * The subprocess-correlation-telemetry spec (and ADR-0054 readiness) requires
5
+ * that when the CLI spawns or forks a child CLI *worker* subcommand (e.g.
6
+ * `graph-shard-worker`, `graph-run-worker`, any future `*-run-worker`), the
7
+ * parent forwards its {@link RunCorrelation} bag so a child failure is
8
+ * attributable to the parent run/trace from JSONL logs alone. `runId` travels
9
+ * via `OPENSIP_RUN_ID` env (merged through `correlationToEnv`); the rest travels
10
+ * via env + the worker spec/descriptor's `correlation` field.
11
+ *
12
+ * This check fires on a spawn/fork of a `*-worker` subcommand that forwards env
13
+ * (so it clearly inherits the parent environment) but does NOT reference
14
+ * `correlationToEnv` or write a `correlation` field anywhere in the enclosing
15
+ * function — i.e. the parent forgot to carry correlation. It is bounded to the
16
+ * two host packages that own real worker spawn/fork sites (`packages/graph` and
17
+ * `packages/cli`); the generic fork transport (`packages/core`) is out of scope
18
+ * by design.
19
+ */
20
+ import { type CheckViolation } from '@opensip-cli/fitness';
21
+ /**
22
+ * Pure analysis over a parsed source file. Exported for unit tests. Returns one
23
+ * error per spawn/fork of a CLI `*-worker` subcommand whose enclosing function
24
+ * shows no correlation forwarding.
25
+ */
26
+ export declare function analyzeSubprocessCorrelationRequired(content: string, filePath: string): CheckViolation[];
27
+ export declare const subprocessCorrelationRequired: import("@opensip-cli/fitness").Check;
28
+ //# sourceMappingURL=subprocess-correlation-required.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subprocess-correlation-required.d.ts","sourceRoot":"","sources":["../../../src/checks/architecture/subprocess-correlation-required.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAsGpF;;;;GAIG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,cAAc,EAAE,CAoClB;AAED,eAAO,MAAM,6BAA6B,sCAYxC,CAAC"}