Repository navigation
fix(compiler): protect AST cache and reject invalid affine/vector configurations (#736 #665 #666) - #1402
Merged
Conversation
This was referenced Oct 6, 2026
Closed
Closed
Closed
godofecht
force-pushed
the
fix/issue-736-665-666-compiler-guards
branch
from
October 8, 2026 00:20
9661c96 to
582b070
Compare
godofecht
added a commit
that referenced
this pull request
Oct 8, 2026
godofecht
marked this pull request as ready for review
October 8, 2026 00:20
godofecht
added a commit
that referenced
this pull request
Oct 8, 2026
godofecht
force-pushed
the
fix/issue-736-665-666-compiler-guards
branch
from
October 8, 2026 03:33
582b070 to
30f97df
Compare
godofecht
added a commit
that referenced
this pull request
Oct 8, 2026
Records gain a u64 payload checksum after the header (schema 2) and are neither written nor read above 4194304 nodes. A record whose payload does not match, or that has trailing bytes, is a miss and is re-parsed. The directory trust model from #1345 is unchanged, per the resolved question in docs/project/Questions.md.
godofecht
force-pushed
the
fix/issue-736-665-666-compiler-guards
branch
from
October 8, 2026 07:57
30f97df to
5a103e3
Compare
godofecht
enabled auto-merge
October 8, 2026 07:57
godofecht
added a commit
that referenced
this pull request
Oct 9, 2026
godofecht
added a commit
that referenced
this pull request
Oct 9, 2026
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.
Intent
Narrow compiler guards for #665, #666 and the part of #736 that #1345 left open. Part of #665, #666 and #736.
#736 (parse cache, inside the #1345 trust boundary)
flowc_parse_cached: when the cache root leaves no room in the 512-byte key buffer for/+ 16 hex bytes +.ast+ NUL, compile without the cache. Before, the suffix was written past the buffer.A record whose header root is outside
[0, ast_len)is a miss and is re-parsed. Before, any root that passed the magic/schema/size checks was returned as the parse result.tools/flow_cli/sys.flow:write_bytes(raw bytes with NUL) so the test can corrupt a record.Records carry a u64 payload checksum after the header (record schema 2) and a cap of 4194304 nodes. A payload that does not match its checksum, or a record with trailing bytes, is a miss. This follows the resolved question in
docs/project/Questions.md: the cache directory stays trusted as perf: schema-salted non-executable parse cache (#736) #1345 set it, with no ownership checks and noO_EXCLwrites.#665 (affine tiling): a malformed
FLOWC_MLIR_TILEorFLOWC_MLIR_TILE_L2, an L2 without an inner tile, or an L2 smaller than the inner tile is refused with a diagnostic. Before, each one silently fell back to a different schedule.#666 (register tiles):
FLOWC_MLIR_REGISTER_TILESmust be exactly1(10no longer enables it). Nested lane products are overflow-checked, an overflowing vector-width token is rejected before type registration, and non-positive operand lane counts are refused before the nested result type is registered.Evidence
New regressions fail on the old code. With main's
resolve.flowand this branch's tests,incremental_cachegives 4 passed, 2 failed (long_cache_rootandout_of_range_root: emit fails, rc -1). Without the checksum commit,corrupt_payloadfails the same way. With the fixes: 7 passed.Local gates on this head (macOS arm64):
flowc: PASS; bootstrap regen fixed point at gen2;--verifyALL PASSGenerated state:
compiler/bootstrap/flowc_stage_a.cand the binary regenerated in the last commit.Risk
A malformed tiling env var that used to be ignored now fails the MLIR emit.
FLOWC_MLIR_REGISTER_TILESvalues other than1no longer enable register tiles. Cache behaviour only changes for over-long cache roots and corrupt records.