Repository navigation
Conversation
borderss
marked this pull request as draft
November 29, 2026 04:35
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.
Draft: #357, #359 and #360 fix the same three issues and were opened before this, with equivalent code. Unless the owner prefers this one, merge those and close this. What this has that they don't: the zero-key line and the gofmt fix in
skills/ant/SKILL.md, and the list of ant-docs pages at the end.Covers #353, #354 and #355. All three turned up while writing the adoption guides for ant-docs. Each issue has a
reprocommit with a failing test, then afixcommit.#353: ids keys increase within a millisecond
ids.UUIDv7,ids.UUIDandids.ULIDheld a millisecond timestamp and then random bits, so keys made in the same millisecond came out in random order. A million keys made in a loop gave a 39 MB primary key index at 69% leaf density on PostgreSQL 17, against 38 MB and 72% for random v4 keys and 30 MB and 90% for google/uuid'sNewV7.The 12 bits after the timestamp now hold the fraction of the millisecond (RFC 9562 section 6.2, method 3), and a mutex keeps the last value so each key sorts after the one before it, as
uuid.NewV7does.ULIDputs the same 12 bits at the start of its random part. Both stay valid formats, with 12 fewer random bits (62 in a version 7 UUID, 68 in a ULID). The same million keys now make a 30 MB index at 90%. Decision 178 records it and amends 168.Tests: 100,000 keys of each kind in a loop come out strictly increasing; eight goroutines making 20,000 keys each get unique keys, each goroutine's in order; a ULID's first ten characters decode to the current millisecond. They also pass with
-race -shuffle=on, run in agolang:1.27container.#354: the zero-key error suggests a generator for the key's type
The message said "nothing generates it" twice and suggested
uuid.Newfor every key type. Now it says it once, and suggestsids.UUIDv7[T]for a 16-byte key,ids.UUIDfor astring, and "fn, where fn returns a new T" for anything else:Decision 179 records it and amends 150. The skill's keys paragraph now leads with
ids.UUIDv7[uuid.UUID]as well. That made me run the skill's doccheck, which failed on one Raw sample whose trailing comments were not gofmt-aligned, and that already failed on main, so this PR aligns that sample too.#355: drift names what it compared the database with
Before the first migration,
driftcompares the database with the models, but its error still saiddatabase differs from the migrations.ErrDrift's text is nowant: database differs, and the wrap adds the source:ant: database differs from the models: 3 differences, orfrom the snapshot.errors.Is(err, migrate.ErrDrift)still matches. A program that compares the error's text with the old string no longer does.Checks
make fmt,make lint,make testandmake test-pg(PostgreSQL 17) pass. MySQL, MariaDB, SQLite and SQL Server were not run: the key and message code is the same on every database, anddriftis PostgreSQL only. After that run only decision 178's text changed, andtests/docspassed again. No exported API changed, sodocs/api.txtis untouched.ant-docs pages to update once this ships
ErrZeroKeymessage.Error: ant: database differs from the migrationsline.ids.UUIDv7.