Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: refactor v7 internal state and options logic, fixes #764 #776

Closed
wants to merge 2 commits into from

Conversation

broofa
Copy link
Member

@broofa broofa commented Jul 16, 2024

Putting this PR up as an alternative to #768 that addresses #764 and a few other concerns.

  • Written in Typescript (required now that feat!: Port to TypeScript, closes #762 #763 has landed)
  • Decouple behavior of v7()-with-options from v7()-without-options.
  • Encapsulate internal state handling and refactor to be more idiomatic
  • Rigorous unit tests for internal state transitions
  • Use 32-bit seq field rather than 31.

@robinpokorny My apologies for closing #768. I wanted to merge it, but the switch to typescript and these other issues just made it easier to address in a new PR. I'll do my best to credit your work here.

... and if you could help review this, I'd appreciate it. I feel pretty good about this refactor but there's enough code churn that an extra set of eyes would be very helpful.

Where #764 is concerned, the heart of this PR is in this code, where the behavior very deliberately branches based on whether options are present.

Note

  • 'Marking this as a breaking change because of the changes to default values for options#seq and options#msecs.
  • The v1() code would probably benefit from a similar refactoring, if for nothing else than to make the APIs consistent. I'll put up a PR for that shortly.

@broofa broofa changed the base branch from main to ts_port July 16, 2024 14:00
@broofa broofa force-pushed the ts_fix_768 branch 3 times, most recently from ff53a3c to 77bacf3 Compare July 16, 2024 17:30
@broofa broofa changed the title fix: msecs option in v7 (TS port) fix!: msecs option in v7 (TS port) Jul 16, 2024
@broofa broofa marked this pull request as ready for review July 16, 2024 17:48
@broofa broofa mentioned this pull request Jul 16, 2024
Co-authored-by: Robert Kieffer <[email protected]>
Co-authored-by: Robin Pokorny <[email protected]>
@broofa broofa changed the title fix!: msecs option in v7 (TS port) fix!: refactor v7 state and options logic, fixes #764 Jul 16, 2024
@broofa broofa linked an issue Jul 16, 2024 that may be closed by this pull request
2 tasks
@broofa broofa changed the title fix!: refactor v7 state and options logic, fixes #764 fix!: refactor v7 internal state and options logic, fixes #764 Jul 16, 2024
@broofa broofa deleted the branch ts_port July 17, 2024 13:14
@broofa broofa closed this Jul 17, 2024
@broofa
Copy link
Member Author

broofa commented Jul 17, 2024

I have no idea why this got closed. The ts_port branch has already been merged, which should've caused the base for this PR to change to main. But I guess not? So deleting ts_port closed this PR?

One of those "I guess I don't understand git/github after all moments". 'Will reopen in a new PR. 😕

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.

v7: passing options.msecs results in zero-value timestamp
1 participant