Commit Graph
3 Commits
Author SHA1 Message Date
Mansurshakh JaparovandJerrettDavis 93279f3208 fix(smart-crusher): preserve unchanged JSON bytes (#4044)
## Description

Closes #3697.

An unchanged SmartCrusher result now keeps the original bytes and
reports no structural compression. Formatting-only savings come from the
existing Rust JsonMinifier, not from pretending the JSON value changed.

The minifier preserves duplicate keys, order, escapes and number
literals. A mixed result cannot use one section's CCR marker to hide
unmarked loss in another.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] Documentation update

## Changes Made

- Keep SmartCrusher's exact-byte no-op behavior; route actual whitespace
savings through JsonMinifier in Python and the eligible native live
zone.
- Keep all records and JSON literals; do not store originals or inject
CCR markers for lossless minification.
- Preserve mixed routing and reject uncovered lossy sections in both
tool-result formats. Explicit no-CCR behavior is unchanged.
- Replace incidental forwarding tests with native minification and
complete-record regressions; document the distinction.

## Testing

- [ ] Entire Python suite — not claimed.
- [x] Four consumer/native modules: `python -m pytest -q
tests/test_recursive_json.py tests/test_transforms_content_router.py
tests/test_transforms/test_smart_crusher_rust_parity.py
tests/test_transforms/test_smart_crusher_lossless_default.py`
- [x] Changed-file Ruff checks; normal commit hooks, including mypy and
commitlint.
- [x] Manual public-API runs, with and without the HTML extra.

### Test Output

Consumer/native modules:

```text
collected 136 items
============================= 136 passed in 36.43s =============================
```

Normal pre-push (fmt, clippy, 1,668 Rust tests with 3 ignored, native
build, Python checks, commitlint):

```text
======================== 180 passed, 1 warning in 8.35s ========================
✅ ci-precheck PASSED — safe to push.
To https://github.com/oxura/headroom.git
   64688217..0002af3e  HEAD -> fix/3697-unchanged-json-passthrough
```

The first push stopped on an inherited commit footer because
`origin/main` was stale. Fetching the actual upstream ref fixed the lint
range; the normal push then passed. No source merge, lint-rule change or
hook bypass.

Hosted checks on `0002af3e` now pass: all four Python shards, Windows
permissions, smoke tests, native wrappers, parity and Docker e2e.
[Checks](https://github.com/headroomlabs-ai/headroom/pull/4044/checks).

## Real Behavior Proof

- Environment: Linux x86-64, Python 3.13.14, Rust 1.95 and the actual
extension built from this checkout. No provider billing calls.
- Exact command / steps: the earlier localhost `/v1/compress` and
TransformPipeline runs exercised the original fix. For this follow-up,
call `ContentRouter.compress` on a data-only HTML page containing 60
complete records, with `smart_crusher_lossless_only=True`,
`smart_crusher_with_compaction=False`, and `enable_kompress=False`. Run
it once without trafilatura, then with the locked 2.0.0 extra. The new
public-API test contains the full input/config. Separately call
`route_embedded_json` on a compact array followed by a padded array,
with Unicode and CRLF surroundings.
- Observed result: both HTML modes keep all 60 records and the
surrounding markup, with no unrecoverable section. The unchanged first
JSON span does not stop the second span's compaction; surrounding text
stays exact. Final Codecov is 96%; the two remaining lines are the
deferred HTML fallback return. The real no-HTML-extra API run executed
both, and local coverage also exercises the unchanged-span branch.
- Not tested: live provider acceptance, invoices or production cache hit
rates. No native eligibility or admission gates changed.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; existing JSON routing.
- Minimum rollout channel: unchanged.
- Stable/default behavior changed: eligible formatting savings return as
json_minifier; standalone SmartCrusher remains byte-exact on no-ops.
- Kill switch / disable path: existing routing configuration and
HEADROOM_LIVE_ZONE_DISABLE_ARMS.
- Unsafe override required: no.
- Qualification impact: no-op, formatting, structural and CCR paths
exercised separately.
- Rollback path: revert the minifier integration; no persistence
migration.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have made corresponding changes to the documentation
- [x] I did not edit CHANGELOG.md — release-please owns it

## Additional Notes

Addresses the [minifier
review](https://github.com/headroomlabs-ai/headroom/pull/4044#issuecomment-6157583285).
The maintainer’s main merge is retained. The latest follow-up only
changes consumer tests.

AI-assisted; no subagents.

---------

Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-11-03 21:32:42 -06:00
gglucassandClaude Opus 5.5 6326965046 fix(transforms): judge the code_aware Kompress fallback in tokens (#3881)
## Description

`ContentRouter._apply_strategy_to_content` compares two different units
in the `code_aware` path:

- `code_aware`'s result is stored as a **word** count:
`compressed_tokens = len(output.content.split())` (introduced with the
registry dispatch in #2400, after #1857 had moved every other count to
`_estimate_tokens`).
- The no-savings Kompress fallback is then kept only `if fallback_tokens
< compressed_tokens:`, where `fallback_tokens` is a **token** count
(cl100k payload tokens for a real Kompress result).

Code runs about 2 tokens per whitespace word, so an unchanged code block
looks like a ~55% compression and the fallback can essentially never
win. The common case is a Claude Code `Read` of source: the `N\t`
line-number column stops `code_aware` from parsing, it hands the text
back unchanged with `compressed=True`, the fallback runs Kompress over
the whole block (up to ~20 s of ONNX inference on a 1,800-line file,
holding the Kompress slot), and the result is always discarded. The
phantom ~0.45 ratio is then refused by the lossy-unrecoverable guard and
logged as `lossy_unrecoverable_skipped`, 0 tokens saved. It is the same
class as the CONFIG word-count bug fixed in #2759.

Fix:

1. Measure `code_aware`'s output with `_estimate_tokens`, the unit of
`original_tokens` and of every other branch.
2. Measure the Kompress fallback's result with the same estimator
instead of the count Kompress returns (a Kompress passthrough reports
**words**, which would otherwise let an unchanged block "win").
3. The lossless-then-lossy inline Kompress attempt in the same branch is
measured the same way and now recorded in `strategy_chain` even when it
loses, so the no-savings fallback below does not run the identical
inference a second time.

**This is a compression behaviour change, stated plainly.** The fallback
can now win, so a `code_aware` no-op block (typically a large
line-numbered code `Read`) can now be Kompress-compressed with a CCR
retrieval marker, where before it went out verbatim after the inference
was thrown away. Savings go up; the Kompress inference that already ran
now pays for itself. Real `code_aware` compressions are now scored in
honest tokens rather than an optimistic word ratio, so a marginal one
could in principle land above `min_ratio` where it passed before (none
did on the corpus below).

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

- `headroom/transforms/content_router.py`: `code_aware` result counted
with `_estimate_tokens`; the no-savings Kompress fallback and the
lossless-then-lossy inline attempt measured with `_estimate_tokens`; the
inline attempt recorded in the chain before it runs.
- `tests/test_transforms_content_router.py` (new, no tree-sitter
needed):
- `test_code_aware_noop_keeps_a_smaller_kompress_fallback`: a no-op
`code_aware` on 120 line-numbered Rust lines, with a Kompress result
smaller in tokens but larger than the word count, keeps the Kompress
result.
- `test_code_aware_noop_reports_tokens_when_kompress_passes_through`:
when Kompress passes through, the block is reported at its token count,
not its word count.
- `test_code_aware_noop_runs_kompress_once_when_it_passes_through`: with
lossless-then-lossy on, a losing inline attempt is not retried by the
fallback.
- `test_code_aware_noop_keeps_a_smaller_inline_kompress`: with
lossless-then-lossy on, a winning inline attempt is kept, with one
Kompress call.
- `tests/test_code_aware_regressions.py`,
`tests/test_router_registry_dispatch.py`: two existing assertions pinned
the word-count metric (`len(shrunk.split())`); they now assert
`_estimate_tokens`, the unit `original_tokens` uses. Their intent (the
compressor's own estimate must not leak in, a real compression must not
trigger a fallback) is unchanged.
- `tests/test_router_registry_smartcrusher.py`,
`tests/test_openai_responses_context_compaction.py`: two SMART_CRUSHER
no-op tests go through the same shared fallback and asserted the count a
mocked `_try_ml_compressor` reported (one mock "shrank" by returning
longer text than it was given). The mocks now return shorter text and
the assertions use `_estimate_tokens` of it. This also means a Kompress
*passthrough* after a SMART_CRUSHER or CONFIG no-op, which Kompress
reports in words, can no longer be adopted as a phantom saving.

The first two new tests fail on `main` ffc6edb4 (the Kompress result is
discarded; the no-op is reported at 720 "tokens", its word count,
against 2,136 estimator tokens). The third fails when the chain entry is
removed (Kompress runs twice).

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`)
- [x] Type checking passes (`mypy headroom`)
- [x] New tests added for new functionality
- [x] Manual testing performed

### Test Output

```text
$ uv run --frozen --extra dev --extra code pytest tests/test_transforms_content_router.py -q
72 passed, 2 skipped
$ uv run --frozen --extra dev --extra code pytest tests/test_code_aware_regressions.py -q
5 passed
$ uv run --frozen --extra dev --extra code pytest tests/test_router_registry_dispatch.py -q
11 passed
$ uv run --frozen --extra dev --extra code pytest tests/test_transforms/test_content_router.py -q
63 passed
$ uv run --frozen --extra dev --extra code pytest tests/test_lossless_mode.py -q
26 passed
$ uv run --frozen --extra dev --extra code pytest tests/test_builtin_compressor_adapters.py -q
17 passed, 1 skipped
$ uv run --frozen --extra dev --extra code pytest tests/test_content_router_tool_role_reversibility.py tests/test_agent_savings.py -q
10 passed / 39 passed
$ uv run --frozen --extra dev --extra code pytest tests/test_router_registry_smartcrusher.py -q
7 passed
$ uv run --frozen --extra dev --extra code pytest tests/test_openai_responses_context_compaction.py -q
10 passed
# plus every other test file that mocks _try_ml_compressor (kompress_size_gate, lossless_then_lossy, ccr_tag_placeholder_regression,
# relevance_split, kompress_request_nonblocking, bash_search_lossless_fold, text_crusher_routing, transforms_tabular): all pass

# new tests with the headroom/ change stashed (main ffc6edb4):
FAILED tests/test_transforms_content_router.py::test_code_aware_noop_keeps_a_smaller_kompress_fallback
FAILED tests/test_transforms_content_router.py::test_code_aware_noop_reports_tokens_when_kompress_passes_through

$ uvx ruff@0.16.8 check <6 touched files>
All checks passed!
$ uvx ruff@0.16.8 format --check <6 touched files>
6 files already formatted
$ uv run --frozen --extra dev mypy headroom/transforms/content_router.py --ignore-missing-imports
Success: no issues found in 1 source file
```

## Real Behavior Proof

- Environment: macOS 15 (16 GB, under load from a concurrent Rust
release build), Python 3.11 worktree venv with `--extra dev --extra
proxy --extra code` (tree-sitter + ONNX Kompress,
`chopratejas/kompress-v2-base` from the local HF cache, warm), upstream
main ffc6edb4 with and without this commit. A real `HeadroomProxy` after
`seed_proxy_env_defaults()`, with `savings_profile="coding"` and
`code_aware_enabled=True` (what the `headroom proxy` CLI resolves by
default), driven through `anthropic_pipeline.apply(...)` with
`proxy_pipeline_kwargs(config)`.
- Exact command / steps: 23 tool results built from a pristine `git
archive ffc6edb4` of this repo, each sent as `[user, assistant tool_use,
user tool_result]`: 10 Claude Code `Read`s in the `N\t` format (Rust,
Python, TypeScript, Markdown, TOML, YAML), 10 `Bash` outputs (`cat -n` /
`nl -ba` / `sed -n` / `cat` reads, `rg`, `ls -la`, JSON, `git log
--stat`, `git diff`) and 3 raw-code results from a non-excluded MCP
tool. Arms run fix, main, main, fix; `_try_ml_compressor` wrapped only
to count calls and time them.
- Observed result: exactly 4 of 23 items change, all large code `Read`s
where `code_aware` was a no-op and Kompress had already run on main:

  | item | tokens | main saved | this PR saved |
  |---|---:|---:|---:|
| `Read crates/headroom-proxy/src/proxy.rs` (1,709 lines) | 21,040 | 0
(`lossy_unrecoverable_skipped`, Kompress ~15-20 s discarded) | 4,847
(CCR marker) |
| `Read crates/headroom-proxy/src/config.rs` | 10,623 | 0
(`lossy_unrecoverable_skipped`) | 2,072 |
| `Read crates/headroom-proxy/src/responses_items.rs` | 6,614 | 0
(`lossy_unrecoverable_skipped`) | 1,422 |
| `Read sdk/typescript/src/client.ts` | 5,876 | 0
(`lossy_unrecoverable_skipped`) | 799 |

Corpus total 169,870 tokens: saved 13,674 on main vs 22,814 with this
change (+9,140). Kompress calls are the same in both arms (12 per round;
one main round made 13), so this does not reduce inference time; it
keeps the result of inference main already paid for. The other 19 items
are byte-identical between arms. A first full run of the same corpus was
deterministic in both arms with the identical totals. In the second run
the machine's concurrent build pushed a few Kompress calls past the 20 s
request deadline (27.6 s on `proxy.rs`), so in one fix round `proxy.rs`
and `config.rs` came back `ratio_too_high`, and in one main round
`server.py` flipped; that is load, not the change. With `ProxyConfig`
defaults (`code_aware` off, no savings profile) a 20-item run was
byte-identical between arms.
- Not tested: the model-facing effect of a Kompress-compressed code
`Read` in a live Claude Code session (whether it is retrieved via CCR or
re-read); Kompress on GPU backends; the latency effect of skipping a
fallback that provably cannot win (not implemented, see Additional
Notes).

### Update: measured on top of #3885

The four gains above were measured with each `Read` as the NEWEST
message. Under `mode=token` with `savings_profile="coding"` (or
`"general"`), a newest `Read` is only compressible because of a separate
bug: the profile's `protect_recent=0` reaches the router as
`read_protection_window=0` and replaces token mode's `max(4, 0.3*n)`
window, so a `Read` has no protection at any position. #3885 fixes that.
Without #3885, this PR turns the newest file read into a lossy one-line
rewrite (`analyzer.py` 13,461 -> 11,139 tokens, newlines 1,082 -> 1);
with it, that read stays byte-exact.

Re-measured on the installed 0.39.0 wheel with the hunks exec'd
in-process: a 23-item corpus of 147,527 tokens built from `git archive
ffc6edb4` (10 `Read`s including the four above, 10 Bash outputs, 3 MCP
code results), a fresh `HeadroomProxy` per arm, real ONNX Kompress with
`HEADROOM_KOMPRESS_TIME_BUDGET_SECONDS=0` so load cannot flip a result.
"aged" = the item followed by 40 messages. Both arms with this PR were
run twice; 0 of 92 rows differed.

| #3885 | this PR | newest: saved | aged: saved |
|---|---|---:|---:|
| no | no (main) | 19,972 (13.5%) | 19,972 (13.5%) |
| no | yes | 38,240 (25.9%) | 38,240 (25.9%) |
| yes | no | 9,696 (6.6%) | 19,972 (13.5%) |
| yes | yes | 9,696 (6.6%) | 38,240 (25.9%) |

With #3885 in place this PR adds nothing on a newest `Read` (routed
`excluded_tool`) and +18,268 tokens once the same four code `Read`s age
out of the window (proxy.rs 10,131, config.rs 4,487, responses_items.rs
2,145, client.ts 1,505; the other 19 items are identical). Per-item
savings are about 2x the table above because this ran on the 0.39.0
wheel rather than main. Two limits: in live traffic an aged `Read`
already inside the frozen prefix is never recompressed, so this is an
upper bound; and under the default 20 s Kompress budget, proxy.rs (14-65
s of inference on a loaded 16 GB laptop) often comes back unchanged on
slower machines. Recommend merging #3885 first or together.

## Runtime Rollout Safety

- Rollout-managed feature(s): None.
- Minimum rollout channel: Stable.
- Stable/default behavior changed: Yes, when `code_aware` is enabled
(the CLI default): a `code_aware` no-op block whose Kompress fallback is
smaller in tokens is now Kompress-compressed with a CCR marker instead
of forwarded verbatim; `code_aware` results are reported in estimator
tokens instead of words. With `code_aware` disabled, nothing changes.
- Kill switch / disable path: `--no-code-aware` /
`HEADROOM_CODE_AWARE_ENABLED=0` (no-op blocks then take the plain
Kompress route), or `HEADROOM_DISABLE_KOMPRESS=1` to turn Kompress off
entirely. No dedicated switch for this fix.
- Unsafe override required: None.
- Qualification impact: Savings rise on large code reads (+9,140 tokens,
+67% relative, on the corpus above). Those blocks now carry a lossy
Kompress body plus a CCR retrieval marker, so it is worth watching
retrieval and re-read rates on the release that carries it.
- Rollback path: Revert this PR.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Screenshots (if applicable)

N/A

## Additional Notes

- Documentation: N/A, internal accounting.
- For reviewers: under the coding profile (`protect_recent=0`), a Claude
Code `Read` result is already compressible on `main` (`codex.py` and
`server.py` above are compressed by `code_aware` on both arms). If the
intent is that `Read` results are never lossy-compressed, the word-count
bug was masking a gap for no-op code reads, and that deserves an
explicit protection rather than this accident; this PR does not change
which blocks reach the router. #3885 is that protection for recent reads
in token mode (see the update above).
- Deliberately left out: skipping the Kompress call when it provably
cannot win. In tokens, the only hard bound (the words Kompress always
keeps, plus its marker) rarely reaches the block's token count, and on
this corpus the fallback won 4 of the 5 times it ran. A heuristic skip
is a latency optimisation with its own savings trade and belongs in its
own PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 08:40:48 -05:00
r00tandshekharcharles 3f14eac060 fix: correct Go AST compression bugs and CODE_AWARE token accounting (#1668)
## Description

Fixes four real bugs that made CODE_AWARE (AST-based) compression
silently non-functional for Go, plus the product-behavior change to make
CODE_AWARE the default for code (previously in #1670, now consolidated
here per review).

Closes #

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

- `code_compressor.py`: unwrap tree-sitter-go's single `statement_list`
wrapper node when building `body_stmts` — its row range was swallowing
the block's own closing-brace row, producing a duplicated `}` in
compressed Go output.
- `code_compressor.py`: match opening-brace lines by `endswith("{")`
instead of `startswith("{")`, so multi-line Go signatures (e.g. `) error
{`) aren't silently dropped from the compressed output.
- `content_router.py`: normalize CODE_AWARE's `compressed_tokens` to
`len(compressed.split())`, matching the word-split convention every
other strategy (search/log/tabular/diff) already uses for
`original_tokens`. Previously the mismatched scales made genuinely-good
compressions look like "no savings" and get discarded for the Kompress
fallback.
- `content_router.py`: default `prefer_code_aware_for_code` to `True`
(was `False`) — CODE_AWARE gives higher, syntax-safe compression than
Kompress for code, so now that the bugs above are fixed it should be the
default path. (Consolidated from #1670, now closed.)
- `server.py`: add `HEADROOM_PREFER_CODE_AWARE_FOR_CODE` env override
for `ContentRouterConfig.prefer_code_aware_for_code`, mirroring the
existing `HEADROOM_CODE_AWARE_ENABLED` pattern, defaulting to `True`.
- Formatting: ran `ruff format` on `server.py` and `content_router.py`
(CI was failing on this).
- `tests/test_code_aware_regressions.py` (new): 5 regression tests —
- Go `statement_list` unwrap: no duplicated closing brace after
truncation.
  - Multi-line Go signature: `) error {` line survives truncation.
- ContentRouter CODE_AWARE token accounting: `compressed_tokens` matches
`len(compressed.split())`, and a real compression doesn't trigger a
needless Kompress fallback.
- `prefer_code_aware_for_code` defaults to `True` on the
`ContentRouterConfig` dataclass.
- `prefer_code_aware_for_code` defaults to `True` via the
`HEADROOM_PREFER_CODE_AWARE_FOR_CODE` env var (through a real
`HeadroomProxy` construction).

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`)
- [x] New tests added for new functionality
- [x] Manual testing performed

### Test Output

```text
$ python -m ruff check headroom/proxy/server.py headroom/transforms/code_compressor.py headroom/transforms/content_router.py tests/test_code_aware_regressions.py
All checks passed!

$ python -m ruff format --check headroom/proxy/server.py headroom/transforms/code_compressor.py headroom/transforms/content_router.py tests/test_code_aware_regressions.py
4 files already formatted

$ python -m mypy ...
Not run — mypy not installed in this environment.

$ python -m pytest tests/test_code_compressor_thread_safety.py tests/test_content_router_exclude_tools.py \
    tests/test_content_router_tool_role_reversibility.py tests/test_compression_units.py \
    tests/test_compression_determinism.py tests/test_compression_safety_rails.py tests/test_netcost_gate.py \
    tests/test_code_aware_regressions.py -q
15 failed, 66 passed, 1 warning in 7.17s
# The 15 failures are the same pre-existing/environment-specific ones from
# before (reproduced identically on a clean upstream/main checkout with no
# code changes — missing torch/trafilatura/playwright, stale Rust _core
# build in this checkout), not caused by this change. All 5 new regression
# tests in test_code_aware_regressions.py pass.
```

## Real Behavior Proof

- Environment: Windows, Python 3.11.9, headroom-ai pipx install (0.28.0)
with the same fixes applied, plus this fork's checkout for lint/test
verification.
- Exact command / steps: ran `CodeAwareCompressor.compress()` directly
against real `.go` files from an external ~100-file Go codebase, and
separately routed the same files through the full `ContentRouter` with
`HEADROOM_PREFER_CODE_AWARE_FOR_CODE=1`.
- Observed result: 72/97 files routed to `code_aware` and compressed
with syntactically valid Go output (parsed via tree-sitter re-check), 0
invalid-syntax fallbacks, 0 "routed but unchanged" cases, 14641 total
tokens saved. Before the fix: 0 tokens saved via this path (all bugs
combined made it a no-op).
- Not tested: `mypy`, and the full repo test suite (blocked by unrelated
pre-existing environment issues — see Test Output).

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] I have updated the CHANGELOG.md if applicable

## Additional Notes

Per @JerrettDavis's review: consolidated #1670 (the
`prefer_code_aware_for_code` default flip) into this PR and closed #1670
as the duplicate; fixed the `ruff format` CI failure; added the 4
requested regression tests (Go statement_list dedup, multiline-signature
brace preservation, content-router token-accounting parity, and the
config-default pin).

---------

Co-authored-by: shekharcharles <shekhar.aegis@gmail.com>
2026-07-07 11:36:49 -05:00