Skip to content

fix: review follow-ups for unsustainable warning PR#352

Merged
BYK merged 1 commit into
mainfrom
fix/unsustainable-review-followup
May 15, 2026
Merged

fix: review follow-ups for unsustainable warning PR#352
BYK merged 1 commit into
mainfrom
fix/unsustainable-review-followup

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 15, 2026

Summary

Follow-up fixes from self-review of #351:

  • getConsecutiveBusts() now read-only: Uses sessionStates.get() instead of getSessionState() (get-or-create) to avoid creating phantom SessionState entries with zeroed calibration fields, which would cause subsequent transform() calls to treat the session as uncalibrated.
  • metaThresholdOverride clamped: runInner() now clamps the override to min 2 — prevents callers from passing 0 or negative values that would trigger meta-distillation unconditionally.
  • DRY threshold formula: Extracted effectiveMetaThreshold() helper and BUST_PRESSURE_THRESHOLD constant into @loreai/core, replacing duplicated busts >= 3 ? Math.max(3, Math.floor(threshold / 4)) : threshold logic in idle.ts and pipeline.ts.

Files changed

File Change
packages/core/src/gradient.ts getConsecutiveBusts() uses read-only Map access; new effectiveMetaThreshold() helper + BUST_PRESSURE_THRESHOLD constant
packages/core/src/index.ts Re-export new symbols
packages/core/src/distillation.ts Clamp metaThresholdOverride to min 2
packages/gateway/src/idle.ts Use shared effectiveMetaThreshold() helper
packages/gateway/src/pipeline.ts Use shared computeMetaThreshold() (aliased import)
packages/gateway/test/helpers/idle-worker.ts Add new exports to mock

- getConsecutiveBusts() now uses read-only Map.get() instead of
  get-or-create getSessionState() to avoid creating phantom session
  state entries with zeroed calibration fields
- metaThresholdOverride clamped to min 2 in runInner() to prevent
  callers from triggering meta-distillation with 0 gen-0 segments
- Extract bust-pressure threshold formula into shared
  effectiveMetaThreshold() helper (DRY) with BUST_PRESSURE_THRESHOLD
  constant, replacing duplicated logic in idle.ts and pipeline.ts
@BYK BYK merged commit be2068b into main May 15, 2026
7 checks passed
@BYK BYK deleted the fix/unsustainable-review-followup branch May 15, 2026 18:26
@craft-deployer craft-deployer Bot mentioned this pull request May 15, 2026
6 tasks
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