Skip to content

fix: deterministic TypeScript type generation for run-config.ts#194

Merged
branchseer merged 2 commits intomainfrom
claude/fix-ci-failure-3FH47
Mar 4, 2026
Merged

fix: deterministic TypeScript type generation for run-config.ts#194
branchseer merged 2 commits intomainfrom
claude/fix-ci-failure-3FH47

Conversation

@branchseer
Copy link
Copy Markdown
Member

@branchseer branchseer commented Mar 4, 2026

Summary

The typescript_generation test in CI was flaky due to non-deterministic ordering of type declarations in run-config.ts.

Root cause

ts_rs::visit_dependencies traverses type dependencies using a HashMap internally, so the visitation order of sibling types (e.g. UserGlobalCacheConfig vs Task) varies between runs. This caused generate_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

  • Sort the collected type declarations alphabetically before emitting them, ensuring deterministic output regardless of HashMap iteration order
  • Regenerate run-config.ts with the now-stable ordering

Verified stable across 20 consecutive regenerations.

https://claude.ai/code/session_014eMPQ1Mw6EQpPkjkk1onsQ

claude added 2 commits March 4, 2026 15:29
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
@branchseer branchseer changed the title Reorder type definitions in run-config.ts fix: deterministic TypeScript type generation for run-config.ts Mar 4, 2026
@branchseer branchseer merged commit 077d3af into main Mar 4, 2026
6 checks passed
@branchseer branchseer deleted the claude/fix-ci-failure-3FH47 branch March 4, 2026 15:47
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.

2 participants