mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-09 03:17:54 +00:00
Adds the Ring 3 parity gate the RFC §6.4 requires: when a language's
scope-resolution migration is marked complete, CI runs its resolver
integration test twice on every PR (once with the legacy DAG, once with
the registry-primary path) and both must pass.
The "is this language migrated" signal is a single TypeScript constant:
// gitnexus/src/core/ingestion/registry-primary-flag.ts
export const MIGRATED_LANGUAGES: ReadonlySet<SupportedLanguages> =
new Set([ /* SupportedLanguages.Python when ready */ ]);
Adding a language here has three simultaneous effects:
1. `isRegistryPrimary(lang)` defaults to true for that language in
production (env-var override still wins if set explicitly).
2. `.github/workflows/ci-scope-parity.yml` auto-discovers the set via
`npx tsx scripts/ci-list-migrated-languages.ts`, builds a parity
matrix, and runs:
- `REGISTRY_PRIMARY_<LANG>=0 npx vitest run resolvers/<slug>.test.ts`
- `REGISTRY_PRIMARY_<LANG>=1 npx vitest run resolvers/<slug>.test.ts`
Both legs must pass for the job to succeed.
3. Legacy-path gating in call-processor.ts / import-processor.ts kicks
in automatically through the same `isRegistryPrimary` lookup.
No JSON registry, no manual workflow edit, no second source of truth —
contributors update the Set and CI picks it up. Empty Set = parity job
is a skipped matrix (workflow still reports success).
The new `scope-parity` reusable workflow is added to ci.yml's `needs`
graph and ci-status gate. Its result must be `success` (skipped would
mean upstream discover job failed and should block).
Validation (with empty MIGRATED_LANGUAGES set):
- flag OFF: 191/191 pass (no behavior change)
- flag ON (manual REGISTRY_PRIMARY_PYTHON=1): 82 fails = baseline exact match
- `npx tsc --noEmit`: clean
- concurrency-convention script: pass
- tsx discovery script: emits `[]` correctly
24 lines
895 B
TypeScript
24 lines
895 B
TypeScript
/**
|
|
* CI helper — emits the `MIGRATED_LANGUAGES` set as a JSON matrix array for
|
|
* GitHub Actions (`.github/workflows/ci-scope-parity.yml`).
|
|
*
|
|
* Consumed by the `discover` job in that workflow. Each entry has:
|
|
* - `slug`: lowercase language id, matching `test/integration/resolvers/<slug>.test.ts`.
|
|
* - `envvar`: uppercase suffix used to build the `REGISTRY_PRIMARY_<envvar>` toggle.
|
|
*
|
|
* Run with `npx tsx scripts/ci-list-migrated-languages.ts`. The script
|
|
* writes a single JSON array to stdout (no wrapper object) so the
|
|
* workflow can pipe it straight into `$GITHUB_OUTPUT`.
|
|
*/
|
|
|
|
import { MIGRATED_LANGUAGES } from '../src/core/ingestion/registry-primary-flag.js';
|
|
|
|
const entries = [...MIGRATED_LANGUAGES].map((slug) => {
|
|
const s = String(slug);
|
|
return {
|
|
slug: s,
|
|
envvar: s.toUpperCase().replace(/-/g, '_'),
|
|
};
|
|
});
|
|
|
|
process.stdout.write(JSON.stringify(entries));
|