Keep Date parameter values when preparing solver downloads - #38
Open
ugin-man wants to merge 3 commits into
Open
Conversation
|
@ugin-man is attempting to deploy a commit to the tscircuit Team on Vercel. A member of the Team first needs to authorize it. |
This was referenced Sep 8, 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.
The parameter cleaner used by Download JSON, Download page.tsx and Download test.ts treats Date instances as ordinary records.
Object.entries(new Date(...))is empty, so{ start: new Date("2026-09-09T00:00:00Z") }becomes{ start: {} }before JSON serialization instead of retaining the normal ISO timestamp.Extract the existing pure cleaner into a small internal module and clone Date values before ordinary record traversal. Recursive underscore-key removal stays unchanged. Valid dates retain native ISO JSON output and invalid dates retain native JSON null behavior. This preserves timestamp values; it does not introduce a JSON Date reviver or promise instance-type round-tripping through generated source.
Seven tests cover root/nested/array dates, invalid dates, recursive internal-key removal, input immutability and primitive controls. The original DownloadDropdown.tsx source was verified against Git blob
e5d0a6a96c71abaccc43ef7820ddaad95e77bb2b. Local Node 22.16.0 execution of the verbatim extracted original cleaner produced 4 failures / 3 passes; the patched helper passes all 7. Only the helper export/test-runner/import-path adaptations were needed, with no behavior mocks.Upstream CI verification
At head
38b6c6bb540bd2f805089beace26bac11024950e, all three checks passed:Base:
a72b99f60680ffbe56a4c72e113ca52c9469921e. Download templates, React handlers and all non-Date cleanup behavior are otherwise unchanged. No browser-click or production-build validation is claimed. The separate constructor-argument template issue is reported in #39; it is not resolved by this change. Prepared with ChatGPT assistance and the account owner's authorization; no manual human review is claimed.