Skip to content

Dive roles: custom roles and the diver's own role on a dive#561

Merged
ericgriffin merged 13 commits into
mainfrom
worktree-dive-roles
Jul 11, 2026
Merged

Dive roles: custom roles and the diver's own role on a dive#561
ericgriffin merged 13 commits into
mainfrom
worktree-dive-roles

Conversation

@ericgriffin

Copy link
Copy Markdown
Member

Closes #551
Closes #547

Summary

Adds a dive_roles reference table (schema v103) mirroring the dive-types pattern: nine seeded built-in roles (the six legacy roles plus Rear Guard, Support Diver, Safety Diver) and user-defined custom roles with UUID ids. The per-dive buddy role now resolves against this table instead of the fixed BuddyRole enum, and dives gain a nullable diver_role column recording the active diver's own role.

#551 - custom/extensible roles

  • Role picker sheets list built-ins plus the diver's custom roles, with an "Add custom role..." flow that saves for reuse
  • New Dive Roles management page under Settings > Manage Data (add, rename, delete; delete blocked while a role is referenced by any dive)
  • Built-in names are localized in all 11 locales (Dutch Rear Guard = "Hekkensluiter", per the issue)
  • Unknown role slugs now display as-is instead of silently coercing to "Buddy"

#547 - my own role

  • Pinned "Me" chip in the dive edit Buddies card with the same role vocabulary plus a "No role" option
  • Dive detail shows a "Me - " row above the buddy list when set
  • Consolidation merges adopt diverRoleId first-non-null (follows the Merging dives deletes GPS location data #542 scalar-adopt pattern)

Sync / backup

  • dive_roles is an HLC-synced entity: custom rows only (built-ins are seeded locally and re-asserted in beforeOpen), tombstoned deletions, adopt-wipe preserves built-ins
  • Custom roles ride in the UDDF full backup with ids preserved so dive_buddies.role / dives.diver_role references resolve after restore
  • UDDF interchange export buckets custom roles as plain buddies; leader roles unchanged

Migration

  • v103: create + seed dive_roles, add dives.diver_role; idempotent with beforeOpen backstop; existing dive_buddies.role strings match the built-in slugs so no data migration is needed

Testing

  • New: migration v103 (4), DiveRoleRepository (9), sync serializer contract (5), selector sheet (5), Me chip (5), management page (5), UDDF backup parse/build (2), merge-builder adopt, repository round-trip
  • Updated: buddy repository role resolution, picker widget tests, UDDF importer/exporter fixtures
  • Full sweep: database (141), sync (425), export (129), buddies (202), dive_log (1917), settings (608), import wizard (627) all pass; flutter analyze clean

Remaining manual verification

  • On-device smoke of the Me chip flow and custom-role creation
  • Two-device sync check for custom role replication

@ericgriffin ericgriffin self-assigned this Jul 11, 2026
@ericgriffin ericgriffin moved this from Backlog to In review in Submersion Release Tracker Jul 11, 2026
@ericgriffin ericgriffin merged commit 872c160 into main Jul 11, 2026
19 checks passed
@ericgriffin ericgriffin deleted the worktree-dive-roles branch July 11, 2026 05:19
@github-project-automation github-project-automation Bot moved this from In review to Done in Submersion Release Tracker Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Dive role should include some other defaults Dive role should be possible for me as well

1 participant