Skip to content

Revive the first-run seeder behind a seed profile - #37

Merged
HeftyB merged 2 commits into
mainfrom
feature/seed-profile
Sep 21, 2026
Merged

HeftyB merged 2 commits into
mainfrom
feature/seed-profile

Conversation

@HeftyB

@HeftyB HeftyB commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Closes #19

Brings back the first-run seeder so a fresh database has an administrator to sign in with. The
application has no sign-up page by design — HR adds people to the system — so without this, a new
installation has no way in.

SeedData was commented out in October 2024, three weeks before the Date → LocalDate
migration, and no longer compiled. Uncommenting it produced 12 errors, all the same one.

Changes to the seeder

  • Gated with @Profile("seed"), so it runs only on request and never during tests or a normal
    start.
  • Six hire dates moved from java.util.Date to LocalDateTime, which is what Employee takes
    now.
  • Pay periods are generated relative to today — six two-week periods ending with the current
    one. They were fixed 2024 dates, so no period covered today and the seed failed part way through,
    on the first clock-in.
  • javafaker replaced with fixed sample values, so a seeded database looks the same every run
    and the dependency could go (removed in Remove dead weight and scaffold debris #36).
  • Seeds the first 12 of the 136 VINs. Each one is decoded through the live NHTSA API, so the
    full list made startup slow; SEEDED_VEHICLES raises it.
  • Seeded passwords lengthened to <username>-demo-pass. The accounts previously used their own
    usernames, below the eight-character minimum the Passay policy enforces. Nothing rejected them,
    because the seeder calls the service directly rather than through a validated form, but the seed
    should not contradict the application's own rule.

The Manufacturer and Model references in it were already commented out before the file was, so
they needed no attention; those lookup tables were folded into Vehicle as flat fields in
September 2024.

Verification

Run against in-memory H2, not just compiled:

  • the seed completes — roles, users, employees, 17 service menu items, pay periods, and a dozen
    customers with decoded vehicles;
  • signing in as hefty / hefty-demo-pass succeeds over HTTP;
  • /vehicles, /customers and /admin/ render the seeded records.

Repeated after rebasing onto main with #35 and #36 merged.

Usage

./mvnw spring-boot:run -Dspring-boot.run.profiles=seed

🤖 Generated with Claude Code

HeftyB and others added 2 commits September 20, 2026 23:11
The seeder was commented out in October 2024, three weeks before the
Date to LocalDate migration, so it no longer compiled. Restoring it
gives a fresh database its first admin user, which the application
has no sign-up page to create by design: HR adds people to the
system.

- Gate it with @Profile("seed"); it never runs in tests or in a
  normal start
- Six hire dates: java.util.Date to LocalDateTime
- Pay periods are now generated relative to today, six two-week
  periods ending with the current one. They were fixed 2024 dates, so
  no pay period covered today and the seed failed on clock-in
- Replace javafaker with fixed sample values, so the data is the same
  on every run and a dead dependency can go
- Seed the first 12 VINs rather than all 136; each one is decoded
  through the live NHTSA API

Verified against in-memory H2: the seed completes, the seeded admin
logs in, and the vehicle, customer and admin pages render the seeded
records.

[Ticket: #19]

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The seeded accounts used their own usernames as passwords, below the
eight-character minimum the Passay policy enforces. Nothing rejected
them, because the seeder calls the service directly rather than
going through a validated form, but the seed should not contradict
the application's own rule. Each account now uses
<username>-demo-pass.

[Ticket: #19]

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@HeftyB HeftyB added this to the Portfolio readiness milestone Sep 21, 2026
@HeftyB HeftyB added the enhancement New feature or request label Sep 21, 2026
@HeftyB HeftyB self-assigned this Sep 21, 2026
@HeftyB
HeftyB merged commit 7e7b5cf into main Sep 21, 2026
1 check passed
@HeftyB
HeftyB deleted the feature/seed-profile branch September 21, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revive first-run seed data behind a seed profile

1 participant