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

Add tool to generate event UIDs and update README #67

Merged
merged 2 commits into from
Nov 23, 2024

Conversation

traviscross
Copy link
Contributor

@traviscross traviscross commented Nov 13, 2024

According to the iCalendar (IETF) RFC 5545, the UID for each event must be "globally unique". In this context, that means that the identifier must not collide with any other identifier for any other calendar event across all calendars, ever.

The way we were suggesting that people generate these, by calling out to date, unfortunately falls a bit short of being able to assure this.

Let's instead add a small tool to generate sufficiently-long randomly-generated identifiers to make it easy for people to do the right thing here for new events.

Merge this one after:

cc @davidtwco

@traviscross traviscross marked this pull request as draft November 13, 2024 02:04
@traviscross traviscross marked this pull request as ready for review November 13, 2024 05:54
@traviscross traviscross force-pushed the TC/add-uid-generator branch 2 times, most recently from 9d54d3d to 1449574 Compare November 13, 2024 06:14
@apiraino
Copy link
Contributor

Why not just suggest using uuidgen or any similar tool to generate UID (or UUID to be more precise)? We could spare dependencies and complexity to this tool :)

@traviscross
Copy link
Contributor Author

traviscross commented Nov 13, 2024

Well, that's the idea here, is to spare dependencies so we don't need to ask people to install anything else. This also means that we produce these UIDs in the consistent and exactly desired way.

This too isn't particularly complicated, and only depends on getrandom.

Most of the small number of lines of code here is just settings things up for the xtask pattern, and I can imagine other useful xtask helpers we might want. E.g., it'd be nice to have one that prompts the user for details and generates the TOML for an event.

@apiraino
Copy link
Contributor

I can't speak for many operating systems, but in Debian a UUID generator is marked as "required", in Fedora too (afaik). I think we can safely assume that it is installed by default everywhere? What's the dependency chain of xtask instead?

Anyway, just my .2 cents to avoid bloat.

@traviscross
Copy link
Contributor Author

traviscross commented Nov 13, 2024

What's the dependency chain of xtask instead?

Rust and the getrandom crate (handled automatically by cargo), that's it.

@davidtwco
Copy link
Member

Can you add a check/fmt/test for this utility in the CI?

@traviscross traviscross force-pushed the TC/add-uid-generator branch 2 times, most recently from 7638ef9 to 18f9f35 Compare November 22, 2024 05:19
According to the iCalendar (IETF) RFC 5545, the UID for each event
must be "globally unique".  In this context, that means that the
identifier must not collide with any other identifier for any other
calendar event across all calendars, ever.

The way we were suggesting that people generate these, by calling out
to `date`, unfortunately falls a bit short of being able to assure
this.

Let's instead add a small tool runnable with `cargo xtask` to generate
sufficiently-long randomly-generated identifiers to make it easy for
people to do the right thing here for new events.
Let's add tests to ensure that the code of our `cargo xtask` tool is
formatted correctly and to ensure that it builds and runs correctly.

We mirrored the details of the current CI configuration of
`calendar-generator`.
@traviscross traviscross merged commit 568990c into main Nov 23, 2024
5 checks passed
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.

3 participants