# RAMA AG — Final Rebuild Report

## rama-v1.0.0-rc3 — real employee onboarding + historical SMGV import (27.11.2026)

Status: **LIVE — `rama-v1.0.0-rc3` (`9ccca13`) on `http://localhost:3400`.** Authorised by the owner's "REAL EMPLOYEE ONBOARDING & SMGV HISTORICAL DATA IMPORT" message.

| # | Step | Result |
| --- | --- | --- |
| 1 | Development | Branch `feature/smgv-onboarding` in the dev worktree; forward-only migration `2026_11_27_130000` |
| 2 | Tests (sequential) | main **581** (483 passed, 98 skipped by design), memory **97** (96 + 1 skipped), upgrade **2**, node **6**: **0 failures**. `node --check` OK; production Vite build OK |
| 3 | Rehearsal | A live copy was restored into `rama_workforce_laravel_test`: 49/49 tables, 32/32 triggers. Migration + import + engine check passed; re-run refused; browser QA passed on `:3401`. The test DB was wiped afterwards |
| 4 | Database identity | `rama_workforce_laravel` (verified by the command, `--expect-db`) |
| 5 | Backup | `D:\- CLAUD PROJECTS\RAMA AG\backups\onboarding-predeploy-20261127-084151` (owner + SYSTEM only): live dump (sha256 `e1364b53…e129a`), `verification.json`, changed files, previous `public/build`, git bundle, `GIT_HEAD`. SHA256SUMS 58/58 OK; **restore-verified** (49/49 tables, 0 checksum mismatches, 32/32 triggers) |
| 6 | Maintenance window | About 1–2 minutes (≈08:42–08:43). Sequence: `artisan down`; `main` fast-forwarded `645a2a1 → 9ccca13`; build mirrored (hash-identical); `optimize:clear`; `migrate --force` (batch 5, ≈0.5 s; 20 migrations, 32 triggers, 50 tables); import committed (10 accounts, 6,427 values, 194 absences, 10 contracts, 10 Pensum periods, 6 opening balances, 9 holidays, 0 conflicts); `optimize`; only `:3400` restarted (PID 64048 → 48392); `artisan up`; tag `rama-v1.0.0-rc3` |
| 7 | Live verification | `/health` 200 ok; `/up` 200; `/login` 200 with the username label and new assets. Guests get 302 → /login on `/dashboard`, `/smgv*`, `/audit`, `/workers` and `/change-password`. CSRF 419. A former employee's sign-in is refused |
| 8 | Data integrity | Administrator unchanged (fingerprint identical). 11 users (1 admin + 10 workers, all deactivated, all `must_change_password`, all bcrypt). 0 attendance sessions/events/locations, 0 orders, 0 daily reports created. No temporary password in the audit log. Source PDF in private storage. Engine vs PDF equal for every employee-month except 3 × 0.01 h (minute resolution) |
| 9 | Not touched | Quality Workforce (folder, DB, MariaDB binaries); `.env` (the pending `RAMA_LOGO` change is still not applied); no reset or truncate of the live DB |

**Rollback** (if ever needed):
1. `artisan down`.
2. Restore the DB dump from the backup above into an emptied schema (the dump is CREATE-only); the restore script is documented in the rehearsal.
3. `git checkout rama-v1.0.0-rc2`.
4. Restore `public/build` from the backup.
5. `artisan optimize:clear` and `artisan optimize`.
6. Restart `:3400`, then `artisan up`.

Reports: `RAMA_AG_EMPLOYEE_ONBOARDING_REPORT.md`, `RAMA_AG_SMGV_HISTORICAL_IMPORT_REPORT.md`, `RAMA_AG_SMGV_RECONCILIATION_REPORT.md`.

---

## Previous release: rama-v1.0.0-rc1

Date: 27 November 2026, Europe/Zurich time.
Status: **ACTIVATED — `rama-v1.0.0-rc1` is live on `http://localhost:3400`.**
The owner confirmed the maintenance window. RAMA was offline from 05:33:31 to 05:34:22 (≈ 51 s).

**Why rc1 and not 1.0.0:** the SMGV accounting runs in a deliberately restricted draft/review mode. The GAV rules are not yet confirmed by the owner, so every SMGV figure is labelled "Entwurf" and PDFs carry a watermark. No legal or SMGV compliance is claimed.

## Sequence (all steps verified)

| # | Step | Result |
| --- | --- | --- |
| 1 | Implementation status | All phases done; GAV rules open (see tracker) |
| 2 | Critical defects | None open. Fixed before release: PDF overflow, merger object-ID collision, WinAnsi decoding, sequential PDF object scan |
| 3 | Database identity | `rama_workforce_laravel` / `rama_local@127.0.0.1` / 3307 |
| 4 | Pre-release backup | `D:\- CLAUD PROJECTS\RAMA AG\backups\v1-predeploy-20261127-053100\` (owner + SYSTEM only). Contents: database (schema + data + 26 triggers), git bundle, full source zip, `.env` and APP_KEY (protected, never printed), storage, startup configuration. SHA256SUMS re-verified, 0 mismatches |
| 5 | Recovery capability | Backup restored into the test DB: 34/34 tables, 34/34 checksums, 26/26 triggers, migrations and users identical. Then wiped. Earlier rehearsal of the SMGV migration on a live copy: PASS (`backups\v1-rehearsal-20261127-030216`) |
| 6 | Source freeze | Branch `develop/v1`, code commit `4e7a50a` |
| 7 | Dependency lockfiles | `composer.lock` and `package-lock.json` unchanged since the baseline |
| 8 | Environment variables | Live `.env` kept unchanged (APP_KEY, DB account, session and cache namespaces, port, `APP_ENV=local`, debug off) |
| 9 | Frontend assets | Production Vite build; 20 files installed into `public/build`, byte-identical to the tested build. The old v0.2.0 assets are kept in the backup |
| 10 | Blade templates | `view:cache` OK |
| 11 | PHP syntax | All changed and new PHP files linted |
| 12 | Final automated tests | Run on the identical code in the isolated worktree: 0 failures (see the QA report) |
| 13 | Migrations | 1 new forward migration, `2026_11_27_100000_create_smgv_accounting_tables` |
| 14 | Controlled migration | Preflight PASS; only RAMA's :3400 processes stopped; final dump taken (`db-final/`, sha256 `b24dcdd9…c3b8`); migration ran in batch 4, ~2 s, exit 0 |
| 15–19 | Caches | `optimize:clear` then `optimize`: config, events, routes, views cached. Composer autoload optimisation was **not** run, to keep `vendor/` byte-identical to the tested state |
| 20 | Activation | Active `main` fast-forwarded `9f9e831` → `4e7a50a`; history preserved |
| 21 | Restart | Only RAMA restarted: `artisan serve --host=127.0.0.1 --port=3400` (new PID); logs in `.tools\rama-serve-v1*.log` |
| 22 | localhost:3400 | `/health` 200 `{"status":"ok"}`, `/up` 200, `/login` 200 with the new Black Titanium assets |
| 23 | Administrator access | Account preserved (database check). An interactive login needs the owner's own credentials and is **still to be done by the owner** |
| 24 | Employee access | Verified on the isolated `:3401` copy with synthetic accounts: employees get 403 on every SMGV and audit page. No synthetic employee exists in the live database |
| 25 | Black Titanium | Verified on `:3401` at five viewports (QA report) |
| 26 | SMGV PDF export | Verified by tests (14 pages per employee, orientations, watermark) and visual renders |
| 27 | Application health | All protected routes, including every SMGV page and download, return 302 to the login page for guests. CSRF: POST without a token returns 419. `artisan about`: env local, debug OFF, mail `array` |
| 28 | Database integrity | 19 migrations; 49 tables (34 + 15 SMGV); the 34 existing tables are unchanged by rows and CHECKSUM; persisted roles are `admin` and `worker` only; 0 foreman grants; 1 active Administrator; SMGV reference data loaded (15 codes, rule set `2026.1-draft` unverified); no business records created |
| 29 | Triggers | All 26 original trigger definitions are byte-identical, plus 6 SMGV immutability guards (32 in total) |
| 30 | Quality | Not accessed, queried or restarted; port :3200 only observed; Quality's MariaDB binaries never used |

**Git:** annotated local tag `rama-v1.0.0-rc1` (object `d6811999`) → `4e7a50a`. `rama-v0.2.0` is kept. Nothing was pushed.

## Recovery

1. Stop :3400.
2. Restore the code with `git checkout rama-v0.2.0` (or `9f9e831`) and the `public/build` folder from `backups\v1-predeploy-…\predeploy-moved\public-build-v0.2.0`. Run `artisan optimize:clear`.
3. Database: the SMGV migration's `down()` deliberately refuses. Restore `db-final/rama_workforce_laravel.sql` into an empty schema, after owner approval, using the same procedure as the rehearsal. Then verify against `db-final/verification.json`.
4. Do not restore over new real SMGV records without explicit owner approval.

## Operational notes

- Configuration is now cached. Any future `.env` change requires `artisan optimize` (or `config:cache`).
- The server still runs as a user process with no auto-start after a reboot, unchanged from before.
- No queue worker is running. Exports are generated synchronously.
