Repository navigation
fix(discern)!: refuse what upstream 0.5.0 refuses: stored answers, inverted bounds, empty calibration - #1
Merged
Conversation
…verted bounds, empty calibration Stored answers are validated like a provider's: replaying and caching hold each stored answer to the rules a live provider is held to and fail with an error Discern.Model.isInvalidObservation recognises, before the model is asked. Inverted bounds (missBelow over threshold, missAbove under it, between with low after high) are refused with InvalidThresholdError or the new InvalidRangeError in policy runs and in Eval.run, Eval.sweep and Eval.calibrate. Discern.evaluate on such a pattern answers Uncertain with the refusal message. PatternRefusal is now a union of ThresholdRefusal and RangeRefusal discriminated by kind. Eval.calibrate with an empty values list fails with CalibrationValuesRefused. Ported from systemfsoftware/systemfsoftware#870. Claude-Session: https://claude.ai/code/session_017rX35xUAHEjVVaDKVVzubW
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.
Ports the packages/discern changes of systemfsoftware/systemfsoftware#870 to this repo, same paths. Breaking:
PatternRefusalbecomes a union ofThresholdRefusalandRangeRefusaldiscriminated bykind;Eval.calibratewith emptyvaluesfails withCalibrationValuesRefused;replayingandcachingvalidate stored answers.This repo has no changesets and no docs/plans convention, so the monorepo's changeset and plan file are left out.
Checked locally: typecheck, lint, vitest (298 passed), tstyche, build with api-extractor, dprint.
Review of the monorepo PR found no P0 or P1. Follow-ups (P2/P3), not fixed here:
bandorclassifymakes the widened refusal gates throw aSchemaErrorout ofEval.run, policy runs, sweep and calibrate (eval-measure.ts); refuse it with the typed error.eval-measure.ts).decision.blueprint.ts).caching, one invalid live answer is recorded before the outer DecisionModel validates it, so later calls for that decision and state fail (cache-provider.cell.ts).DecisionModel.decidespan.https://claude.ai/code/session_017rX35xUAHEjVVaDKVVzubW