diff --git a/CHANGELOG.md b/CHANGELOG.md index 262bffc0..737f833c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,8 +36,9 @@ All notable changes to TEPP are documented here. The format follows Keep a Chang ## [Unreleased] -- Restored protected-main gate integrity after the consolidation merges: hourly-scheduler prompt-contract tests now assert the gap-baseline-derived task contract (Gap ID naming, no invented weights) instead of stale increment-specific tokens, the operator-gap register inventory matches the live 33-PR queue, `evidence_core::image_unit` non-image/empty-subtype refusals and `load_union_branch_totals` valid-record accumulation have exact coverage, and the README crate fence plus duplicate registry entries stay deduped. -- Branch-coverage diagnostics on the post-consolidation head exposed two uncovered outcomes in `evidence_core::image_unit` (`is_image_media_type_token` non-image prefix and empty-subtype refusals), one uncovered authored line (the strip-prefix refusal), and lost valid-record coverage for `load_union_branch_totals`; exact red-to-green cases now cover the non-image/empty-subtype data URIs and per-coordinate True/False accumulation. +- `evidence_core::image_unit::is_image_media_type_token` now executes the `strip_prefix("image/")` None arm (`return false`) from a direct unit test. `contains_base64_image_data_uri` searches `data:image/`, so a `data:text/plain;base64,...` body never reaches that helper; the earlier claim that those public URIs covered the authored line and the False branch was incorrect. +- Restored protected-main gate integrity after the consolidation merges: hourly-scheduler prompt-contract tests now assert the gap-baseline-derived task contract (Gap ID naming, no invented weights) instead of stale increment-specific tokens, the operator-gap register inventory matches the live 33-PR queue, `evidence_core::image_unit` empty-subtype public-URI refusal and `load_union_branch_totals` valid-record accumulation have exact coverage, and the README crate fence plus duplicate registry entries stay deduped. +- Branch-coverage diagnostics on the post-consolidation head exposed two uncovered outcomes in `evidence_core::image_unit` (`is_image_media_type_token` non-image prefix and empty-subtype refusals), one uncovered authored line (the strip-prefix refusal), and lost valid-record coverage for `load_union_branch_totals`; exact red-to-green cases cover the public non-image/empty-subtype data URIs (those public URIs do not reach the private `strip_prefix` None arm) and per-coordinate True/False accumulation. - Repaired post-consolidation merge fallout that left protected `main` red: restored the lost `return True` in the `check_coverage.py` match-guard branch, removed the shadowed duplicate `load_union_branch_totals` and `_is_multiline_match_guard` definitions plus duplicate workspace-crate entries (`episode_membership`, `analysis_engine`) from the contract tuple and Cargo member arrays, split two union-fused four-tuples back into `(variant, message)` pairs in the `event_core` error table, repaired the fused `identity_recovery_rate` body in `episode_membership::window`, deduplicated the checked-arithmetic eligible-count block in `analysis_engine`, fixed four-argument `unit()` test call sites, rebalanced the README crate-list fence around all 54 unique crates, and deduplicated the `location_membership`/`validation_core`/`tepp_api` architecture-table rows. Also documents private `PLAUSIBLE_IMAGE_MEDIA_TYPES` so `cargo doc -D warnings` passes. - Branch coverage JSON now unique-folds `files[].branches` True/False counts across instantiations. Nightly totals on #49 head `1e3e2eb` reported `event_time.rs` 505/506 while every unique site had both arms taken (253 sites × 2 instantiations). Summary-only reports without branch arrays still fail closed on totals. The 100% contract is unique production arms, matching the LCOV authored-line gate. Still not a Kalman filter, not a matrix `expm`, not ESEM estimation, not DSEM, and not ctsem estimation. - `psychometric_core` maps overflowing `expm1(a Δt)` / `expm1(2 a Δt)` in `recover_discrete_constant_predictor_effect` and `recover_discrete_process_noise` through the log-space rewrite without a redundant `if !argument.is_finite()` after overflow. Local crate llvm-cov on #49 head `559e7b399473ee90ba3234677dd9ef7f05f7fd2e` was 509/510: the same LLVM `exp`/`expm1` finite-argument proof as L768/L5040. Existing rewrite (`a = 800` / `a = 400`) and overflow (`a = 1e308`) tests remain the contract. Still not a Kalman filter, not a matrix `expm`, not ESEM estimation, not DSEM, and not ctsem estimation. diff --git a/crates/evidence_core/src/image_unit.rs b/crates/evidence_core/src/image_unit.rs index 5be9884a..09edfc16 100644 --- a/crates/evidence_core/src/image_unit.rs +++ b/crates/evidence_core/src/image_unit.rs @@ -172,8 +172,11 @@ fn is_plausible_image_media_type(media_type: &str) -> bool { #[cfg(test)] mod tests { - use super::{embedded_image_units, refuse_base64_image_as_lexical_text}; + use super::{ + embedded_image_units, is_image_media_type_token, refuse_base64_image_as_lexical_text, + }; use crate::{DocumentRecord, EvidenceError, SourceArtifact}; + use std::hint::black_box; #[test] fn jpeg_uri_and_incomplete_prefix_are_classified() { @@ -217,7 +220,8 @@ mod tests { #[test] fn non_image_and_empty_subtype_data_uris_are_not_lexical_images() { - // A non-image media type exercises the strip-prefix refusal arm. + // A `data:text/plain` body never matches `data:image/`, so the public + // lexical gate stays Ok without calling `is_image_media_type_token`. assert_eq!( refuse_base64_image_as_lexical_text("data:text/plain;base64,AAAA"), Ok(()) @@ -229,6 +233,18 @@ mod tests { ); } + #[test] + fn non_image_media_type_token_refuses_non_image_prefix() { + // `contains_base64_image_data_uri` searches `data:image/`, so a + // `data:text/plain` body never reaches this helper. Call it directly + // so the `strip_prefix("image/")` None arm (`return false`) executes. + assert!(!is_image_media_type_token(black_box("text/plain"))); + assert!(!is_image_media_type_token(black_box("application/json"))); + assert!(!is_image_media_type_token(black_box( + "text/plain;charset=utf-8" + ))); + } + #[test] fn common_raster_media_types_are_accepted() { let text = "a data:image/png;base64,AAAA b data:image/jpeg;base64,BBBB \