# RAMA AG — Claude Code Handover Report

Date: 26 November 2026, ~21:50 (Europe/Warsaw). Status: **HANDOVER VERIFIED — READ-ONLY. AWAITING APPROVAL.**

Scope: read-only verification of the active RAMA project, the Phase 02 staging tree, Git state, database identity, migration history, release artifacts, test evidence, isolation and deployment readiness. No application source, `.env`, database record, schema or grant was changed. No migration was run. Phase 02 was not deployed. SMGV work was not started. Quality Workforce was not accessed; port 3200 was only checked for "listening".

Side effects of the verification: the in-memory test suite (SQLite `:memory:`) was run on the active project and wrote 27 compiled Blade views into `storage/framework/views` (a gitignored cache). This report file is the only new file in the project.

No credentials or employee personal data appear in this report. Database figures are counts only.

---

## 1. Current project status

| Item | Verified state |
| --- | --- |
| Active project | `C:\Users\PANDAZZ\Desktop\RAMA-AG\rama-workforce-laravel`. Phase 01 baseline, 3 runtime roles (admin, foreman, worker) |
| Running server | `php -S 127.0.0.1:3400` from the **active** project's `.tools\php`, running since 2026-11-26 18:35 |
| Health | `GET /health` → 200 `{"status":"ok"}`; `GET /up` → 200 |
| Active database | `rama_workforce_laravel`: 16 migrations, 32 tables, 26 triggers, 1 active admin, no operational records |
| Phase 02 staging | `D:\- CLAUD PROJECTS\RAMA AG\phase02-staging`: 2-role code (admin, worker), implemented and tested, **not deployed** |
| Phase 02 migrations | Applied only in the test DB `rama_workforce_laravel_test`. **Not applied** to the application DB |
| Code drift since Phase 02 report | **None.** 449/449 active files match the staging-time baseline hash list; no active file changed after the report (21:41:57) |
| A browser session | Is currently signed in to the active app (Livewire polling seen in the serve log) |

The reported Phase 02 status ("implemented and tested in isolation, not deployed") is **confirmed** by present-state evidence.

## 2. Completed phases

| Phase | Status | Evidence |
| --- | --- | --- |
| Phase 01 — Clone / isolation | Completed | `RAMA_AG_PHASE_01_CLONE_REPORT.md` (tracked in Git); isolation checks below |
| Phase 01 — SMGV System Audit | Completed | `RAMA_AG_SMGV_PHASE_01_AUDIT_REPORT.md` (byte-identical in active and staging) |
| Phase 02 — Two-Role Architecture | Implemented and tested in staging | Staging tree, release artifacts, `.tools/phase02-*.json` |
| Phase 02B — Controlled Deployment | **Pending** (owner approval required) | Active DB has 16 migrations; active code has 3 roles |
| Phase 03+ (SMGV) | Not started | — |

## 3. Verified implementation findings

**Active project (Phase 01 baseline)**
- Stack: PHP 8.3, Laravel 13, Livewire 4, Blade, Tailwind 4, Vite 8, Leaflet, Dompdf, PhpSpreadsheet, MariaDB 10.11.19. Portable PHP in `.tools\php`.
- `app/Enums/Role.php`: Admin, Foreman, Worker. "foreman" appears 278 times in 41 files under `app/`, and 18 times in 7 migration files.
- Architecture: `app/Domain` (pure rules: attendance state machine, duration engine, calendar, order rules), `app/Services` (~30 services), `app/Livewire` (23 components), thin controllers. Server-side module/role matrix in `AppModule`.
- Isolation is enforced in code by `RamaIsolationServiceProvider`: it refuses to boot on any DB other than the dedicated RAMA schema/account on `127.0.0.1:3307`, forces the `array` mailer, blocks non-database notifications and stray HTTP requests.
- Known design decisions carried forward: forced password change is disabled (`EnsurePasswordIsChanged` is a pass-through; administrator-set passwords are permanent). CSP allows `'unsafe-eval'` for Alpine.

**Phase 02 staging (two-role release)**
- `app/Enums/Role.php`: Admin, Worker only. Remaining "foreman" references in `app/`: 5, all in `app/Support/WeeklySnapshot.php` (legacy snapshot key mapping foreman → preparedBy). Migrations: 25 references in 9 files (historical + transition migrations).
- Removed: `ForemanDashboard` Livewire component and views, `foremanDash` language files (de/sq), `worksites/permissions` view.
- Added: `EnsurePhaseTwoSchema` middleware, `NotificationDeliveryStatus`, `RequiredNotifications`, `Support/Actor`, `PhaseTwoMigration`, `WeeklySnapshot`, `twoRole` language files (de/sq), 2 views, 2 migrations, `PhaseTwoArchitectureTest`, `Upgrade/PhaseTwoMigrationTest`, `tests/upgrade.xml`, `Fixtures/integrity-triggers.json`, `ROLE_TRANSITIONS.md`.
- Safety gate: staging `bootstrap/app.php` prepends `EnsurePhaseTwoSchema` to the web group. If the staged code is served before the schema switch (no `weekly_team_reports.company_week`, no `notification_outbox`), every web request returns **503**. Deploying code without migrations therefore fails closed.
- `composer.json`, `composer.lock`, `package.json`, `package-lock.json` are identical in active and staging. No dependency change.

## 4. Active versus staged release

**Git**

| | Active | Staging |
| --- | --- | --- |
| Branch | `main` | `phase02` |
| Commits | 1: `675f1c3` "Initialize independent RAMA AG workforce platform with local isolation" (18:45) | 1: `33af30d` "Snapshot independent RAMA baseline for staged Phase 02" (21:00) |
| Remotes | none | none |
| Working tree | 2 untracked: the two SMGV reports. Nothing modified | 224 tracked changes (218 M, 6 D) + 26 untracked. Only 147 tracked files have real content changes; 77 are CRLF/stat-only |

The two repositories do **not** share history. Staging is a separate snapshot repo, and Phase 02 is uncommitted in it.

**File comparison (only-in-active / only-in-staged / differing, of which real content)**

| Area | Only active | Only staged | Differing | Real content |
| --- | ---: | ---: | ---: | ---: |
| app | 1 | 6 | 61 | 60 |
| routes | 0 | 0 | 1 | 1 |
| database | 0 | 2 | 2 | 1 |
| resources | 3 | 2 | 30 | 25 |
| lang | 2 | 2 | 78 | 22 |
| tests | 0 | 5 | 63 | 32 |
| config | 0 | 0 | 4 | 0 (CRLF only) |
| bootstrap | 0 | 0 | 2 | 1 |
| public | 2 | 2 | 1 | rebuilt Vite bundle |

Migrations present only in staging: `2026_11_26_100000_expand_two_role_workflows.php`, `2026_11_26_110000_switch_to_two_runtime_roles.php`. None present only in active.

**Environment files (keys only)**
- Staging `.env` uses `APP_ENV=testing` and points at `rama_workforce_laravel_test`. It is a test configuration, **not** a deployable application `.env`.
- Active `.env` has one extra key (`QW_RETURN_TRAVEL_ENABLED`). `APP_DEBUG=false` in all four env files. Active `APP_ENV=local`.

## 5. Database status

Read-only queries in a `READ ONLY` session.

| | Application DB | Test DB |
| --- | --- | --- |
| Schema / account | `rama_workforce_laravel` / `rama_local@127.0.0.1` | `rama_workforce_laravel_test` / `rama_test@127.0.0.1` |
| Server | MariaDB 10.11.19, 127.0.0.1:3307 | same |
| Grants | `USAGE ON *.*` + `ALL PRIVILEGES` on its own schema only | same, own schema only |
| Tables / views / triggers | 32 / 0 / 26 | 34 / 0 / 26 (same trigger names) |
| Migrations | 16, batch 1 (Phase 01 baseline) | 18, batch 1 (incl. both Phase 02 migrations) |
| Extra tables | — | `notification_outbox`, `phase02_migration_archives` |
| Users | 1 (admin, active) | 0 |

Application DB row counts: `audit_logs` 1, `company_settings` 1, `sessions` 1, `order_capability_grants` 4; every operational table is 0 (attendance sessions/events, schedules, daily/weekly reports, leave, material orders, worksites, worksite memberships, notifications, jobs, failed jobs). There is no `password_reset_tokens` table.

`order_capability_grants`: admin/accept_order, admin/cancel_order, foreman/accept_order, foreman/cancel_order (1 each). The two foreman grants are the ones Phase 02 removes.

Database state matches the Phase 02 report's preflight and final observation (16 migrations / 32 tables / 26 triggers / 1 active admin). Re-checked after the verification test run: unchanged.

## 6. Release verification

| Artifact | Size | SHA-256 | Check |
| --- | ---: | --- | --- |
| `RAMA_AG_PHASE_02_RELEASE.zip` | 1,061,749 B | `B159A9AD…CBFF` | Matches `RELEASE.sha256` ✔ |
| `RAMA_AG_PHASE_02_RELEASE_MANIFEST.json` | 52,335 B | `F24CE417…5A65` | No reference hash exists |
| `RAMA_AG_PHASE_02_REVIEW.patch` | 431,199 B | `39C404CB…2F19` | No reference hash exists |
| `RAMA_AG_PHASE_02_RELEASE.sha256` | 96 B | `C21F9BC7…10CA` | Contains only the zip hash |

- **Manifest:** a flat `{path → sha256}` map with 477 entries. All 477 hashes match the staging tree (0 mismatch, 0 missing). It contains 18 migrations (16 baseline + 2 Phase 02). It has **no metadata**: no base commit, version, timestamp or migration list.
- **Zip:** 478 entries = the 477 manifest paths + the manifest. Excludes `.env`, `.env.testing`, `vendor`, `node_modules`, `.tools`, `.git`. This is the complete release artifact.
- **Patch:** 147 files, +1022 / −1777, 6 deletions, 0 new files. It is `git diff` of tracked files only: it contains **no migrations and none of the 26 new files**. It is a review aid, **not** an installable release.
- Phase 02 report is byte-identical in active and staging.

## 7. Existing blockers

1. **Owner approval** of the 10 business defaults in section 3 of the Phase 02 report (weekly company report model, leave decisions, order authority, site attribution, weekly population, legacy report handling, etc.). Not yet given.
2. **No database backup exists.** No `*.sql`, `*.dump` or backup file was found under the RAMA folders. A verified backup and a restore rehearsal are required before the schema switch.
3. **Integrity of the non-zip artifacts** is not independently anchored: the `.sha256` file covers only the zip; the manifest has no base-commit field.
4. **Phase 02 is uncommitted** in the staging repo, and the staging repo does not share history with the active repo. There is no Git-level path from active to Phase 02 yet.
5. **Shared MariaDB PUBLIC grants** on `test` / `test_%` schemas (from Phase 01). Out of scope for RAMA; it needs a server administrator. Not changed.
6. **Not yet performed:** interactive browser/mobile smoke test, GPS device acceptance, multi-process stress test (as stated in the Phase 02 report).
7. **Active session open** against the running app. Any switch requires a maintenance window and signing users out.

## 8. Deployment readiness

**Verdict: technically prepared, procedurally NOT READY.**

Ready:
- Staging code matches its manifest exactly; the zip hash is verified.
- Active code and active DB are unchanged since staging began, so the Phase 02 preflight assumptions still hold.
- Both Phase 02 migrations have been exercised on the test DB (18 migrations, 26 triggers preserved).
- The fail-closed `EnsurePhaseTwoSchema` gate prevents a half-deployment from serving requests.
- Dependencies are unchanged, so no `composer`/`npm` install is needed.
- The active DB holds no operational data, so the data risk of the switch is currently minimal.

Not ready:
- No owner approval (blocker 1).
- No backup and no restore rehearsal (blocker 2).
- Staging `.env` is a test configuration; the active `.env` must be kept (plus any new key the release needs) at deployment.
- Phase 02 is not committed; the release should be committed and tagged before deployment so it can be rolled back by Git.

**Test evidence**

| Run | When | Tests | Passed | Skipped | Failed | Assertions |
| --- | --- | ---: | ---: | ---: | ---: | ---: |
| Staging main (MariaDB test DB) | 21:36 | 540 | 442 | 98 | 0 | 8662 |
| Staging memory (SQLite) | 21:36 | 97 | 96 | 1 | 0 | 741 |
| Staging upgrade | 21:38 | 2 | 2 | 0 | 0 | 27 |
| Staging acceptance | 21:30 | 19 | 19 | 0 | 0 | 110 |
| **Active memory, re-run during handover** | 21:50 | 97 | 96 | 1 | 0 | 738 |
| Active Phase 01 logs | Phase 01 | 520 | 422 | 98 | 0 | 8801 |

The reported totals (540 distinct cases, 0 failures, 9430 assertions across main + memory + upgrade) are consistent with the evidence files: 8662 + 741 + 27 = 9430. The MariaDB-backed suites were **not** re-run during this handover (read-only rule). The staging log contains 13 earlier ERROR entries (Vite manifest missing, `notification_outbox` missing) from intermediate runs at ~20:15, before the final green runs.

## 9. Isolation verification

- `rama_local` was denied `SELECT` on `quality_workforce_laravel.users` (SQLSTATE 42000 / 1142), as expected.
- The RAMA accounts hold privileges only on their own schema. The shared PUBLIC grant exception (blocker 5) still applies.
- Quality processes are untouched: port 3200 (php, pid 11360) and MariaDB (pid 61324) are the same PIDs recorded in the Phase 01 report.
- Neither RAMA repository has a remote. Nothing has been published online.

## 10. Recommended next actions

Phase 02B, in order, each step only after explicit approval:

1. **Owner review:** approve or amend the 10 business defaults in Phase 02 report section 3.
2. **Freeze the release:** commit Phase 02 in the staging repo and tag it. Add SHA-256 entries for the patch and the manifest, and a base-commit/version header to the manifest.
3. **Backup:** `mysqldump` of `rama_workforce_laravel` (schema + data + triggers) using the `rama_local` account. Restore it into a throwaway schema and compare table/trigger/row counts.
4. **Dry run:** apply the two migrations to a restored copy (not the live schema) and run the Phase 02 upgrade suite against it.
5. **Maintenance window:** stop the `:3400` server, apply the code from the verified zip while keeping the active `.env`, run the two migrations, clear and rebuild caches, start the server, run smoke checks (`/health`, login, each role's main screens in SQ and DE).
6. **Post-deployment verification:** 18 migrations, 26 triggers, role values limited to admin/worker, foreman order grants removed, full test suites green.
7. **Rollback plan:** restore the backup and the Phase 01 commit `675f1c3` if any check fails.

Afterwards, Phase 03 (SMGV PDF reverse engineering of `smgv-zeitkontrolle-alle-2026.pdf`) can begin after approval. The UI direction "Black Titanium — Apple × Linear Enterprise Design" applies only to future authorized UI phases.

Recommended hygiene (low priority, not part of Phase 02B): commit or ignore the two untracked SMGV reports in the active repo; remove the 4 leftover Livewire test files and the `.phpunit.result.cache` from staging; consider re-enabling forced password change after an administrator sets a password.

---

**STOP.** The handover is complete. No further work will start until you give explicit approval, for example "Approved: start Phase 02B".
