Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
810ba15
A right-censored bound could inhabit the field consumers read as an e…
Sep 3, 2026
c2042c7
Guard the crossing admission: three arms, the third counted rather th…
Sep 3, 2026
4abbc90
Hoist 34 body-position source annotations, and type the authority's c…
Sep 3, 2026
e7f37e7
Merge main: keep BOTH the verdict axis and the censoring axis on Floo…
Sep 3, 2026
f2320aa
Give claim_cost_observation an executing consumer, and let it assert …
Sep 3, 2026
fcf1347
Narrow one quantifier this file's own crossing guard falsifies
Sep 3, 2026
ab5d8f7
Give each cost-reading kind its own declared contract, instead of a b…
Sep 3, 2026
cf0f28c
Remove a meaning fork this PR introduced: one spelling, two declarati…
Sep 3, 2026
4b3d216
Make the artifact parse total: a malformed row refuses and is located…
Sep 3, 2026
f95f28a
Retire three witness names that recorded a closed binary, one of whic…
Sep 3, 2026
db4fe49
Delete the accessor that rebuilt the collapse, name the refusal accur…
Sep 3, 2026
7937d73
Gate the report on an admission it consumes, inline the projection, a…
Sep 3, 2026
7e48299
Merge remote-tracking branch 'origin/main' into session/crisp-ram-568
Sep 3, 2026
4910a3f
The trigger fired: tighten the inverted arm to assert the refusal it …
Sep 3, 2026
6097bfd
Merge origin/main: port the envelope onto the coproduct and behind th…
Sep 3, 2026
77ceb95
The prose fused the two axes the code separates: rename the no-verdic…
Sep 3, 2026
5786485
Merge remote-tracking branch 'origin/main' into session/crisp-ram-568
Sep 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
590 changes: 534 additions & 56 deletions dag/gunbc/floor_cost_distribution.dag

Large diffs are not rendered by default.

113 changes: 101 additions & 12 deletions dag/gunbc/instruments/floor_cost_distribution_instrument.dag
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,21 @@ import gunbc.floor_cost_distribution {
worst_over_runs,
module_max_cpu,
repair_ladder,
identity_inflation_permille,
identity_inflation,
permille_percentile,
implied_clean_run_budget
implied_clean_run_budget,
WorstCost,
WorstObserved,
WorstIsLowerBound,
censored_rows,
runs_crossing_undecidable,
ClaimCostArtifact,
ArtifactRows,
ArtifactRefused,
ArtifactRefusalCause,
NoHeaderLine,
HeaderNotReadable,
MalformedDataRow
}

// THE ENTRY POINT FOR docs/plans/floor-cost-distribution-near-the-ceiling.md.
Expand Down Expand Up @@ -53,10 +65,16 @@ data floor_cost_ceiling: Millisecond = millisecond(count: 500)
data floor_cost_artifact_root: String = "/tmp/floor-cost"
data floor_cost_artifact_file: String = "required_floor_claim_cost.tsv"

// `RunRefused` IS NOT `RunEmpty`, AND CONFLATING THEM WAS THE DEFECT. An artifact whose header is
// an old vintage, or which carries a malformed row, is not a run that measured nothing -- it is a
// run whose measurements could not be read. Reporting it as empty makes an unreadable artifact
// indistinguishable from a clean one with no rows, which is the silent narrow the parse now
// refuses to perform.
type RunLoad
= RunLoaded { run: RunCost }
| RunUnreadable { run: NonEmptyStr, path: String }
| RunEmpty { run: NonEmptyStr, path: String }
| RunRefused { run: NonEmptyStr, path: String, cause: ArtifactRefusalCause }

fn run_cost_path(root: String, run: NonEmptyStr) -> String {
concat(concat(root, concat("/", run as String)), concat("/", floor_cost_artifact_file))
Expand All @@ -68,11 +86,14 @@ fn load_run_cost(root: String, run: NonEmptyStr) -> RunLoad {
if !read.success {
RunUnreadable { run: run, path: path }
} else {
let rows = parse_claim_cost_tsv(text: read.content)
if count(rows) == 0 {
RunEmpty { run: run, path: path }
} else {
RunLoaded { run: RunCost { run: run, rows: rows } }
match parse_claim_cost_tsv(text: read.content) {
ArtifactRefused { cause: c } => RunRefused { run: run, path: path, cause: c }
ArtifactRows { rows: rows } =>
if count(rows) == 0 {
RunEmpty { run: run, path: path }
} else {
RunLoaded { run: RunCost { run: run, rows: rows } }
}
}
}
}
Expand All @@ -82,6 +103,7 @@ fn loaded_runs(loads: List<RunLoad>) -> List<RunCost> {
RunLoaded { run: r } => [r]
RunUnreadable { run: _, path: _ } => []
RunEmpty { run: _, path: _ } => []
RunRefused { run: _, path: _, cause: _ } => []
})
}

Expand All @@ -90,20 +112,47 @@ fn refused_load_lines(loads: List<RunLoad>) -> List<String> {
RunLoaded { run: _ } => []
RunUnreadable { run: r, path: p } => [concat(concat("REFUSED unreadable run=", r as String), concat(" path=", p))]
RunEmpty { run: r, path: p } => [concat(concat("REFUSED empty run=", r as String), concat(" path=", p))]
RunRefused { run: r, path: p, cause: c } =>
[concat(concat(concat("REFUSED unreadable-artifact run=", r as String), concat(" path=", p)),
concat(" cause=", artifact_refusal_phrase(cause: c)))]
})
}

// THE CAUSE IS RENDERED, NOT COUNTED. A reader told only that an artifact was refused cannot act;
// one handed the offending header or line can go and look at it.
fn artifact_refusal_phrase(cause: ArtifactRefusalCause) -> String {
match cause {
NoHeaderLine => "no header line"
HeaderNotReadable { header_line: h } => concat("header not readable: ", h)
MalformedDataRow { line: l } => concat("malformed data row: ", l)
}
}

fn band_line(b: CostBand) -> String {
concat(
concat(to_string(millisecond_count(m: b.lower_ms)), concat("-", to_string(millisecond_count(m: b.upper_ms)))),
concat("\t", to_string(b.rows))
)
}

// THE WORST FIGURE RENDERS ITS OWN CENSORING, and the `>=` is not decoration: on the censored arm
// the number is a LOWER BOUND, so printing it bare would put a bound in the field a reader scans
// for a cost -- the class this instrument's own input was the specimen of. The censored row count
// travels with it so a reader can see how much of the population the bound stands for.
fn worst_phrase(w: WorstCost) -> String {
match w {
WorstObserved { cpu_ms: c } => concat(to_string(millisecond_count(m: c)), "ms")
WorstIsLowerBound { at_least_ms: b, censored_rows: n } => concat(
concat(">=", concat(to_string(millisecond_count(m: b)), "ms")),
concat(" (LOWER BOUND, unbounded above; ", concat(to_string(n), " censored row(s) carry no cost)"))
)
}
}

fn ladder_line(s: LadderStep) -> String {
concat(
s.removed,
concat(concat("\tworst=", to_string(millisecond_count(m: s.worst_ms))), concat("\trefused=", to_string(s.runs_refused)))
concat(concat("\tworst=", worst_phrase(w: s.worst)), concat("\trefused=", to_string(s.runs_refused)))
)
}

Expand All @@ -123,6 +172,22 @@ fn percentile_line(values: List<Int>, percent: Int) -> String {
// The whole analysis over one loaded set of runs. `baseline` and `contended` name the pair the
// inflation percentiles are paired over; `repaired` is the counterfactual exclusion set; `order`
// is the ladder's removal order.
// THREE DISCLOSURES TRAVEL WITH THE FIGURES THEY QUALIFY, and each exists because the figure
// beside it is incomplete in a way a reader cannot see:
//
// `rows excluded from the bands as right-censored` -- the band histogram's bands sum to the
// OBSERVED rows only. Censored rows have no cost to place, so the difference between the band
// total and the population is stated rather than left silent.
//
// `rows undecidable for crossing` -- what the refusal verdict COULD NOT DECIDE. A censored row
// whose bound does not clear the ceiling is neither a crosser nor a non-crosser. Empty is the
// expected reading while the CPU safety ceiling sits above the cost line; a non-empty list means
// that ordering has broken and every crossing figure on this report is qualified by it.
//
// `pairs available` and `pairs refused as right-censored` -- the denominator and the exclusion
// beside the percentiles. A ratio needs two costs, so a pair with a censored member yields none,
// and those are systematically the EXPENSIVE pairs -- which is what makes an unstated exclusion
// here biased low rather than merely incomplete.
fn floor_cost_distribution_lines(
loads: List<RunLoad>,
baseline: NonEmptyStr,
Expand All @@ -145,7 +210,10 @@ fn floor_cost_distribution_lines(
Absent => [concat("REFUSED no population for contended run ", contended as String)]
Present { value: c } => concat(
concat(
[concat("band histogram for run ", c.run as String)],
[
concat("band histogram for run ", c.run as String),
concat("rows excluded from the bands as right-censored\t", to_string(censored_rows(rows: c.rows)))
],
cost_bands(rows: c.rows, edges: band_edges) |> map(b => band_line(b: b))
),
[
Expand All @@ -158,6 +226,7 @@ fn floor_cost_distribution_lines(
concat(
[
concat("runs refused as observed\t", to_string(runs_refused(runs: runs, ceiling_ms: floor_cost_ceiling, excluded_modules: []))),
concat("rows undecidable for crossing\t", to_string(count(runs_crossing_undecidable(runs: runs, ceiling_ms: floor_cost_ceiling, excluded_modules: [])))),
concat("runs refused with the repaired modules excluded\t", to_string(runs_refused(runs: runs, ceiling_ms: floor_cost_ceiling, excluded_modules: repaired))),
concat("worst row over all runs, repaired excluded\t", to_string(millisecond_count(m: worst_over_runs(runs: runs, excluded_modules: repaired))))
],
Expand All @@ -169,10 +238,14 @@ fn floor_cost_distribution_lines(
Present { value: b } => match latest {
Absent => []
Present { value: c } => {
let infl = identity_inflation_permille(base: b, other: c, min_base_ms: min_base_ms)
let obs = identity_inflation(base: b, other: c, min_base_ms: min_base_ms)
concat(
[concat("paired inflation observations\t", to_string(count(infl)))],
[50, 90, 95, 99] |> map(p => percentile_line(values: infl, percent: p))
[
concat("paired inflation observations\t", to_string(count(obs.permille))),
concat("pairs available\t", to_string(obs.paired)),
concat("pairs refused as right-censored\t", to_string(obs.censored_pairs))
],
[50, 90, 95, 99] |> map(p => percentile_line(values: obs.permille, percent: p))
)
}
}
Expand Down Expand Up @@ -210,6 +283,22 @@ fn floor_cost_distribution_report_for(
// THE RUN IDS ARE DATA HERE BECAUSE THE FINDING IS ABOUT THESE RUNS. A measurement over "whatever
// happened to be downloaded" is not re-derivable -- a second reader would get different numbers and
// have no way to tell a real change from a different sample. Naming them is the citation.
// EVERY RUN NAMED BELOW PREDATES THE DISJOINT COST COLUMNS AND THEREFORE REFUSES TODAY. Stated
// here rather than left to be discovered, because a refusing instrument that does not say why
// reads as broken.
//
// These artifacts carry the old shared `cpu_ms` header, in which a completed cost and a
// right-censored bound occupy one column. `claim_cost_columns` no longer resolves that header, so
// each run loads as `RunEmpty` and `floor_cost_distribution_check` refuses the sample naming all
// ten. That is the correct answer and not a regression: the two populations are not separable in
// those bytes, and the previous behaviour -- reading every row as a completed cost -- is the defect
// this module was the live specimen of. Re-reading them "just for the observed rows" is not
// available either, since which rows those are is exactly what the old artifact does not say.
//
// WHAT RESTORES IT, and it is one line of data rather than any code: re-point this list at
// required-floor runs at or after the artifact change, whose `required-floor-claim-cost` carries
// `cost_reading` and the per-kind columns. The analysis itself is unchanged and its witness runs
// on a hand-built fixture, so nothing here is waiting on the re-sample except the live figures.
data floor_cost_sampled_runs: List<NonEmptyStr> = [
"33668368846" as NonEmptyStr,
"33670164259" as NonEmptyStr,
Expand Down
Loading
Loading