Skip to content

v11.3.1 — SYMBOL_REPLACE_LIMIT empirical recalibration

Choose a tag to compare

@Ruso-0 Ruso-0 released this 19 May 20:02
· 18 commits to master since this release

Summary

Empirical recalibration of NREKI's mode:"replace" symbol-size cap. Default raised from 40 L → 100 L, now configurable via NREKI_SYMBOL_LIMIT env override.

The legacy 40 L value was introduced in v9.1 (commit 3661c31) as a magic number with no measurement. v11.3.1 replaces it with a value derived from a 2 880-function empirical study.

Why

Phase 1 measurement across 5 production TypeScript codebases (NREKI src/, zod, ajv, eventsource, ajv-formats):

Threshold % real-world functions blocked % NREKI's own src/ blocked
40 L (legacy) 10.45% 19.06% (self-inconsistency)
80 L 4.20% 8.01%
100 L (new default) 3.02% 5.52%

Aggregate p95 of real functions = 66 L; p99 = 146 L. The 40 L cap was rejecting legitimate medium-sized functions (the user's reported case: 55 L processText).

NREKI's 10 other defense-in-depth gates (anti-sweep shield, kernel TS validation, TTRD, blast radius, Fiedler bridge, Chronos friction, auto-backup, ACID, file lock, topology invalidate) continue to detect every defect class the size-only gate was incidentally catching. Raising 40 → 100 weakens no defect-detection gate.

Changes

  • SYMBOL_REPLACE_LIMIT — central named constant in src/limits.ts, replacing the magic 40 in src/semantic-edit.ts:638 (batch) and src/semantic-edit.ts:1029 (single).
  • NREKI_SYMBOL_LIMIT env — integer 1..1000, clamps at the ceiling, warns + falls back on parse failure (never silently disables the gate). Backward-compat for legacy 40 L behavior: NREKI_SYMBOL_LIMIT=40.
  • Error message now reports the active threshold and the env override path.
  • Templates (CLAUDE.md, AGENTS.md, SKILL.md) updated to document the new default.
  • Tests: 3 new cases (55 L allowed, 120 L still blocked, dynamic error message). Full suite: 1415 passed / 3 skipped / 0 failed.

Documentation

Migration

No file format change, no API change, no breaking signature. Symbols 41-100 L now accept mode:"replace" where they were previously rejected.

To restore exact pre-v11.3.1 behavior:

export NREKI_SYMBOL_LIMIT=40

🤖 Generated with Claude Code