Skip to content

Convert remaining registration policy bucket key dependencies to id - #11893

Merged
nbudin merged 1 commit into
mainfrom
11892-bucket-key-to-id
Aug 7, 2026
Merged

Convert remaining registration policy bucket key dependencies to id#11893
nbudin merged 1 commit into
mainfrom
11892-bucket-key-to-id

Conversation

@nbudin

@nbudin nbudin commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #11892

Summary

Follow-up to #11870/#11891, which handled bucket key/id correlation only for editing an existing registration policy. This converts the remaining internal identity uses of RegistrationPolicyBucket#key — in SignupBucketFinder, RegistrationPolicyBucket's occupancy checks, and EventChangeRegistrationPolicyService's simulation/removed-bucket logic — to use id for persisted buckets, or object identity for not-yet-persisted candidate buckets during registration policy simulation (a bucket being added in the same edit has no real id until the edit is persisted, so key is the only identity that predates the object entirely disappearing — object identity replaces it everywhere it's actually needed).

  • RegistrationPolicyBucket#occupies_bucket_as_signup?/#signup_definitely_occupies_slot_in_bucket?: single id-or-object-identity comparison, key-based fallback removed.
  • SignupBucketFinder/FakeSignup: track bucket objects (bucket/requested_bucket) instead of key strings.
  • EventChangeRegistrationPolicyService: bucket_key_mappings resolves to id (bucket_id_mappings) up front instead of round-tripping through a removed bucket's key at every use site; the simulation bridges a real signup's persisted bucket to its detached candidate counterpart via one clearly-commented key lookup (structurally required — see comments), instead of using key everywhere.
  • Removed RegistrationPolicy#bucket_with_key and the bucket_key/requested_bucket_key readers on Signup/SignupRequest/SignupRankedChoice, since SignupBucketFinder was meant to be their only caller. Turned out there were a handful of other legitimate callers (deprecated GraphQL bucketKey/requestedBucketKey mutation arguments, and import_convention_data_service.rb) — those got an inlined equivalent lookup rather than resurrecting the shared method.
  • sync_buckets_from_hash!'s key-based fallback (from Correlate registration policy buckets by id instead of key when editing/simulating policy changes #11870) is untouched, as planned — dropping the key column is tracked separately.

No GraphQL/frontend changes

update_event's bucket_key_mappings argument, BucketKeyMappingInputType, and the frontend bucket remapping UI are unchanged. The registration policy editor never has real bucket ids for candidate buckets (confirmed via RegistrationPolicy#as_json/RegistrationPolicyBucket#as_json, which deliberately omit id), so to_key must stay key-based — it can name a bucket being created in the very same edit.

Test plan

  • bin/rubocop clean on all changed files
  • Full affected model/service/graphql test suites pass (274 tests, 0 failures)
  • Reviewed diff manually for the trickier identity-comparison edge cases (detached candidate buckets, FakeSignup wiring, RegistrationPolicyBucketTest#signup_definitely_occupies_slot_in_bucket?)

🤖 Generated with Claude Code

…11892)

Converts SignupBucketFinder, RegistrationPolicyBucket's occupancy checks,
and EventChangeRegistrationPolicyService's simulation/removed-bucket logic
away from RegistrationPolicyBucket#key as an identity mechanism. Buckets
are now compared by id when persisted, or by object identity for
not-yet-persisted candidate buckets during registration policy simulation.
Removes RegistrationPolicy#bucket_with_key and the bucket_key/
requested_bucket_key readers on Signup/SignupRequest/SignupRankedChoice,
inlining the handful of legitimate remaining key-based lookups (deprecated
GraphQL arguments, import data, and the two structurally-necessary
candidate<->persisted bridges in EventChangeRegistrationPolicyService).

No GraphQL/frontend changes: the bucket_key_mappings mutation argument
must stay key-based on its "to" side, since it can name a bucket created
in the same edit that has no id yet.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nbudin nbudin added minor Bumps the minor version number on release refactor labels Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
app/graphql/mutations/create_my_signup.rb 🟢 95.65% 🟢 96% 🟢 0.35%
app/graphql/mutations/create_signup_ranked_choice.rb 🟠 68.42% 🟠 62.5% 🔴 -5.92%
app/graphql/mutations/create_signup_request.rb 🟠 62.5% 🟠 57.14% 🔴 -5.36%
app/graphql/mutations/create_user_signup.rb 🟠 55.56% 🟠 51.72% 🔴 -3.84%
app/models/registration_policy.rb 🟢 98.68% 🟢 98.65% 🔴 -0.03%
app/models/signup.rb 🟢 90.28% 🟢 89.71% 🔴 -0.57%
app/models/signup_request.rb 🟢 95.83% 🟢 95.45% 🔴 -0.38%
app/services/event_change_registration_policy_service.rb 🟢 91.96% 🟢 92.66% 🟢 0.7%
app/services/import_convention_data_service.rb 🟢 97.11% 🟢 97.13% 🟢 0.02%
app/services/signup_bucket_finder.rb 🟢 81.69% 🟢 81.43% 🔴 -0.26%
Overall Coverage 🟢 56.02% 🟢 56.03% 🟢 0.01%

Minimum allowed coverage is 0%, this run produced 56.03%

@nbudin
nbudin merged commit 2a0e6dd into main Aug 7, 2026
25 checks passed
@nbudin
nbudin deleted the 11892-bucket-key-to-id branch August 7, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Bumps the minor version number on release refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert remaining registration policy bucket key dependencies (SignupBucketFinder, EventChangeRegistrationPolicyService) to id

1 participant