Skip to content

Fix stale rollout form checks and clarify enrolled users - #45

Merged
michal-granec merged 1 commit into
masterfrom
fix/rollout-form-conflicts
Oct 15, 2026
Merged

michal-granec merged 1 commit into
masterfrom
fix/rollout-form-conflicts

Conversation

@michal-granec

Copy link
Copy Markdown
Contributor

Summary

  • Give rendered feature forms a SHA-256 fingerprint of the editable state instead of relying only on seconds-resolution timestamps. Normalize group/user ordering and ignore unrelated metadata.
  • Validate the fingerprint inside with_feature, before any modifications, rather than checking a separate potentially stale get. Abort conflicts without saving feature state or history; retain timestamp validation for legacy forms.
  • Explain that a conflicting update was not saved and redirect to the latest feature for review.
  • Show the explicit-enrollment count, keep it current while adding/removing nickname selections, and clarify that group/percentage-enabled members are not included.
  • Preserve unresolved account IDs and explain the existing count-only behavior above 150 enrollments. Updating other settings must not replace those enrollments.
  • Send Cache-Control: no-store on feature responses and document concurrency guarantees and admin cache configuration.

Why

A seconds-resolution updated_at misses distinct edits in the same second and changes made outside the UI. Checking before the mutation also leaves a race and can compare against cached state rather than the state being edited. Stale full-form submissions must not silently replace newer enrollments.

This is the rollout-ui portion of the fix. Applications must separately supply uncached admin reads; no-store does not bypass a server-side adapter cache. The companion fetlife-web change keeps normal runtime checks cached while making admin reads authoritative.

Compatibility and limits

  • Older forms retain the existing last_updated_at fallback, now checked inside the mutation. Legacy timestamps still cannot distinguish same-second edits.
  • Atomic validation depends on the adapter. ActiveRecord locks existing feature rows during mutation; the Redis adapter does not provide equivalent locking/compare-and-set semantics.
  • No schema, adapter, or dependency changes. No automatic conflict retries, large-list pagination, or picker redesign.

Verification

  • bundle exec rspec: 95 examples, 0 failures (29 added examples).
  • Randomized suite, seed 54321: 95 examples, 0 failures.
  • node --check lib/rollout/ui/public/js/user-selector.js and git diff --check: passed.
  • Local Playwright smoke test: 17 checks passed, including consecutive nickname additions/saves, live counts, preserved unknown IDs, removal of another account, stale-form rejection without enrollment loss, JavaScript-disabled editing, and count-only large cohorts.

The suite covers same-second edits, external changes to every editable field, validation against mutation state, legacy compatibility, malformed fingerprints, mounted redirects, logging-disabled behavior, and unchanged state/history on rejection.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@michal-granec
michal-granec merged commit 0d95963 into master Oct 15, 2026
1 check 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.

2 participants