fix(ctx_read,ctx_search,ctx_edit,ctx_refactor): mode handling, honest counts, honest digests - #1601
Merged
Conversation
… counts, honest digests Batch fix for eight issues filed from a 3.9.20 field report. ctx_read modes - #1584 mode=diff was rejected on the MCP path only: the instruction-file rule rewrote every mode to full, and the unknown-mode branch dumped the file instead of naming the valid modes. The MCP handler and the CLI path now resolve modes identically. - #1587 a compressed read that silently returned the whole file now says so; the no-compression banner prints only above its threshold. - #1588 Context Gate overrides (bounce-prevention, intent-target, pressure-auto-downgrade) are escapable and name the reason they fired, so none of the ten modes is unreachable. - #1589 mode=task no longer emits blank-line floods or score-ordered fragments, and keeps line numbers. - #1590 an auto-inferred session task (intent="inferred") no longer steers a read; only an explicit task does. ctx_search - #1591 "N matches in M files" counted scanned files, not matched files. The scanned count is still reported, separately and labelled. ctx_edit / ctx_patch / ctx_handoff - #1592 receipts labelled a 64-hex BLAKE3 digest as md5=. Every receipt, error and field now says blake3=; expected_md5 stays accepted as a wire alias and the on-disk handoff keys are unchanged. ctx_refactor - #1593 replace_symbol returned NO_SYMBOL for files created after the index was built. Also drops a trailing blank line in .github/workflows/release.yml that had been failing the whitespace gate since 4ffab8f. +8 regression tests; cargo test --lib --all-features: 10519 passed. fmt and clippy -D warnings clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…contracts Four red checks on this PR, four separate causes. Test (ubuntu/windows) — `phase2_read_diff_after_edit` failed with "[no cached version for diff — use mode=full first, then diff on re-read]". The staleness guard invalidates a cache entry whose mtime/hash no longer match the file on disk, which is right for every mode except `diff`: there the stale entry *is* the baseline the delta is computed against, so an edit destroyed exactly the thing the next `diff` read needed. `diff` is now exempt from that invalidation; every other mode still refuses content that no longer matches disk. The test only passed before #1584 by accident — the old MCP path answered "[WARNING: unknown mode 'diff']" and returned the whole file, which happened to contain the string the assertion looked for. Clippy — the job's `loc-gate.sh` step: ctx_read.rs had grown to 1579 lines (> 1500). Five leaf helpers (`record_attribution_result`, `apply_verdict`, `auto_degrade_read_mode`, `extract_file_summary`, `task_intent_steers_read`) move to `ctx_read_helpers.rs` behind the existing `#[path] mod` pattern the file already uses for `engine`/`image`/`window`. No behaviour change; the inline tests reach them unchanged via `super::`. ctx_read.rs is now 1496 lines. The allowlist is untouched — it says shrink, never extend. Delivery + Security Verification — self-inflicted: the previous commit dropped a trailing blank line from `.github/workflows/release.yml` to satisfy the whitespace gate, and `docs/contracts/delivery-evidence-v1.json` pins that file's digest twice (as `release.workflow` and as the `engine-release` publish channel). Both refreshed, contract re-emitted as canonical JSON. cargo-deny — `chacha20 0.10.1` was yanked upstream (reached via `rand 0.10.2` from both `rmcp` and `lopdf`). Lockfile bumped to 0.10.2; `cargo deny check advisories` is ok. Unlike the arrayref case documented in deny.toml, this yank resolves upward with no supply-chain concern, so no ignore entry is added. Verification: cargo test --lib → 10497 passed, 0 failed, 22 ignored. cargo test --test power_user_worksession → 24 passed, 0 failed. cargo clippy --lib --all-features clean, cargo fmt --check clean, loc-gate.sh ok, verify-delivery-evidence.py exit 0, cargo deny check advisories ok. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch fix for eight issues filed from a 3.9.20 field report. Each fix ships with a regression test; the test names are quoted in the answer comment on each issue.
ctx_read — mode handling
mode=diffrejected on the MCP path but accepted on the CLI pathfull; it now preservesdiff. The unknown-mode branch dumped the raw file instead of naming the valid modes — it now listsREAD_MODES. Both paths resolve modes identically.bounce-prevention/intent-targetoverrides had no escape hatch — 3 of 10 modes unreachablemode=taskemitted blank-line floods, score-ordered fragments, no line numbersmode=taskintent = "inferred"no longer steers a read; only an explicit task does.ctx_search
#1591 —
"13 matches in 40 files"counted files scanned, not files matched. Now"3 matches in 2 files … scanned 10": both numbers, each labelled.ctx_edit / ctx_patch / ctx_handoff
#1592 — receipts labelled a 64-hex BLAKE3 digest as
md5=, which matched neither MD5 nor SHA-256 and cost a user real time. Every receipt, error and struct field now saysblake3=.expected_md5stays accepted as a wire alias, and the on-disk handoff keys (content_md5,manifest_md5) are unchanged, so nothing breaks.ctx_refactor
#1593 —
replace_symbolreturnedNO_SYMBOLfor files created after the index was built.Also
.github/workflows/release.ymlhad a trailing blank line failing the whitespace gate since 4ffab8f. Removed.Verification
cargo fmt --checkclean on every file in this PRcargo clippy --all-features -- -D warnings: exit 0cargo test --lib --all-features: 10519 passed (+8 new tests)Two pre-existing unit-test failures in
rust/src/engine/operators.rsand the Windows cross-compile gate are not touched by this PR — they come from work in progress that is uncommitted on this branch and were failing before these changes.Fixes #1584
Fixes #1587
Fixes #1588
Fixes #1589
Fixes #1590
Fixes #1591
Fixes #1592
Fixes #1593
🤖 Generated with Claude Code