fix: review follow-ups for unsustainable warning PR#352
Merged
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up fixes from self-review of #351:
getConsecutiveBusts()now read-only: UsessessionStates.get()instead ofgetSessionState()(get-or-create) to avoid creating phantomSessionStateentries with zeroed calibration fields, which would cause subsequenttransform()calls to treat the session as uncalibrated.metaThresholdOverrideclamped:runInner()now clamps the override to min 2 — prevents callers from passing 0 or negative values that would trigger meta-distillation unconditionally.effectiveMetaThreshold()helper andBUST_PRESSURE_THRESHOLDconstant into@loreai/core, replacing duplicatedbusts >= 3 ? Math.max(3, Math.floor(threshold / 4)) : thresholdlogic inidle.tsandpipeline.ts.Files changed
packages/core/src/gradient.tsgetConsecutiveBusts()uses read-only Map access; neweffectiveMetaThreshold()helper +BUST_PRESSURE_THRESHOLDconstantpackages/core/src/index.tspackages/core/src/distillation.tsmetaThresholdOverrideto min 2packages/gateway/src/idle.tseffectiveMetaThreshold()helperpackages/gateway/src/pipeline.tscomputeMetaThreshold()(aliased import)packages/gateway/test/helpers/idle-worker.ts