refactor(models): consume dunite-user-core for the account vocabulary (DEV-517) #451

Merged
longjacksonle merged 1 commit from feat/DEV-517-consume-user-core into main 2026-08-04 02:22:52 +02:00

Consumer side of DEV-517 (epic DEV-495). dunite PR #31 adds dunite-user-core, the account vocabulary a8n-tools and bunyip had grown independently in identical form.

What changed

  • models/user.rs: UserRole, MembershipStatus and SubscriptionTier (including select / trial_days / trial_label / display_name) are re-exported from the crate instead of defined here. crate::models::user::* paths are unchanged for every caller.
  • models/tier.rs: TierConfigResponse re-exported.
  • 376 lines deleted, 27 added.

What stays

The User row struct, is_access_allowed, normalize_email and TierConfigRow. The row carries last_login_country, login_location_alerts, first_name, last_name, phone, has_used_trial, avatar_updated_at and is_super_admin, none of which exist in a8n's schema, so sharing it needs a schema reconciliation first. TierConfigRow additionally derives sqlx::FromRow, and a8n is on sqlx 0.7 against bunyip's 0.8, so a shared derive would not satisfy both.

The 12 tests that only exercised the moved enums are deleted rather than duplicated (they now live in the crate, with the fallback-direction assertions tightened). Everything touching the User row stays: the access predicate, tier assignment, trial eligibility.

Testing

cargo clippy --workspace --all-targets -- -D warnings clean, cargo fmt --all --check clean, cargo test --workspace --lib 414 passed / 0 failed (282 + 108 + 15 + 9; down 12 by exactly the moved tests).

Depends on dunite #31. Re-pin to the merged rev once it lands.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CGnY8JKXCgH2jiUSqH6g4x

Consumer side of DEV-517 (epic DEV-495). dunite PR #31 adds `dunite-user-core`, the account vocabulary a8n-tools and bunyip had grown independently in identical form. ## What changed - `models/user.rs`: `UserRole`, `MembershipStatus` and `SubscriptionTier` (including `select` / `trial_days` / `trial_label` / `display_name`) are re-exported from the crate instead of defined here. `crate::models::user::*` paths are unchanged for every caller. - `models/tier.rs`: `TierConfigResponse` re-exported. - 376 lines deleted, 27 added. ## What stays The `User` row struct, `is_access_allowed`, `normalize_email` and `TierConfigRow`. The row carries `last_login_country`, `login_location_alerts`, `first_name`, `last_name`, `phone`, `has_used_trial`, `avatar_updated_at` and `is_super_admin`, none of which exist in a8n's schema, so sharing it needs a schema reconciliation first. `TierConfigRow` additionally derives `sqlx::FromRow`, and a8n is on sqlx 0.7 against bunyip's 0.8, so a shared derive would not satisfy both. The 12 tests that only exercised the moved enums are deleted rather than duplicated (they now live in the crate, with the fallback-direction assertions tightened). Everything touching the `User` row stays: the access predicate, tier assignment, trial eligibility. ## Testing `cargo clippy --workspace --all-targets -- -D warnings` clean, `cargo fmt --all --check` clean, `cargo test --workspace --lib` 414 passed / 0 failed (282 + 108 + 15 + 9; down 12 by exactly the moved tests). Depends on dunite #31. Re-pin to the merged rev once it lands. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01CGnY8JKXCgH2jiUSqH6g4x
refactor(models): consume dunite-user-core for the account vocabulary (DEV-517)
All checks were successful
E2E PR gate / Install + reachability (no deployment secrets) (pull_request) Successful in 24s
Check / fmt + clippy + build + tests (pull_request) Successful in 13m31s
Create release / Create release from merged PR (pull_request) Has been skipped
c6ad1c1074
`UserRole`, `MembershipStatus`, `SubscriptionTier` (with the `select` / `trial_days` / `trial_label` decisions) and `TierConfigResponse` were byte-identical to a8n's copies, so they move to the shared `dunite-user-core` crate and are re-exported from `models::user` / `models::tier`. Every `crate::models::user::*` path is unchanged.

The `User` row struct, `is_access_allowed`, `normalize_email` and `TierConfigRow` stay here: the row carries columns a8n has no equivalent for (login location, avatar, profile names, super-admin, trial usage), and `TierConfigRow` derives `sqlx::FromRow`, which cannot be shared while a8n is on sqlx 0.7 and bunyip on 0.8.

The 12 tests that only exercised the moved enums are deleted rather than duplicated; they now live in the crate. The tests that involve the `User` row (access predicate, tier assignment through the repository, trial eligibility) stay.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CGnY8JKXCgH2jiUSqH6g4x
longjacksonle deleted branch feat/DEV-517-consume-user-core 2026-08-04 02:22:52 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/bunyip!451
No description provided.