feat(crewing): Phase 4c — sign-off & experience (flagged) #72

Merged
shad0w merged 3 commits from feat/crewing-signoff into feat/crewing-admin 2026-06-22 18:52:57 +00:00
Owner

Crewing — Phase 4c (Sign-off & experience)

Final slice of Phase 4 (the Epic K piece deferred from Phase 2). Stacks on #71 (crewing-admin); base feat/crewing-admin. Behind NEXT_PUBLIC_CREWING_ENABLED. Completes Phase 4.

What's in

  • Schema: CrewActionType += CREW_SIGNED_OFF (migration crewing_signoff).
  • signOffCrew(assignmentId, date, remarks) (crewing/crew/actions.ts, sign_off_crew): one transaction — assignment → SIGNED_OFF (+ signOffDate); append an internal ExperienceRecord (rank, on/off dates, computed durationMonths); flip the same CrewMember EMPLOYEE → EX_HAND (type/source EX_HAND) so they return to the Candidates pool as a returning hand; CrewAction CREW_SIGNED_OFF; then auto-raise a SIGN_OFF backfill requisition via autoRaiseRequisition.
  • Screen: a Sign off button on the crew-profile header (/crewing/crew/[id], sign_off_crew holders — site staff / MPO / Manager); on success redirects to the Crew directory.

Tests & docs

  • Integration: signoff.test.ts (3) — SIGNED_OFF + experience + EX_HAND + SIGN_OFF backfill, already-signed-off guard, permission gating.
  • type-check clean; full unit (241) + integration (195) green.
  • CLAUDE.md updated; wiki §12 marks Phase 4 complete.

Single-entity model

Sign-off is the reverse of onboarding/placement on the same CrewMember row — only status (plus type/source) flips EMPLOYEE → EX_HAND, and all history (assignments, experience, docs) stays on the row, ready for cheap re-recruitment with an interview waiver.

This completes Phase 4 (E/F/G + K). Remaining roadmap: Phase 5 (verification + appraisal), Phase 6 (payroll, dashboards, notifications).

🤖 Generated with Claude Code


Closes Epic K — Sign-off & experience (#85).

## Crewing — Phase 4c (Sign-off & experience) Final slice of **Phase 4** (the Epic K piece deferred from Phase 2). Stacks on **#71** (crewing-admin); base `feat/crewing-admin`. Behind `NEXT_PUBLIC_CREWING_ENABLED`. **Completes Phase 4.** ### What's in - **Schema:** `CrewActionType += CREW_SIGNED_OFF` (migration `crewing_signoff`). - **`signOffCrew(assignmentId, date, remarks)`** (`crewing/crew/actions.ts`, `sign_off_crew`): one transaction — assignment → `SIGNED_OFF` (+ `signOffDate`); append an internal `ExperienceRecord` (rank, on/off dates, computed `durationMonths`); flip the **same `CrewMember`** `EMPLOYEE → EX_HAND` (type/source `EX_HAND`) so they return to the Candidates pool as a returning hand; `CrewAction CREW_SIGNED_OFF`; then auto-raise a `SIGN_OFF` backfill requisition via `autoRaiseRequisition`. - **Screen:** a **Sign off** button on the crew-profile header (`/crewing/crew/[id]`, `sign_off_crew` holders — site staff / MPO / Manager); on success redirects to the Crew directory. ### Tests & docs - Integration: `signoff.test.ts` (3) — `SIGNED_OFF` + experience + `EX_HAND` + `SIGN_OFF` backfill, already-signed-off guard, permission gating. - `type-check` clean; full unit (241) + integration (195) green. - `CLAUDE.md` updated; wiki §12 marks Phase 4 complete. ### Single-entity model Sign-off is the reverse of onboarding/placement on the **same `CrewMember` row** — only `status` (plus `type`/`source`) flips `EMPLOYEE → EX_HAND`, and all history (assignments, experience, docs) stays on the row, ready for cheap re-recruitment with an interview waiver. This completes **Phase 4 (E/F/G + K)**. Remaining roadmap: Phase 5 (verification + appraisal), Phase 6 (payroll, dashboards, notifications). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- Closes **Epic K — Sign-off & experience** (#85).
shad0w added 1 commit 2026-06-22 16:04:51 +00:00
feat(crewing): Phase 4c — sign-off & experience (flagged)
Some checks failed
PR checks / checks (pull_request) Successful in 40s
PR checks / integration (pull_request) Failing after 29s
4e71863c57
Final slice of Phase 4 (the Epic K piece deferred from Phase 2). Ends a tour of
duty and returns the crew member to the candidate pool as an ex-hand. Per
Crewing-Implementation-Spec §5.3. Behind NEXT_PUBLIC_CREWING_ENABLED.

What's in
- Schema: CrewActionType += CREW_SIGNED_OFF (migration crewing_signoff).
- signOffCrew(assignmentId, date, remarks) (crewing/crew/actions.ts, sign_off_crew):
  one transaction — assignment → SIGNED_OFF (+ signOffDate); append an internal
  ExperienceRecord (rank, on/off dates, computed durationMonths); flip the SAME
  CrewMember EMPLOYEE → EX_HAND (type/source EX_HAND), so they reappear in
  Candidates as a returning hand; CrewAction CREW_SIGNED_OFF; then auto-raise a
  SIGN_OFF backfill requisition via autoRaiseRequisition.
- Screen: a "Sign off" button on the crew-profile header (sign_off_crew holders —
  site staff / MPO / Manager); on success redirects to the Crew directory.

Tests & docs
- Integration: signoff.test.ts (3) — SIGNED_OFF + experience + EX_HAND + SIGN_OFF
  backfill, already-signed-off guard, permission gating. type-check clean; full
  unit (241) + integration (195) green.
- CLAUDE.md updated — completes Phase 4 (E/F/G + K).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shad0w added 1 commit 2026-06-22 16:11:39 +00:00
fix(notifier): don't construct Resend without an API key (CI crash)
All checks were successful
PR checks / checks (pull_request) Successful in 40s
PR checks / integration (pull_request) Successful in 29s
712e040fc2
lib/notifier.ts eagerly did `new Resend(process.env.RESEND_API_KEY)` whenever
NODE_ENV !== "development". Resend v4's constructor throws on a missing key, so
in any env without RESEND_API_KEY (CI, non-dev test runs) merely importing the
module crashed — surfaced by crew-records.test.ts once Phase 4c pulled
requisition-service → notifier into the crew actions' import graph.

Construct the client only when a key is present; otherwise fall back to console
logging (the send branches now gate on `!resend` instead of `isDev`). Verified by
running the full integration suite with RESEND_API_KEY unset (195 pass).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shad0w added 1 commit 2026-06-22 18:52:33 +00:00
Merge branch 'feat/crewing-admin' into feat/crewing-signoff
All checks were successful
PR checks / checks (pull_request) Successful in 39s
PR checks / integration (pull_request) Successful in 29s
1ccd777cb6
shad0w merged commit f18502235a into feat/crewing-admin 2026-06-22 18:52:57 +00:00
Sign in to join this conversation.
No description provided.