Bump plugin version so the us_invites schema migration actually runs #88

Merged
thatguygriff merged 1 commits from fix/invite-schema-migration into main 2026-07-22 14:41:20 +00:00
Owner

Closes #87

What happened

Regression from PR #83: creating a personal invite stored nothing (empty Pending Invites) while still displaying a registration link that could only dead-end as "invalid or expired."

Schema.php gained kind and expires_at on us_invites and InviteRepository::insert() started writing them — but USC_VERSION stayed at 1.0.0-rc.2. Plugin::boot() only re-runs Installer/dbDelta when the stored version differs, so upgraded sites never got the new columns and wpdb->insert failed silently on every invite.

Fix

  • Version bump to 1.0.0-rc.3 (header + USC_VERSION) — the next page load runs dbDelta and adds the columns. No manual action needed after deploying; the failed invites were never stored, so just re-create them.
  • Never show a dead link again: InviteRepository::insert() now returns 0 on failure (instead of a stale insert_id), and the Invites page shows an error notice instead of a link when the insert fails — for both the personal and group forms. Validation failures (bad email / existing account / pending invite / past expiry date) also get explicit error notices instead of silently doing nothing.
  • CLAUDE.md now calls out that any Schema.php change requires the version bump, so this class of bug doesn't recur.

Tests

  • New InviteRepositoryTest::testInsertReturnsZeroWhenDbInsertFails.
  • composer test — 410 tests pass; composer lint (PHPStan level 10) and composer cs clean.

🤖 Generated with Claude Code

Closes #87 ## What happened Regression from PR #83: creating a personal invite stored nothing (empty Pending Invites) while still displaying a registration link that could only dead-end as "invalid or expired." `Schema.php` gained `kind` and `expires_at` on `us_invites` and `InviteRepository::insert()` started writing them — but `USC_VERSION` stayed at `1.0.0-rc.2`. `Plugin::boot()` only re-runs `Installer`/`dbDelta` when the stored version differs, so upgraded sites never got the new columns and `wpdb->insert` failed silently on every invite. ## Fix - **Version bump** to `1.0.0-rc.3` (header + `USC_VERSION`) — the next page load runs `dbDelta` and adds the columns. No manual action needed after deploying; the failed invites were never stored, so just re-create them. - **Never show a dead link again:** `InviteRepository::insert()` now returns 0 on failure (instead of a stale `insert_id`), and the Invites page shows an error notice instead of a link when the insert fails — for both the personal and group forms. Validation failures (bad email / existing account / pending invite / past expiry date) also get explicit error notices instead of silently doing nothing. - `CLAUDE.md` now calls out that any `Schema.php` change requires the version bump, so this class of bug doesn't recur. ## Tests - New `InviteRepositoryTest::testInsertReturnsZeroWhenDbInsertFails`. - `composer test` — 410 tests pass; `composer lint` (PHPStan level 10) and `composer cs` clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
thatguygriff added 1 commit 2026-07-22 14:37:16 +00:00
Bump plugin version so the us_invites schema migration actually runs
CI / Tests (PHP 8.2) (pull_request) Successful in 37s
CI / Tests (PHP 8.1) (pull_request) Successful in 44s
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 2m55s
CI / PHPStan (pull_request) Successful in 2m54s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m36s
CI / Build Plugin Zip (pull_request) Skipped
0d9aafbb5b
PR #83 added kind and expires_at to us_invites and the repository started
writing them, but USC_VERSION stayed at 1.0.0-rc.2 — Plugin::boot() only
re-runs Installer/dbDelta on a version mismatch, so upgraded sites never got
the columns. Every invite insert then failed silently: nothing appeared under
Pending Invites while the admin was still shown a registration link whose
token hash was never stored.

- Version / USC_VERSION -> 1.0.0-rc.3 (triggers dbDelta on next load).
- InviteRepository::insert() returns 0 on failure instead of a stale
  insert_id, and the Invites page now shows an error notice instead of a
  dead link when creation fails (personal and group forms), including
  clearer validation messages.
- CLAUDE.md: schema changes must bump the version.

Closes #87

Co-Authored-By: Claude Fable 5 <[email protected]>
thatguygriff merged commit 9d8d93ea60 into main 2026-07-22 14:41:20 +00:00
thatguygriff deleted branch fix/invite-schema-migration 2026-07-22 14:41:20 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Unsupervised/unsupervised-scheduler#88