chore(rust): re-land DocumentCompactor walker (squash-merge lost it from main)#288
Merged
chopratejas merged 1 commit intomainfrom Apr 28, 2026
Merged
Conversation
…rom main) Stage 3c.2 PR3a-redux. The original PR3a (#286) was merged on GitHub on 2026-04-27 but its content never reached main — its parent merge (#285 PR2) was squash-merged, which drops commits stacked on top of the source branch. The walker module disappeared along with the intermediate commits. This PR re-lands `walker.rs` and updates the `compaction/mod.rs` re-exports — same content as commit 4db4f46 from the lost branch. No new functionality, no behavior change for existing crusher paths. # What the walker does (recap) Recursive descent over any JSON value: match value { Object(m) => recurse into each field Array(xs) => recurse into items, then try TabularCompactor on the array String(s) => parse-as-JSON-and-recurse / CCR-substitute / leave scalar => unchanged } Compactable spots become inline strings holding the rendered bytes. The wrapping JSON structure is preserved. # Why chore, not feat This is a re-land of previously-merged-but-lost code. No new feature shipped — fixing a regression caused by the stacked-PR squash-merge accident. Using `chore` keeps the version from bumping for what is effectively a parity restoration. # Tests - 13 walker unit tests pass. - 462/462 headroom-core lib tests overall. - 17/17 SmartCrusher parity fixtures byte-equal (untouched). - 185/185 Python tests pass. - make ci-precheck green. Module: crates/headroom-core/src/transforms/smart_crusher/compaction/walker.rs
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Re-lands the walker module that was lost when PR #285 (PR2) was squash-merged. The original PR3a (#286) was merged on GitHub on 2026-04-27, but because it was stacked on top of PR2's branch and PR2 was squash-merged, the walker commit (`4db4f46`) disappeared along with the intermediate history. This PR brings back the same content unmodified.
Type: `chore` — no new functionality, just a regression fix for the squash-merge accident. Using `chore` instead of `feat` so it doesn't bump the package version.
What the walker does
Recursive descent over any JSON value, applying lossless compaction at every compactable spot:
```rust
match value {
Object(m) => recurse into each field's value,
Array(xs) => recurse into items, then try TabularCompactor on the array,
String(s) => parse-as-JSON-and-recurse / CCR-substitute / leave,
scalar => unchanged,
}
```
Output: same JSON shape with compactable spots replaced by inline strings holding the rendered bytes. Wrapping object/array structure is preserved — only bulky leaves get replaced.
What stacks next
With the walker back, PR3b (document-level token budget + selective lossy escalation) can now build on top of it cleanly. Without the walker, PR3b had no place to plug in.
Tests
Provenance