Skip to content

Add metadata-driven token lookup resolution for normalization#107

Merged
corymhall merged 2 commits intomasterfrom
st-ac3.17.3.3-token-lookup
Mar 2, 2026
Merged

Add metadata-driven token lookup resolution for normalization#107
corymhall merged 2 commits intomasterfrom
st-ac3.17.3.3-token-lookup

Conversation

@corymhall
Copy link
Member

@corymhall corymhall commented Feb 27, 2026

Summary

This PR introduces deterministic token lookup resolution from metadata history.

Lookup behavior is exposed as direct per-call APIs so compare-time decisions can query resolution state without precomputed global services.

What Changed

  • Added token lookup logic for resolved/ambiguous/none outcomes.
  • Added fixtures for single-rename, multi-hop, and ambiguity scenarios.
  • Added tests for determinism, candidate handling, and conservative behavior.
  • Extended normalize type surfaces needed by token lookup APIs.

Why

Token equivalence is required to classify missing/add/remap changes correctly during compare generation.

This isolates token lookup as a focused primitive before integrating it into compare behavior in #109.

Context

Squash details:
- Branch: st-ac3.17.3.8-remove-legacy-engine
- Base: st-ac3.17.3.1-typed-change-engine
- Squashed commits: 9

Original commits:
- 754a3c1 internal/compare: remove legacy diagtree engine path
- e7c9ab9 Rebuild compare breaking-change projections from typed changes
- 3d8723b Keep nested breaking lines when direct change exists
- c803a52 Fix compare maxChanges entry semantics and kind mapping
- eee787a Track total breaking count independent of max-changes
- c62ff6f Restore compare structured changes/grouped output contract
- db468ce Align compare cmd tests with structured changes/grouped contract
- 3b16bea Centralize compare Result structured model and JSON goldens
- 4182404 Align text formatting to structured golden and add golden test
Squash details:
- Branch: st-ac3.17.3.3-token-lookup
- Base: st-ac3.17.3.8-remove-legacy-engine
- Squashed commits: 9

Original commits:
- 15bc37c normalize: add deterministic token lookup index
- 15532da normalize: resolve token remaps lazily with memoization
- fa79413 normalize: require source-direction evidence for token resolution
- ae6243e normalize: snapshot token metadata and avoid caching none
- cecbbd1 normalize: harden token lookup immutability and miss-cache tests
- 303a00c normalize: defensively copy token lookup candidates
- 44714f9 Simplify token lookup to direct per-call resolution
- 1f44acb Clarify token lookup immutability contract and tighten tests
- bcef934 normalize: document token lookup helpers
@corymhall corymhall force-pushed the st-ac3.17.3.8-remove-legacy-engine branch from 78cc2b5 to 8ad024b Compare March 2, 2026 11:57
@corymhall corymhall force-pushed the st-ac3.17.3.3-token-lookup branch from 57f9199 to 6da15c2 Compare March 2, 2026 11:57
Base automatically changed from st-ac3.17.3.8-remove-legacy-engine to master March 2, 2026 15:24
@corymhall corymhall merged commit 68de3b1 into master Mar 2, 2026
1 check passed
@corymhall corymhall deleted the st-ac3.17.3.3-token-lookup branch March 2, 2026 15:24
corymhall added a commit that referenced this pull request Mar 2, 2026
## Summary
This PR adds field-path and type-equivalence lookup helpers for
normalization decisions.

These helpers provide conservative, metadata-backed matching used to
classify rename and maxItems-style transitions without schema rewriting.

## What Changed
- Added field history flattening and lookup utilities.
- Added resolver helpers for equivalent type transitions.
- Added targeted fixtures for nested/coexistence maxItems scenarios.
- Added extensive tests for path resolution, ambiguity handling, and
equivalence checks.

## Why
Token lookup alone is not enough for field/type transition
classification.

Compare-time normalization needs explicit field/type lookup primitives
before integration.

## Context
- Builds on token lookup primitives from #107.
- Used by integration work in #110 and #111.

## Testing
- `go test ./internal/normalize -count=1`
corymhall added a commit that referenced this pull request Mar 2, 2026
## Summary
This PR wires token lookup outcomes into compare change generation.

Missing/add/remap decisions now use metadata-backed token resolution in
the engine path rather than post-processing.

## What Changed
- Integrated token resolution into compare engine matching decisions.
- Added typed normalization attribution for token-driven outcomes.
- Added handling for retained aliases with canonical add/remap behavior.
- Updated compare/json/text/summary tests to assert token-resolution
behavior.
- Threaded metadata through compare options where needed for lookup
decisions.

## Why
Token mapping decisions belong where canonical changes are generated.

This reduces downstream synthetic behavior and keeps classification
deterministic.

## Context
- Uses lookup primitives from #107 and #108.
- Prepares command/field-type integration cleanup in #110.

## Testing
- `go test ./internal/compare ./compare -count=1`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants