# Regression Review Report

**Branch**: feature-190-wave-3b-frequency-analysis-api -> main
**Date**: 2026-06-02
**PR**: #266

## Issues in Your Changes (BLOCKING)

### CRITICAL

(none)

### HIGH

(none)

## Issues in Code You Touched (Should Fix)

(none)

## Pre-existing Issues (Not Blocking)

(none)

## Suggestions (Lower Confidence)

(none)

## Summary

| Category | CRITICAL | HIGH | MEDIUM | LOW |
|----------|----------|------|--------|-----|
| Blocking | 0 | 0 | 0 | - |
| Should Fix | - | 0 | 0 | - |
| Pre-existing | - | - | 0 | 0 |

**Regression Score**: 10/10
**Recommendation**: APPROVED

## Regression Checklist

- [x] No exports removed without deprecation -- all 3 pre-existing exports (`LinearNode`, `LinearizeResult`, `linearize_source`) preserved in both `ast_index/mod.rs` and `lib.rs`; 9 new exports added additively
- [x] Return types backward compatible -- `linearize_source` signature unchanged (format-only reformatting from multi-line to single-line)
- [x] Default values unchanged -- no constants or defaults modified
- [x] Side effects preserved -- no behavioral changes to existing functions
- [x] All consumers of changed code updated -- no consumers broken; new API not yet consumed (future integration)
- [x] Migration complete across codebase -- no migration needed (additive-only change)
- [x] CLI options preserved -- no CLI changes
- [x] API endpoints preserved -- no endpoint changes
- [x] Commit message matches implementation -- commit claims AstBigram/AstTrigram newtypes, vocab helpers, IDF weight lookup, and 45 tests; all verified present
- [x] Breaking changes documented -- N/A (no breaking changes)

## Analysis

This PR is purely additive with zero regression risk. The changes fall into two categories:

**1. New API surface (additive, no regression):**
- `ngram.rs` (256 lines): New `AstBigram`/`AstTrigram` newtypes, `vocab_lookup`/`vocab_resolve`/`vocab_len` vocabulary helpers, `ast_bigram_idf`/`ast_trigram_idf` weight lookup functions, `NodeKindId` type alias, and `DEFAULT_AST_WEIGHT` constant.
- `ngram_tests.rs` (400 lines): 45 tests covering roundtrip encoding/decoding, boundary values, Display formatting, vocabulary helpers, weight lookup, and encoding consistency with the generated weight tables.
- `mod.rs` and `lib.rs`: New `pub use` re-exports that extend (not replace) existing export lines.

**2. Format-only changes (cargo fmt, no behavior change):**
- `ast_walk.rs`: Single assert reformatted from multi-line to single-line (test code only).
- `ast_extract.rs`: Function parameter wrapping and assert formatting (test code only).
- `linearize_bench.rs`: Const string and closure formatting.
- `linearize.rs`: Function signature and struct literal formatting.
- `linearize_tests.rs`: Assert and struct literal formatting.

The `vocab_lookup` function uses binary search on `NODE_KIND_VOCABULARY`, which is a sorted `&[&str]` array generated by `rskim-research ast-codegen`. The sortedness is verified by the existing test suite in `ast_weights.rs` and confirmed by visual inspection (entries start with `""` and proceed in ASCII order).

The `ast_bigram_idf`/`ast_trigram_idf` functions correctly delegate to `ast_bigram_weight`/`ast_trigram_weight` using `Language::name()`, which returns strings matching the match arms in those functions. Non-tree-sitter languages (JSON, YAML, TOML) correctly fall back to `DEFAULT_AST_WEIGHT` via the `_ => return None` arm.

No regression vectors identified. Applies ADR-001 -- no issues found to defer.
