{"record":{"id":"c18c73d567d156f5","repo":"astrid-runtime/astrid","slug":"stability-fixture-has-no-interior-boundary","errorCode":null,"errorMessage":"stability fixture has no interior boundary","messagePattern":"stability fixture has no interior boundary","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-chunker-evidence/src/stability.rs","lineNumber":143,"sourceCode":"    let summary = summarize(&cases, neighborhoods.len())?;\n    Ok(StabilityResult {\n        candidate: candidate.name.clone(),\n        fixture_bytes: u64::try_from(base.len())?,\n        base_chunks: u64::try_from(original.len())?,\n        summary,\n        cases,\n    })\n}\n\nfn sampled_boundaries(\n    original: &[Chunk],\n    quantiles_basis_points: &[u16],\n) -> Result<Vec<(u16, usize)>> {\n    let interior = original\n        .get(..original.len().saturating_sub(1))\n        .ok_or_else(|| anyhow::anyhow!(\"stability fixture has no interior boundary\"))?;\n    if interior.is_empty() {\n        bail!(\"stability fixture has no interior boundary\");\n    }\n    let mut sampled = Vec::with_capacity(quantiles_basis_points.len());\n    let mut previous_index = None;\n    for quantile in quantiles_basis_points {\n        if *quantile == 0 || *quantile >= 10_000 {\n            bail!(\"stability quantiles must lie strictly between zero and 10,000\");\n        }\n        let index = usize::try_from(\n            u64::try_from(interior.len())?\n                .checked_mul(u64::from(*quantile))\n                .and_then(|value| value.checked_div(10_000))\n                .ok_or_else(|| anyhow::anyhow!(\"stability quantile overflow\"))?,\n        )?\n        .min(\n            interior\n                .len()\n                .checked_sub(1)\n                .expect(\"the empty interior returned above\"),","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-chunker-evidence/src/stability.rs#L125-L161","documentation":"`sampled_boundaries` samples boundary positions from a stability fixture at configured quantiles. It drops the last byte to build the 'interior' region; if the fixture is empty or a single byte, there is no interior boundary to sample, so the function refuses rather than returning empty/garbage results.","triggerScenarios":"Calling `measure_fixture` with a fixture byte string of length 0 or 1, so `original.get(..len-1)` yields None (empty input) or an empty interior slice.","commonSituations":"A test/evidence fixture file defined as empty or one byte long; a fixture path resolving to a stub placeholder; configuration listing a fixture that was truncated to a single byte.","solutions":["Replace the fixture with content of at least 2 bytes (practically, many chunk-boundary-sized bytes).","Check the fixture file/path for truncation — verify its size on disk matches expectations.","Skip fixtures smaller than the minimum in the caller before invoking measure_fixture.","If a tiny fixture is intentional, guard sampled_boundaries to return an empty sample instead of erroring."],"exampleFix":"// before\nlet fixture: Vec<u8> = Vec::new();\n// after\nlet fixture: Vec<u8> = (0..64 * 1024).map(|i| (i % 251) as u8).collect();","handlingStrategy":"validation","validationCode":"fn fixture_samplable(fixture: &[u8]) -> bool {\n    fixture.len() >= 2\n}","typeGuard":"fn is_interior_samplable(original: &[u8]) -> bool {\n    original.len().checked_sub(1).map(|n| n > 0).unwrap_or(false)\n}","tryCatchPattern":"match measure_fixture(&fixture, &quantiles) {\n    Err(e) if e.to_string().contains(\"no interior boundary\") => {\n        eprintln!(\"fixture too small ({} bytes); skipping\", fixture.len());\n    },\n    r => r?,\n}","preventionTips":["Generate fixtures of at least several chunk-target-sizes in length.","Assert fixture size at load time in test setup.","Skip fixtures below a minimum-size threshold instead of feeding them to measure_fixture."],"tags":["rust","chunker","fixture","validation"],"backgroundTag":"empty-required-field","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}