fix: deterministic TypeScript type generation for run-config.ts#194
Merged
branchseer merged 2 commits intomainfrom Mar 4, 2026
Merged
fix: deterministic TypeScript type generation for run-config.ts#194branchseer merged 2 commits intomainfrom
branchseer merged 2 commits intomainfrom
Conversation
The cache configuration refactor in #191 added UserGlobalCacheConfig but didn't regenerate run-config.ts, causing the typescript_generation test to fail in CI. https://claude.ai/code/session_014eMPQ1Mw6EQpPkjkk1onsQ
The ts_rs visit_dependencies traversal order is non-deterministic due to HashMap iteration order, causing run-config.ts to randomly reorder type declarations between regenerations. Sort the collected declarations before emitting them. https://claude.ai/code/session_014eMPQ1Mw6EQpPkjkk1onsQ
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
The
typescript_generationtest in CI was flaky due to non-deterministic ordering of type declarations inrun-config.ts.Root cause
ts_rs::visit_dependenciestraverses type dependencies using aHashMapinternally, so the visitation order of sibling types (e.g.UserGlobalCacheConfigvsTask) varies between runs. This causedgenerate_ts_definition()to emit declarations in a random order, making the test pass or fail depending on whether the output happened to match the checked-in file.Fix
HashMapiteration orderrun-config.tswith the now-stable orderingVerified stable across 20 consecutive regenerations.
https://claude.ai/code/session_014eMPQ1Mw6EQpPkjkk1onsQ