Skip to content

Add safe local development seed data#412

Merged
LoopyB merged 1 commit into
mainfrom
louisabest/feature/local-seed-data
Jul 14, 2026
Merged

Add safe local development seed data#412
LoopyB merged 1 commit into
mainfrom
louisabest/feature/local-seed-data

Conversation

@LoopyB

@LoopyB LoopyB commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a deterministic, local-only seed-data workflow for SecureShift development.

This gives backend, frontend and Guard App developers a populated local database without requiring everyone to manually create users, branches, shifts and related records.

Seeded data

  • 6 roles
  • 7 fictional users
  • 2 branches
  • 4 availability records
  • 5 shift scenarios
  • 1 attendance record
  • 1 payroll record
  • 2 messages
  • 3 notifications

The seed includes admin, employer and guard personas covering approved, pending and rejected/expired scenarios.

Commands

npm run seed
npm run seed:reset

Reset requires:

SEED_ALLOW_LOCAL=true
SEED_RESET_CONFIRM=SecureShiftLocalReset

Safety

The seed refuses to run unless all safety checks pass:

  • NODE_ENV is not production
  • MONGO_URI is explicitly set
  • only secureshift_local, secureshift_dev or secureshift_test are allowed
  • Atlas/SRV and remote hosts are rejected
  • reset removes only deterministic seeded records
  • missing MONGO_URI cannot fall back to Atlas

Payroll isolation

Seed payroll generation is scoped only to deterministic seeded shift IDs.

It does not absorb unrelated developer-created shifts, and reset preserves unrelated local records.

Validation

  • 19 safety tests passed
  • 1 payroll isolation test passed
  • focused ESLint passed
  • git diff --check passed
  • running the seed twice produced identical counts
  • reset removed all seeded records
  • unrelated shift and notification records were preserved

Notes

  • No Guard App or employer frontend files were changed
  • No OTP bypass was added
  • No attendance or emergency-controller behaviour was changed
  • Local test password: SecureShift1!

@LoopyB
LoopyB merged commit 6af60f4 into main Jul 14, 2026
1 check failed
@LoopyB
LoopyB deleted the louisabest/feature/local-seed-data branch July 14, 2026 01:23
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.

1 participant