feat: residual-size splitting with flattened placement#23
Merged
Conversation
Split's file decision was top-down and coupled to recursion: a node's size was measured before its children were extracted, and the walk only descended into nodes it had already decided to extract. To reach a dataset's deep custom SQL the quicksight preset force-extracted the whole PhysicalTableMap chain, so every intermediate level became a one-line !include wrapper file — ~40% of the output on real QuickSight datasets. Rework the engine into two passes. Phase A (decide) judges each node on its residual size — what it holds once its own extracted descendants collapse to one-line !include placeholders — so a passthrough wrapper stays inline while its large child is lifted out. Phase B (place) writes files and rewrites includes, flattening extracted descendants up to the nearest ancestor that owns a file (dataset/customsql.yml, not dataset/physicaltablemap/<uuid>/customsql.yml). Separate reach from forcing a file: add Rules.LeadsBeyond so the walk can descend past --max-depth toward a deep rule target without forcing a file at each level, and trim the quicksight dataset rules to DataSet, CustomSql, and the SqlQuery sidecar. ForceExtract keeps meaning "always a file", so the dashboard sheet/category layout is unchanged. join is untouched. On the target datasets: .yml files 55->34, all 21 one-line stubs gone, sidecars and byte-for-byte round-trip intact. Co-Authored-By: Claude Opus 4.8 (1M context) <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 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
Reworks split's file-extraction engine from a single top-down pass into two passes so it stops emitting one-line
!includewrapper files.Previously a node's size was measured before its children were extracted, and the walk only descended into nodes it had already decided to extract. To reach a dataset's deep custom SQL, the quicksight preset force-extracted the whole
PhysicalTableMapchain, so every intermediate level became a one-line!includewrapper — ~40% of the output on real QuickSight datasets.What changed
!includeplaceholders — so a passthrough wrapper stays inline while its large child is lifted out.dataset/customsql.yml, notdataset/physicaltablemap/<uuid>/customsql.yml).Rules.LeadsBeyondseparates reach from forcing a file: the walk can descend past--max-depthtoward a deep rule target without forcing a file at each level.ForceExtractkeeps meaning "always a file", so the dashboard sheet/category layout is unchanged.DataSet,CustomSql, and theSqlQuerysidecar.joinis untouched.Results
On the target datasets:
.ymlfiles 55 → 34, all 21 one-line stubs gone, sidecars and byte-for-byte round-trip intact.Docs
New ADR-0003 documents the residual-size + flatten design; README and the config guide updated.
🤖 Generated with Claude Code