internal_resolution_pct ships without its denominator: it is computed over 50 of 709 files and looks identical on a 50k-file repo #149
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
h-dv/code-index#149
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by a production-readiness review.
The number
internal_resolution_pct: 42.3sits at the top level ofproject_overview, next to repo-widerefs/refs_resolved(21.9%). It has:semanticsstring,It is computed over
file_health— 50 of 709 files (7.1%), covering 38% of refs, and deliberately the highest-ref files. So it is a biased sample presented beside an unbiased one, with nothing distinguishing them.On a 50k-file repo the same
LIMIT 50covers ~0.1% of files and the number looks exactly the same. It silently becomes less meaningful as the repo grows, which is the opposite of what a reader will assume.The sibling
resolution_gaps.dynamic_influenceis the only block in that response with nosemantics, is absent from the tool description entirely, and its counts (134,278) sum against an unstated population — unresolved, non-binding, non-reclassified refs — rather than the 226,714 the same response implies.Ask
Every ratio in a payload carries its denominator, or it is not a ratio. This project already has the mechanism (
count_basis,counts_scope, the*_unmeasuredfamily); these two fields just never got it. One clause, both fields — not a fix per field.Related
count_basiswork that established the pattern🤖 Generated with Claude Code
https://claude.ai/code/session_01K1zj5VcFJvJt3pQxe9259K
Triage 2026-09-06: LEFT OPEN — one field substantially fixed with a caveat, the named sibling untouched. Reported as fixed; it is half.
internal_resolution_pct/file_health— substantially fixedThe cut is disclosed by fields, in the
entry_points_total/entry_points_truncatedshape, three-state:FILE_HEALTH_CAP + 1, so truncation is measured, not inferred —crates/mcp-server/src/server.rs:9148.file_health_truncated:9153,file_health_total:9154, declared:9384, emitted:9522..ok()rather thanunwrap_or_defaultkeeps "the daemon could not answer" apart from "nothing was cut" —:9142-9148.bounding_site_registry.rs:340-355re-classifiesFILE_HEALTH_CAPfromIntentionaltoField("file_health_total + file_health_truncated"), andENTRY_POINTS_CAPlikewise at:358-372. That re-classification is the durable part: a cap that claims to be intentional is exempt from disclosure, and these no longer are.THE CAVEAT — the literal ask is still not met
file_health_totalis emitted only when the cut did not bite:.filter(|h| h.len() <= FILE_HEALTH_CAP),server.rs:9154-9157.So in the exact case this issue's title names — 50 of 709 —
file_health_totalis absent, and onlyfile_health_truncated: trueships. The reader learns "this is a sample of unknown size", not "50 of 709".That is defensible: fabricating a population the call never measured would be worse, and "unknown size" is at least not a lie. But it is a different guarantee from "every ratio in a payload carries its denominator", and this issue should be closed on the honest version of the claim, not the literal one — or the code should emit the real total.
No wire test — worth knowing before trusting the fields
file_health_totaloccurs in exactly four places tree-wide: three inserver.rs, one as a registry string atbounding_site_registry.rs:354. No test asserts either field's value on a realproject_overviewpayload.overview_payload_budget_e2e.rsalready builds a saturated fixture with 120 ref-carrying files — 2.4× the cap (:511,:988) — which is exactly where that assertion belongs, and it checks only the row count. A wrongfile_health_totalwould ship green.resolution_gaps.dynamic_influence— NOT FIXEDThis issue named it as the sibling and asked for "one clause, both fields — not a fix per field." The second field did not move:
semanticson the wire.graph::DynamicInfluence(crates/daemon/src/graph.rs:1429) carriesbuiltin_only,dynamic_endpoint,dynamic_influenced,not_reported— and no population string. Its siblingGapScopehaspub semantics: Stringat:1470, which is the shape this one is missing.resolution_gaps'#[tool(description = …)]atserver.rs:13834namesresolver_degradationandscopeand never mentionsdynamic_influence.not_reportedis not this issue's work —git log -Sputs it in79108fb feat: computed resolution influence (#77 step 7).What closing needs
file_health_totalshould ship the real total when the cut bites, or whether "sample of unknown size" is the accepted answer — and if the latter, amend this issue's title, which currently promises the denominator.overview_payload_budget_e2e.rs.dynamic_influenceitssemantics, from the same clause — this issue's own instruction.🤖 Triage lane, 2026-09-06, master
45cf6e4FIXED — both fields, from one clause: every ratio in these payloads now carries its denominator, and the wire tests the triage said were missing exist.
Lane worktree
/tmp/cosi-lane-budget, rebased ontoorigin/master(87a3fc8). Not pushed.1.
internal_resolution_pct— the literal ask, metThe triage recorded the caveat honestly:
file_health_totalships only when the cut did not bite, so in the exact case this issue's title names — 50 of 709 — the reader learned "a sample of unknown size", not "50 of 709". That is a different guarantee from "every ratio carries its denominator".The resolution is that the rate's denominator was never the file count.
internal_resolution_pctisresolved / (resolved + internal_missed)— a ref ratio taken over the sample. So the two sums it divided now ride beside the quotient:The ratio now literally carries its denominator, exactly, with no new query and no fabricated population.
file_health_total/file_health_truncatedkeep saying what the sample was — andfile_health_totalstill stays absent when the cut bit, because the probe readsFILE_HEALTH_CAP + 1rows and therefore never measures the population it cut from. A number there would be a fabricated denominator, which is worse than an absent one. That is now asserted, in both directions, rather than argued.Cost: ~17 wire tokens on
project_overview. FIELDS, not prose, in theentry_points_total/entry_points_truncatedshape this response already uses — asemanticsparagraph would have been ~75 tokens on the first call an agent makes, against a content ceiling with 44 tokens of headroom (see #98).Three-state throughout: both basis fields are absent exactly when the rate is, and that is asserted.
2.
resolution_gaps.dynamic_influence— the sibling, from the same clauseIt now carries
semantics, the shapeGapScopebeside it already had, written from the SQL predicate rather than from memory:That names the three ways 134,278 differs from the 226,714 the same response implies.
Deliberately NOT added to the tool description. This project's standing rule is that a disclosure belongs in the payload and description prose is unread and expensive — and
resolution_gaps' description is already 1,427 characters on a startup payload that failed on Windows CI at87a3fc8(16,558 of 16,555; see #160). Thesemanticsstring travels with the block it qualifies, which is where a reader meets it.3. The wire tests the triage said were missing
It would not now.
overview_payload_budget_e2e.rs, on the fixture the triage identified — 120 ref-carrying files against a cap of 50 — asserts, both directions:file_health_truncated == true, andfile_health_totalabsent, with the reason in the message;file_health_truncated == false, andfile_health_total ==the rows actually served — "where the cut did not bite the sample IS the population, and that is the one case the total can be stated";internal_resolution_pctreproduces from the two published sums, or the pair is decoration.MUTATIONS (RUN)
internal_resolution_basisreturning(resolved, resolved)— a denominator echoing its numerator → RED inserver.rs's unit gate onresolved/(resolved+internal_missed); the e2e's quotient check is the wire-side half of the same predicate.no_candidate(5 of 9 refs in the fixture), which is the whole reframing and the reason the bare percentage beside repo-widerefswas unreadable.One thing this change had to be registered for, and it is a good gate
resolution_percentage_stance::every_percentage_site_in_the_tree_is_registeredwent RED on the new e2e assertion — "computes or names a resolution percentage and has NO row in SITES". Registered asFixtureAsserted, with the reason: the assertion is an internal-consistency check in which the value cancels, so a tree that resolved nothing or everything passes identically and the only way to redden it is to publish a denominator that does not reproduce the published quotient — which is the defect this issue was filed about. #45 criterion 7 is untouched: no stance permits gating on a real tree.For the record
not_reportedis correctly not this issue's work —git log -Sputs it in79108fb. Untouched.Gates
cargo fmt --all -- --check0 ·cargo clippy --workspace --all-targets -- -D warnings0 ·RUSTDOCFLAGS="-D warnings" cargo doc …0 ·cargo test --workspace --no-fail-fast0 ·COSI_E2E_LEG=daemonon the overview suite 0 · corpus ratchetexecuted=7, baselines untouched.🤖 Payload-budget lane, 2026-09-06
STAYS OPEN — narrowed to one missing gate. Both fields shipped; one of them is ungraded.
Close-out lane, verified on merged master
fc329a8.Half 1 — the rate now carries its basis, and it is graded.
internal_resolution_resolved/internal_resolution_refsare declared on the reply struct atcrates/mcp-server/src/server.rs:9429-9441and populated at:9563-9564frominternal_resolution_basis()(:4906). The reframing is the honest one: the denominator was never the file count — it is a ref ratio over the sample, and the two sums it divides now ride beside the quotient. The sample's own size and truncation ship too (file_health_total/file_health_truncated,:9179-9188), withfile_health_totaldeliberately absent when the cut bit, because the call never measures the population it cut from.Graded by
internal_resolution_ships_the_two_sums_it_divided(:19950) — pins(3, 4)on a fixture with 9 refs of which 5 areno_candidate, so it pins that the denominator excludes them; the(resolved, resolved)mutation is RED — and on a real payload byoverview_payload_budget_e2e.rs:1193, in both the saturated and small directions.RUN, exit 0:
internal_resolution_ships_the_two_sums_it_divided ... ok·COSI_E2E_LEG=daemon overview_payload_budget_e2e3 passed ·influence_disclosure_e2e4 passed.Half 2 — the sibling got the field but not the gate, and that is the residual.
resolution_gaps.dynamic_influence.semanticsexists (crates/daemon/src/graph.rs:1446-1462declared,:2165-2176populated, written from the SQL predicate directly above it) and does reach the wire throughrpc_index.rs:984 → typed(...)andserver.rs:13905 → ok_json(&resp).Nothing asserts it. The field is built with
..Default::default()under#[serde(default, skip_serializing_if = "String::is_empty")], so deleting thesemantics:initializer atgraph.rs:2165compiles, silently drops the disclosure from the payload, and every suite stays green. Its distinctive fragments —"The four sum to","is not a `binding` row","folding them in would claim"— occur nowhere outsidegraph.rs. The one wire test over this block,influence_disclosure_e2e.rs:196 resolution_gaps_splits_its_own_population_by_influence, asserts the four counts sum to the reason-code population and never touchessemantics.disclosure_surface_registry.rs:417-427checks only that the producer call exists, and its own header (:62-69) says so.This is the same "a wrong value would ship green" finding the 2026-09-06 triage made about
file_health_total— fixed on one half of the pair, still standing on the other. The issue asked for "one clause, both fields — not a fix per field", and one field's clause has no test under it.Close this when
resolution_gaps_splits_its_own_population_by_influence(or a sibling) assertsdynamic_influence.semanticsis present and non-empty on the wire, with the deletion of the initializer recorded as a mutation that was RUN to red.Fixed and released in v0.27.0 — both halves. This issue was never closed.
The rate now carries its denominator
internal_resolution_pctships besideinternal_resolution_resolvedandinternal_resolution_refs, and the gate requires the quotient to reproduce from them (crates/mcp-server/tests/overview_payload_budget_e2e.rs:1436-1466), on BOTH the small and the saturated overview:That last sentence is the part worth keeping. A denominator that merely exists would satisfy a field-presence check while still being decoration; requiring it to reproduce the published number is what makes it a measurement. The missing-denominator arm quotes this issue verbatim in its panic message, so a regression names #149 rather than a field name.
The two-overview loop is what closes the "looks identical on a 50k-file repo" complaint: the saturated case is where the
LIMIT 50bites, and it must ship a basis showing that it bit.The sibling
resolution_gaps.dynamic_influence.semanticswas the residual, fixed in730bf15. It is worth recording how it was vacuous, because it is a reusable trap: the field was built with..Default::default()behindskip_serializing_if = "String::is_empty", so deleting the initializer compiled, dropped the disclosure from the wire, and left every suite green. It is now asserted on the wire against the terms of the SQL predicate it describes, so a placeholder string cannot satisfy it either.Mutation M6 (delete
dynamic_influence.semantics's initializer) → RED.harness_settle_barrier's leg-routed population went 36 → 37 with the arrival NAMED, per that gate's own standing rule — so the new e2e could not have been added silently.Closing: every ratio in the payload now carries its denominator, which was the ask.