Skip to content

release v0.0.21: fix over-limit nudge spam + voice (review MAJOR-1/2) - #64

Merged
ranxianglei merged 2 commits into
masterfrom
2026-08-13_release-v0.0.21
Aug 13, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-08-13_release-v0.0.21

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes for review findings on 0.0.20 (MAJOR-1, MAJOR-2, MINOR-1, MINOR-2)

Oracle review of 0.0.20 found 4 issues in the decideNudge over-limit force path. This PR fixes all 4 + adds test coverage.

MAJOR-1: perpetual nudge spam when nothing is compressible

compress.ts:916 — shouldInject = overLimit || injectedTier !== null fired even when all content was protected/already compressed (injectedTier=null but overLimit=true).

Fix: gate on actionable target:

const shouldInject = injectedTier !== null
  || (overLimit && (rec?.recommendedRanges?.length ?? 0) > 0);

Now shouldInject is false when there's truly nothing to compress — the truncate node (at truncate.threshold) is the safety valve for that case, not a nudge.

MAJOR-2: over-limit nudge rendered as gentle

nudge-text.ts:149 — voice decided by emergencyOverride only; the new [0.75, 0.95) force-nudge band rendered gentle with header "not an overflow warning" — self-contradicting at 94% usage.

Fix: isEmergency = !!breakdown?.emergencyOverride || !!breakdown?.overLimit — over-limit now uses emergency voice.

MINOR-1: force loop accepted sub-minCompressRange ranges

compress.ts:907 — info.pending < 1 accepted any non-zero tier, including ranges below minCompressRange that applyCompression would reject.

Fix: info.pending < config.compress.minCompressRange.

MINOR-2: misleading comment

Comment claimed emergencyThresholdPct "trips the truncate node" — they're independent knobs.

Fix: rewritten to state independence.

Tests added (3 new, 230 total)

  • nudge.test.ts: "over-limit fires force-nudge when compressible content exists" + "over-limit does NOT inject when nothing is compressible (MAJOR-1 fix)"
  • nudge-text.test.ts: "over-limit renders with emergency voice (MAJOR-2 fix)"

Pre-flight

typecheck clean / 230 tests pass / build success

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.

1 participant