feat: accept expressions for datagen lengths, counts and latencies #1052
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #1052"
general
weight: 0.35
rishabhsinha17
Part of #449.
Old behavior: every length, count and latency knob in
datais a fixed value or aDistributionblock. New behavior: each one also takes an expression string. A length or count must be provably whole-numbered, so the config says how a draw is rounded. Every field has a range, and the expression must provably stay in it.Distributionblocks compile to expressions, so the datagens read one form.Fields that now accept an expression:
Not in the list:
data.shared_prefix.question_distributionanddata.shared_prefix.output_distributionstill take a block only. No field here allowst.Changes:
Every field above takes a string alongside its existing forms and is checked when the config loads.
A length or count expression must be provably integer-valued: a discrete variable like
Poisson(2), or a continuous one underfloor(),ceiling()orfloor(... + 1/2). A rejected one gets thefloor()form to paste.Each field has a range, checked at load for numbers and expressions alike and stated at the end of its description. Token lengths, turns and compaction tokens are at least 1.
system_prompt_len,dynamic_system_prompt_len, counts and seconds are at least 0.insertion_pointis within [0, 1]. An expression that is not provably in range gets theMax(..., m)form to paste.The dataset types reject an expression for
input_distribution/output_distribution. They filter on the block's min and max, which an expression does not define.sample_values/value_ceiling: one sampling path and one worst-case path for any numeric knob. Seconds keep fractions.Budget checks (multi-turn prompt budget, synthetic_agentic
max_model_len) read an expression's provable upper bound fromExpression.bounds.floor(Min(Max(Normal(50, 10), 1), 99))fits a 99-token budget.floor(Normal(50, 10)), or anything the bounds walk can't reason about, is rejected.Docs: checked examples in
config.md,conversation_replay.mdandsynthetic_agentic.md, and indocs/expressions.mdthese fields' rows and a checked "Whole numbers" section.Tests: one accept/reject table over every expression field, with a guard that fails on a field without a row, a check that a number outside the range is rejected, and a check that each description states its range.
e2e:
test_expression_lengths.pyruns the CLI against the absorber with bothsyntheticlength fields set to expressions and checks every prompt length andmax_tokenson the wire against the expression's bounds. A second run checks the CLI refuses a continuous length and sends nothing.Other changes:
Fix: tool-call latency and user think time were sampled as integers, so 0.3s became 0s, despite both code comments saying otherwise. They now keep fractional seconds.
Fix: a field that takes a model or a string had lost its nested CLI flags (
--data.input_distribution.mean 600). Both forms work now, and setting the whole value and one of its fields together is an error.Known gaps, not addressed here:
A few
sympy.statsconstructors load and then fail on the first draw, because SymPy has no numpy sampler for them. Seen so far:Weibull,Bernoulli, andTriangularunless its mode equals its upper bound. Holding on these until someone asks.Piecewisemixture samples correctly but has no provable bounds, so the fields with a budget check reject it.Tests that used a continuous expression on a length now wrap it in
floor()and give it a lower bound, per the rules above. The whole-number and range helpers live in #1062.Split out of #829, which keeps the rate half. This half does not depend on #823.
Ran clean locally: the license check,
ruff check,ruff format --check,mypy --strict, the type-escape ratchet and both doc sync checks. Both tests ine2e/tests/test_expression_lengths.pypass.pytest testspasses apart fromtest_datagen_imports_without_zstd, which fails the same way on main locally.This PR was written in part with the assistance of generative AI.