Skip to content

fix(discern)!: refuse what upstream 0.5.0 refuses: stored answers, inverted bounds, empty calibration - #1

Merged
systemfsoftware-bot merged 1 commit into
mainfrom
port/upstream-parity
Oct 29, 2026
Merged

systemfsoftware-bot merged 1 commit into
mainfrom
port/upstream-parity

Conversation

@systemfsoftware-bot

Copy link
Copy Markdown
Contributor

Ports the packages/discern changes of systemfsoftware/systemfsoftware#870 to this repo, same paths. Breaking: PatternRefusal becomes a union of ThresholdRefusal and RangeRefusal discriminated by kind; Eval.calibrate with empty values fails with CalibrationValuesRefused; replaying and caching validate 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:

  • P2: a non-finite bound on band or classify makes the widened refusal gates throw a SchemaError out of Eval.run, policy runs, sweep and calibrate (eval-measure.ts); refuse it with the typed error.
  • P2: calibrate scores rebuilt patterns that bypass the candidate refusal gate (eval-measure.ts).
  • P3: in-source refusal properties draw only finite pairs with seeds 0 and 1, so the non-finite path is never exercised (decision.blueprint.ts).
  • P3: under 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).
  • P3: each replay or cache hit emits a phantom DecisionModel.decide span.

https://claude.ai/code/session_017rX35xUAHEjVVaDKVVzubW

…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
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