In order for model ordering to work as expected in tests, we need to
keep two properties:
- Fixtures are all created in the past
- Models sort in the order that they were created
This allows us to do things like this:
post cards_path, params: { ... }
created_card = Card.last
When using UUIDv7 PKs rather than sequential integers, we have to make
sure a couple of things happen in order for this still to be true:
- Fixtures should generate deterministic IDs that translate to UUIDs
that would have been created in the past (i.e. before today)
- Newly created objects must have enough precision in their timestamps
so that they sort in the order they were created, and their random
component doesn't come into play.
To solve this, we use the deterministic numeric ID as a number of
milliseconds after an early year. And we ensure that the new timestamps
we create have sub-millisecond precision.
There has been a bit of drift between actual schemas in production and
what's implied by the migrations.
And fixed some tests that were relying on everyone always watching.
ref: https://fizzy.37signals.com/5986089/cards/2322
The access involvement changes exposed that this test wasn't doing what it said it was. For this to be a self-assignment the event creator and assignee need to be the same
Previously when an item was `created`, we'd track the event, update the
summary text, and broadcast the notifications. But now that we have a
draft state, we shold do all of this when it's published instead.