Skip to content

fix: nondeterministic generation, cache invalidation, and whitespace churn#41

Open
hazre wants to merge 6 commits into
thwbh:developfrom
SableClient:fix/nondeterministic-generation-cache
Open

fix: nondeterministic generation, cache invalidation, and whitespace churn#41
hazre wants to merge 6 commits into
thwbh:developfrom
SableClient:fix/nondeterministic-generation-cache

Conversation

@hazre
Copy link
Copy Markdown

@hazre hazre commented Apr 12, 2026

fixes #42 #43

Before this, identical inputs could still produce different generated output because parts of analysis, rendering, and cache hashing depended on unordered traversal and HashMap iteration. That could cause commands.ts, types.ts, events.ts, and index.ts to reorder entries or pick up extra blank lines across repeated runs. Events also were not part of the cache state, so events.ts could go stale.

This change sorts analyzer and generator inputs before rendering, makes command and config hashing use a stable order, includes events in cache invalidation, and cleans up TS/Zod template rendering so the generated files keep consistent spacing and do not add random blank lines.

Validated with cargo test and repeated downstream builds confirming the generated output stayed unchanged across runs.

@hazre hazre force-pushed the fix/nondeterministic-generation-cache branch from 7876f79 to a566357 Compare April 12, 2026 19:57
Copy link
Copy Markdown
Owner

@thwbh thwbh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the merge target to the develop branch.

@hazre hazre changed the base branch from main to develop April 14, 2026 10:22
@hazre
Copy link
Copy Markdown
Author

hazre commented Apr 14, 2026

Done. I also noticed that it was still updating the generated files and only updating the timestamp, I've updated it to take that into account + some test cleanup stuff to actually remove the left over files properly.

@hazre hazre requested a review from thwbh April 14, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generated bindings change across identical runs and event updates can be missed

2 participants