mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-22 00:31:17 +00:00
Lands the authoritative data model and constants for the pure scope-based resolution RFC (#909) as Ring 1, part 1. No runtime behavior changes — types + constants only. New in gitnexus-shared/src/scope-resolution/: - types.ts — Scope, ScopeKind, ScopeId, DefId, Range, Capture, BindingRef, ImportEdge, TypeRef, Resolution, ResolutionEvidence, Reference, ReferenceIndex, LookupParams, RegistryContributor - evidence-weights.ts — EvidenceWeights constant map + typeBindingWeightAtDepth (RFC Appendix A) - origin-priority.ts — ORIGIN_PRIORITY constant map for deterministic tie-breaks (RFC Appendix B) - language-classification.ts — LanguageClassification type + LanguageClassifications map (production × 14, experimental × 2 for vue/cobol; governs Ring 4 DAG-retirement gate) - symbol-definition.ts — SymbolDefinition moved from gitnexus/src/core/ingestion/model/symbol-table.ts so scope-resolution types can reference it from the shared package Consumer updates: - symbol-table.ts: removes local SymbolDefinition declaration; imports from gitnexus-shared - model/index.ts: drops SymbolDefinition from barrel re-export per "direct imports from gitnexus-shared" convention (see gitnexus-shared feedback in project memory) - 9 source files + 5 test files: import SymbolDefinition directly from 'gitnexus-shared' Verification: - gitnexus-shared builds clean (tsc) - gitnexus builds clean (scripts/build.js) - 131/132 unit test files pass; 3767 tests green - Zero behavior changes; SymbolDefinition shape unchanged Blocks: #911 (LanguageProvider hook interface extensions) and all of Ring 2 (#912-#925). Closes part of #909.
30 lines
749 B
TypeScript
30 lines
749 B
TypeScript
/**
|
|
* `ORIGIN_PRIORITY` — RFC Appendix B (authoritative values).
|
|
*
|
|
* Tie-break ordering applied inside `Registry.lookup` Step 7 when
|
|
* `|Δconfidence| < 0.001` between two `Resolution` candidates. Lower number
|
|
* = stronger (wins the tie).
|
|
*
|
|
* Full tie-break order (§4.2 Step 7):
|
|
* confidence DESC → scope depth ASC → MRO depth ASC → ORIGIN_PRIORITY ASC
|
|
* → DefId.localeCompare
|
|
*/
|
|
|
|
export type OriginForTieBreak =
|
|
| 'local'
|
|
| 'import'
|
|
| 'reexport'
|
|
| 'namespace'
|
|
| 'wildcard'
|
|
| 'global-qualified'
|
|
| 'global-name';
|
|
|
|
export const ORIGIN_PRIORITY: Readonly<Record<OriginForTieBreak, number>> = {
|
|
local: 0,
|
|
import: 1,
|
|
reexport: 2,
|
|
namespace: 3,
|
|
wildcard: 4,
|
|
'global-qualified': 5,
|
|
'global-name': 6,
|
|
};
|