Commit Graph

6949 Commits

Author SHA1 Message Date
Stanko K.R. a9e052d8cb Explicitly use a shard for caching
See: https://github.com/rails/solid_cache/pull/219
2025-11-17 09:12:41 -05:00
Mike Dalessio e3d86bb21e Clean up some spots where "current account" is ambiguous
Primarily this is in tests (which were caught by temporarily
introducing acts_as_tenant and enabling safety checks), but notably
action cable connections were not working properly, and that's now
fixed.
2025-11-17 09:12:41 -05:00
Stanko K.R. 488c74d99e Always use the cache db for caching 2025-11-17 09:12:41 -05:00
Kevin McConnell fd3ad90f47 Remove outdated job reference 2025-11-17 09:12:41 -05:00
Kevin McConnell 9615753e1f Add routing header to see who served request 2025-11-17 09:12:41 -05:00
Kevin McConnell 11a38a4526 Initial (wip) staging deployment
This adds an initial configuration for staging. Note that we are doing
this ahead of having the full infrastructure in all 3 DCs. So this
this will result in some cross-DC writes for now (e.g. we have a single cache in
IAD). We'll correct this as the infrastructure becomes available.

We'll also run jobs on every app server, until we split them out to
separate instances.
2025-11-17 09:12:41 -05:00
Kevin McConnell 4b4593dd01 Avoid Docker Hub dependency 2025-11-17 09:12:41 -05:00
Mike Dalessio aca00d6218 Configure a reading: connection for solid gems
because I'm getting exceptions from Mission Control
2025-11-17 09:12:41 -05:00
Mike Dalessio 2c765fa03f rubocop: style fixes 2025-11-17 09:12:41 -05:00
Mike Dalessio 954d094d18 Fix the stacked notifications to respect time-sortable uuid 2025-11-17 09:12:41 -05:00
Stanko K.R. 0a3f91f220 Fix entropy imports 2025-11-17 09:12:41 -05:00
Stanko K.R. 01367c097f Fix skipped tests 2025-11-17 09:12:41 -05:00
Stanko K.R. 15eeba82f5 Scope model methods by account 2025-11-17 09:12:41 -05:00
Stanko K.R. a0251255a7 Rename IdenityMailer to UserMailer 2025-11-17 09:12:41 -05:00
Stanko K.R. e0693de7c3 Scope jobs and controllers by account 2025-11-17 09:12:41 -05:00
Kevin McConnell b4f3ee5d86 Include broadcast test helpers
We were relying on these without explicitly including them, leading to
flaky tests.
2025-11-17 09:12:41 -05:00
Donal McBreen 96598f4cd6 Update to latest Rails edge
This includes a fix to speed up parallel test database resets.
2025-11-17 09:12:41 -05:00
Donal McBreen 11acbda36d Fix search tests to work without memberships 2025-11-17 09:12:41 -05:00
Donal McBreen 067e889cb4 Make migrations reversible 2025-11-17 09:12:40 -05:00
Donal McBreen ea970b195a Drop Search::Results table 2025-11-17 09:12:40 -05:00
Donal McBreen 28efe28f24 Replace Search::Index with Search::Records
Lean on ActiveRecord models for searching and strip out the raw SQL.
Replaces the search_index_* tables with sharded search_records_* tables
as that allows us to use a Search::Record model name.

A Class is dynamically created for each record table shard so that we
and we can access it via the Search::Record.for_account(account_id)
method.
2025-11-17 09:12:40 -05:00
Mike Dalessio fe6df7085f Finish the rollout of account_id to all core data models
Schema:
- add account_id to tables it was missing from
- make account_id a required column everywhere
- add [account_id] indexes, or add `account_id` to existing indices

Models:
- add `belongs_to :account` to all models (default to using a domain
  model's account whenever possible)
- add account_id in all the necessary fixtures
- add account_id to insert_all hashes
- pass account_id to a few initialize calls

Miscellaneous:
- update the import script to set account_id

Note that I'm not adding account_id to the join tables primarily
because I couldn't think of an easy way to populate it without making
it a full Join model, and that was more work than I have time to take
on right now.
2025-11-17 09:12:40 -05:00
Mike Dalessio 5a7f08067a Move setting Current.account into the middleware
so that code called from the Rails controllers can use Current.account
2025-11-17 09:12:40 -05:00
Stanko K.R. 56c41d45eb Reinstate email changes 2025-11-17 09:12:40 -05:00
Mike Dalessio 4d8b3ed719 rubocop: style fixes 2025-11-17 09:12:40 -05:00
Mike Dalessio 7b1b5f464d Fix up seeds to work in a post-membership world. 2025-11-17 09:12:40 -05:00
Mike Dalessio 039e4a0bed Remove dead code (after deleting Membership) 2025-11-17 09:12:40 -05:00
Kevin McConnell 59dd8ca549 Make IDs more time-sortable in tests
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.
2025-11-17 09:12:40 -05:00
Stanko K.R. 4f4bf5bee1 Fix potential crash due to execution of default blocks 2025-11-17 09:12:40 -05:00
Stanko K.R. 34d83aaa7c Fix tests after the removal of memberships 2025-11-17 09:12:40 -05:00
Stanko K.R. 8fa9566c07 Update sign up 2025-11-17 09:12:40 -05:00
Stanko K.R. edf837fed3 Drop memberships 2025-11-17 09:12:39 -05:00
Stanko K.R. 5c6b91ef77 Fix incorrect var setting 2025-11-17 09:12:36 -05:00
Mike Dalessio 3f2eee38ba test: skip the test failing related to UUIDs and notif grouping 2025-11-17 09:12:36 -05:00
Mike Dalessio 6df681991f rubocop: fix style warnings 2025-11-17 09:12:36 -05:00
Mike Dalessio adaf6966c6 brakeman: drop two obsolete warnings, ignore new searchable sql 2025-11-17 09:12:36 -05:00
Mike Dalessio 7f2bd9a636 re-sync db/schema.rb 2025-11-17 09:12:36 -05:00
Donal McBreen 6323e0abee Use uuid as the id type in schema.rb
This matches the format in the migration files and makes the type_to_sql
override redundant.

The only wart we are left with is that since there are no true UUID
types in MySQL we'll have to assume that binary(16) columns are UUIDs.

In practice this is probably fine as the MySQL adapter doesn't map any
other types to binary.
2025-11-17 09:12:36 -05:00
Donal McBreen 0e3084f9d3 Fix up join code fixtures and tests 2025-11-17 09:12:36 -05:00
Donal McBreen ac82f20051 Memoize native_database_types and consolidate modules 2025-11-17 09:12:36 -05:00
Donal McBreen d81b7af7bb Switch to binary and add uuid as a native type for MySQL 2025-11-17 09:12:36 -05:00
Donal McBreen a8412449e3 Don't cast and extract normalization
We are not trying to handle user input so `cast` can be a no-op. Also
extract the base36 normalization logic, let the binary class handle the
serialize encoding and add some tests.
2025-11-17 09:12:36 -05:00
Donal McBreen 8ec5c1af5c Use Binary::Data for serialization
This handles quoting for us automatically
2025-11-17 09:12:36 -05:00
Donal McBreen 7fef6ca9b9 Use the card number in the results view 2025-11-17 09:12:36 -05:00
Donal McBreen 436d2b525b Set creator_id as a UUID 2025-11-17 09:12:36 -05:00
Donal McBreen b8baeadf66 Use a deterministic string hash 2025-11-17 09:12:36 -05:00
Donal McBreen 97444f2d32 Set up connects_to before id attribute 2025-11-17 09:12:35 -05:00
Donal McBreen 84d1fb6827 Import steps correctly 2025-11-17 09:12:35 -05:00
Donal McBreen f6ec9bbeea Use a custom class for Uuid values 2025-11-17 09:12:35 -05:00
Donal McBreen f4729577b6 Use uuids in the search_index tables too 2025-11-17 09:12:35 -05:00