FE-1518: Optimization constraints as shared HIR expressions - #9371
Draft
kube wants to merge 3 commits into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
4 tasks
kube
force-pushed
the
cf/fe-1518-optimization-constraints
branch
from
August 27, 2026 20:09
540f999 to
ca852c2
Compare
kube
force-pushed
the
cf/fe-1518-optimization-constraints
branch
from
August 27, 2026 23:53
ca852c2 to
08758e2
Compare
kube
force-pushed
the
cf/fe-1518-optimization-constraints
branch
from
August 28, 2026 00:20
08758e2 to
a6118e1
Compare
kube
force-pushed
the
cf/fe-1518-optimization-constraints
branch
from
August 28, 2026 01:35
a6118e1 to
5b4bf6c
Compare
kube
force-pushed
the
cf/fe-1518-optimization-constraints
branch
from
August 28, 2026 14:00
5673923 to
18a3492
Compare
kube
force-pushed
the
cf/fe-1518-optimization-constraints
branch
from
August 28, 2026 15:17
18a3492 to
50abbe9
Compare
kube
force-pushed
the
cf/fe-1518-optimization-constraints
branch
from
August 28, 2026 15:18
50abbe9 to
6b95109
Compare
kube
force-pushed
the
cf/fe-1518-optimization-constraints
branch
from
August 28, 2026 15:33
6b95109 to
35291c2
Compare
kube
force-pushed
the
cf/fe-1518-optimization-constraints
branch
from
August 28, 2026 16:39
35291c2 to
ba0715b
Compare
kube
force-pushed
the
cf/fe-1518-optimization-constraints
branch
from
August 28, 2026 17:02
ba0715b to
29a3999
Compare
This was referenced Aug 30, 2026
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.
Stacked on #9368 (FE-1517). First cut of the constraints system (FE-1518).
Two blocks in the create-optimization drawer (only there, for now):
scenario.*,parameters.*), e.g.scenario.min_load < scenario.max_load.statereturning boolean, e.g.return state.places.Queue.count <= 10;.Mechanics:
lowerOptimizationConstraint(core, worker/Node only) lowers on the existingscenario-expression/metricsurfaces and type-checks a boolean result (the metric surface gained anexpected: "real" | "boolean"knob).constraints: { parameterSpace, stateSpace }, each item{ id, name?, code, hir }— the authored source plus its serialized HIR (serializedHirFunctionSchemavalidates the envelope; the TypeScript grammar inhir/hir.tsstays the authority). Old manifests parse unchanged.describe()passes constraints through verbatim; the protocol JSON schema and the generated pydantic models are regenerated.petrinaut.Constraintwraps one constraint as a plain callable —constraint(scenario={...})→ bool — plusconstraint.margin(...), a signed robustness margin (comparisons → slack,&&= min,||= max,!= negate; ≥ 0 iff satisfied) ready to feed samplers that consume violations (e.g. Optuna'sconstraints_functakes-margin). Behind both sits a small dependency-free HIR evaluator (petrinaut/hir.py) with ECMAScript semantics (strict equality,Math.roundhalf-up, JS division/remainder), tested against fixtures lowered by the real TypeScript frontend.hir.py.Nothing enforces constraints yet — they are recorded, displayed, and readable; a failing one only blocks drawer submission with its diagnostic.
🤖 Generated with Claude Code