gitnexus 1.6.3-rc.11 → 1.6.3-rc.12
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.
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `REGISTRY_PRIMARY_<LANG>` per-language feature flags for the scope-based
|
|
3
|
+
* resolution rollout (RFC §6.1 Ring 3; Ring 2 PKG #924).
|
|
4
|
+
*
|
|
5
|
+
* This module is the single source of truth for whether a given language
|
|
6
|
+
* has been flipped to registry-primary call resolution. When a language's
|
|
7
|
+
* flag is true, its files route through `Registry.lookup` (RFC §4) instead
|
|
8
|
+
* of the legacy call-resolution DAG; when false (the default), the legacy
|
|
9
|
+
* DAG runs unchanged.
|
|
10
|
+
*
|
|
11
|
+
* ## Contract
|
|
12
|
+
*
|
|
13
|
+
* - Env-var name per language: `REGISTRY_PRIMARY_<UPPER(enum-value)>`.
|
|
14
|
+
* Example: `SupportedLanguages.Python` → `REGISTRY_PRIMARY_PYTHON`;
|
|
15
|
+
* `SupportedLanguages.CPlusPlus` (value `'cpp'`) → `REGISTRY_PRIMARY_CPP`.
|
|
16
|
+
* - Truthy values: `'true'`, `'1'`, `'yes'` (case-insensitive,
|
|
17
|
+
* whitespace-trimmed). Anything else — including `undefined`, empty
|
|
18
|
+
* string, or unknown tokens — is `false`.
|
|
19
|
+
* - No per-process caching. `process.env` is read on every call. The
|
|
20
|
+
* flag is consulted once per file at call-resolution time, so the
|
|
21
|
+
* overhead is negligible; skipping caching keeps test isolation
|
|
22
|
+
* trivial (no `resetFlagCache()` coordination needed).
|
|
23
|
+
*
|
|
24
|
+
* ## Integration site
|
|
25
|
+
*
|
|
26
|
+
* `call-processor.ts` integration lands in **#921** (`finalize-orchestrator`)
|
|
27
|
+
* where the `SemanticModel` becomes accessible and `Registry.lookup` can
|
|
28
|
+
* actually be called with a populated context. This module ships the flag
|
|
29
|
+
* primitive in isolation so #921 has a clean, tested utility to consult.
|
|
30
|
+
*
|
|
31
|
+
* ## Shadow mode is orthogonal
|
|
32
|
+
*
|
|
33
|
+
* Shadow mode (`GITNEXUS_SHADOW_MODE=1`, introduced in #923) runs BOTH
|
|
34
|
+
* legacy and registry paths regardless of the per-language flag, so the
|
|
35
|
+
* parity dashboard has signal even for un-flipped languages. That logic
|
|
36
|
+
* lives in `shadow-harness.ts` (#923), not here.
|
|
37
|
+
*/
|
|
38
|
+
import { SupportedLanguages } from '../../_shared/index.js';
|
|
39
|
+
/**
|
|
40
|
+
* Return the env-var name that controls a given language's registry-
|
|
41
|
+
* primary flag. Exported for test assertions and for the PR-labeling
|
|
42
|
+
* CI job that cross-references per-language flag changes.
|
|
43
|
+
*/
|
|
44
|
+
export declare function envVarNameFor(lang: SupportedLanguages): string;
|
|
45
|
+
/**
|
|
46
|
+
* Whether `lang` has been flipped to registry-primary call resolution.
|
|
47
|
+
*
|
|
48
|
+
* Returns `false` by default — a language must explicitly set its env
|
|
49
|
+
* var to a truthy value to opt in. The flag is the sole control surface:
|
|
50
|
+
* flipping it requires no code change, and reverting it requires no code
|
|
51
|
+
* change.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isRegistryPrimary(lang: SupportedLanguages): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* All languages whose registry-primary flag is currently on. Useful for
|
|
56
|
+
* startup-time logging + the shadow-harness dashboard, which wants to
|
|
57
|
+
* distinguish "primary: legacy" from "primary: registry" rows.
|
|
58
|
+
*/
|
|
59
|
+
export declare function primaryLanguages(): ReadonlySet<SupportedLanguages>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `REGISTRY_PRIMARY_<LANG>` per-language feature flags for the scope-based
|
|
3
|
+
* resolution rollout (RFC §6.1 Ring 3; Ring 2 PKG #924).
|
|
4
|
+
*
|
|
5
|
+
* This module is the single source of truth for whether a given language
|
|
6
|
+
* has been flipped to registry-primary call resolution. When a language's
|
|
7
|
+
* flag is true, its files route through `Registry.lookup` (RFC §4) instead
|
|
8
|
+
* of the legacy call-resolution DAG; when false (the default), the legacy
|
|
9
|
+
* DAG runs unchanged.
|
|
10
|
+
*
|
|
11
|
+
* ## Contract
|
|
12
|
+
*
|
|
13
|
+
* - Env-var name per language: `REGISTRY_PRIMARY_<UPPER(enum-value)>`.
|
|
14
|
+
* Example: `SupportedLanguages.Python` → `REGISTRY_PRIMARY_PYTHON`;
|
|
15
|
+
* `SupportedLanguages.CPlusPlus` (value `'cpp'`) → `REGISTRY_PRIMARY_CPP`.
|
|
16
|
+
* - Truthy values: `'true'`, `'1'`, `'yes'` (case-insensitive,
|
|
17
|
+
* whitespace-trimmed). Anything else — including `undefined`, empty
|
|
18
|
+
* string, or unknown tokens — is `false`.
|
|
19
|
+
* - No per-process caching. `process.env` is read on every call. The
|
|
20
|
+
* flag is consulted once per file at call-resolution time, so the
|
|
21
|
+
* overhead is negligible; skipping caching keeps test isolation
|
|
22
|
+
* trivial (no `resetFlagCache()` coordination needed).
|
|
23
|
+
*
|
|
24
|
+
* ## Integration site
|
|
25
|
+
*
|
|
26
|
+
* `call-processor.ts` integration lands in **#921** (`finalize-orchestrator`)
|
|
27
|
+
* where the `SemanticModel` becomes accessible and `Registry.lookup` can
|
|
28
|
+
* actually be called with a populated context. This module ships the flag
|
|
29
|
+
* primitive in isolation so #921 has a clean, tested utility to consult.
|
|
30
|
+
*
|
|
31
|
+
* ## Shadow mode is orthogonal
|
|
32
|
+
*
|
|
33
|
+
* Shadow mode (`GITNEXUS_SHADOW_MODE=1`, introduced in #923) runs BOTH
|
|
34
|
+
* legacy and registry paths regardless of the per-language flag, so the
|
|
35
|
+
* parity dashboard has signal even for un-flipped languages. That logic
|
|
36
|
+
* lives in `shadow-harness.ts` (#923), not here.
|
|
37
|
+
*/
|
|
38
|
+
import { SupportedLanguages } from '../../_shared/index.js';
|
|
39
|
+
/**
|
|
40
|
+
* Return the env-var name that controls a given language's registry-
|
|
41
|
+
* primary flag. Exported for test assertions and for the PR-labeling
|
|
42
|
+
* CI job that cross-references per-language flag changes.
|
|
43
|
+
*/
|
|
44
|
+
export function envVarNameFor(lang) {
|
|
45
|
+
return `REGISTRY_PRIMARY_${lang.toUpperCase()}`;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Whether `lang` has been flipped to registry-primary call resolution.
|
|
49
|
+
*
|
|
50
|
+
* Returns `false` by default — a language must explicitly set its env
|
|
51
|
+
* var to a truthy value to opt in. The flag is the sole control surface:
|
|
52
|
+
* flipping it requires no code change, and reverting it requires no code
|
|
53
|
+
* change.
|
|
54
|
+
*/
|
|
55
|
+
export function isRegistryPrimary(lang) {
|
|
56
|
+
return parseFlag(process.env[envVarNameFor(lang)]);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* All languages whose registry-primary flag is currently on. Useful for
|
|
60
|
+
* startup-time logging + the shadow-harness dashboard, which wants to
|
|
61
|
+
* distinguish "primary: legacy" from "primary: registry" rows.
|
|
62
|
+
*/
|
|
63
|
+
export function primaryLanguages() {
|
|
64
|
+
const out = new Set();
|
|
65
|
+
for (const lang of Object.values(SupportedLanguages)) {
|
|
66
|
+
if (isRegistryPrimary(lang))
|
|
67
|
+
out.add(lang);
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
// ─── Internal ───────────────────────────────────────────────────────────────
|
|
72
|
+
/** Accepted truthy strings (case-insensitive, trimmed). */
|
|
73
|
+
const TRUTHY_VALUES = new Set(['true', '1', 'yes']);
|
|
74
|
+
function parseFlag(raw) {
|
|
75
|
+
if (raw === undefined)
|
|
76
|
+
return false;
|
|
77
|
+
return TRUTHY_VALUES.has(raw.trim().toLowerCase());
|
|
78
|
+
}
|
package/package.json
CHANGED