# RAMA AG — Phase 02 Implementation Report

Date: 26 November 2026. Status: **IMPLEMENTED AND TESTED IN ISOLATION — NOT DEPLOYED**.

## 1. Executive summary

The two-role release is prepared at `D:\- CLAUD PROJECTS\RAMA AG\phase02-staging`. Runtime roles are exactly `admin` and `worker`. Administration now owns leave decisions, material decisions, worksite management and the company weekly report. Employee ownership, private drafts, submitted-report finality and factual attendance are preserved.

The active project remains `C:\Users\PANDAZZ\Desktop\RAMA-AG\rama-workforce-laravel`, serving `http://localhost:3400`. Its application database has **not** received either Phase 02 migration. Do not copy this code over the running release before the controlled schema switch. A schema-readiness middleware returns 503 if the staged release is served before expansion.

The complete Phase 01 audit, including Appendices A–D, was read before implementation. This report is the Phase 02 stopping point. No SMGV accounting was started.

## 2. Confirmed implementation scope and preflight

Read-only PDO preflight verified RAMA paths, database names, role/grant counts, schema definitions, migration history, manager references and trigger bodies. No Laravel request was made to the active release during this work.

| Check | Before | Final observation |
| --- | --- | --- |
| Active DB | `rama_workforce_laravel` on `127.0.0.1:3307`, `rama_local` | Same identity |
| Dedicated test DB | `rama_workforce_laravel_test`, `rama_test` | Only MariaDB schema mutated by tests |
| Active accounts | 1 active Administrator; no Employees/Foremen | Same role/status counts |
| Operational records | 0 attendance, schedules, employees, sites, leave, orders, daily/weekly reports or memberships | Same counts |
| Active migrations / tables / triggers | 16 / 32 / 26 | Unchanged |
| Active decision grants | 4: Admin and legacy Foreman accept/cancel | Unchanged; targeted removal prepared only |
| Active manager references | 0 in users/worksites/weekly reports | Unchanged |
| Active sessions | 3 | 1 |
| Active file baseline | 449 tracked/audit files hashed | 449 byte-identical; report is an added document |

All captured active metadata was identical except the session-row count. Session lifecycle changed during elapsed work; no cause is asserted. The agent issued read-only queries against this database and did not edit, delete or recreate sessions. The sole active Administrator was never changed. No unexpected real role/history dependencies were present at preflight.

The source Git baseline was RAMA commit `675f1c3`; the isolated repository has its own baseline and no push/remote action. The active tree initially had only the untracked Phase 01 audit report. The two new migration files and all application changes exist in staging only. Both staging environment files use testing configuration, independent local storage and the RAMA test account.

## 3. Business defaults requiring owner review

Approve these before deployment:

1. One company-wide report per Monday–Sunday calendar week, using the existing company timezone. All Administrators share its draft; saving/closing records the actual preparer. No per-Administrator report identity.
2. Administrator prepares/closes weekly reports; submitted daily work remains employee-authored. Administrators review submitted daily reports without approval status and cannot read draft content.
3. Leave has pending/approved/rejected; rejection reason is 3–500 trimmed characters. A terminal decision cannot be revised/reopened in this phase. No entitlement/balance/absence-hour deduction.
4. Material orders retain submitted/accepted/cancelled; active Administrators have fixed authority, independent of historical role or individual grants.
5. Manual/automatic attendance, GPS, travel, breaks, sequencing, durations and schedules retain their existing factual meaning. An Administrator cannot record attendance or submit daily work by impersonating an Employee.
6. Request events notify currently active Administrators. Decisions notify the original requesting account. Required in-app requests/decisions bypass optional preferences. Unresolved/failed deliveries remain durable and are retried explicitly by an Administrator in Settings. No background retry scheduler was introduced. Inactive request owners retain their decision notice for history; inactive accounts cannot log in.
7. Weekly worksite activity uses stored attendance-event worksite metadata, not current assignment guesses. It displays dates with evidence, not allocated hours or proof of continuous presence. Daily narrative is associated only when exactly one site was observed for that employee/date. Missing or multiple sites leave the narrative unassigned. Attendance-only site activity is still shown.
8. Weekly population includes active workers and inactive/archived workers with submitted reports or attendance evidence in the period. Existing role transitions remain governed by the current account-management workflow. No new employment-history model is inferred; historical reports of a worker later promoted to Administrator are not automatically pulled into a newly generated weekly population. Existing frozen reports remain readable. If that population is needed, agree an explicit employment-history policy before deployment.
9. Empty weeks with employees can be closed only with an explicit administrative note; a company with no employees cannot close a report. Multiple Administrators serialize draft/close operations on the company settings row, with a unique company/week DB index as a second guard.
10. Historical V1 reports are archive records, retain legacy author/week identity and do not count as new company-week reports. No automatic merging of overlapping historical team reports. Existing legacy drafts require owner-reviewed handling before migration; the migration refuses them.

These defaults are proposed implementation behavior, not evidence of owner approval. External mail/HTTP remains blocked even when report-recipient settings are present.

## 4. Modified files and review artifacts

The full file inventory appears at the end of this report. It includes source, routes, views, sq/de catalogues, synthetic fixtures and adapted tests. `tests/ROLE_TRANSITIONS.md` records why obsolete team/Foreman test expectations were replaced. Employee-peer denials, immutable evidence and draft/attachment privacy assertions remain.

Primary source changes: role/module/scope/policy architecture; active actor revalidation; user and site management; leave decision workflow; fixed order authority; company weekly service and V1 adapter; monthly filter removal; notification outbox/retry UI; forward migrations; two dashboards and localized forms/navigation.

Review artifacts at the staging root:

- `RAMA_AG_SMGV_PHASE_02_IMPLEMENTATION_REPORT.md` — this report.
- `RAMA_AG_PHASE_02_REVIEW.patch` — tracked source diff; new files are in the release ZIP and staged directory.
- `RAMA_AG_PHASE_02_RELEASE.zip` — source proposal with compiled assets; excludes environment credentials, dependencies, runtime storage and Git internals.
- `RAMA_AG_PHASE_02_RELEASE_MANIFEST.json` — packaged-file SHA-256 values.
- `RAMA_AG_PHASE_02_RELEASE.sha256` — ZIP checksum.

The ZIP is a review/activation candidate, not permission to deploy. Restore/install dependencies from existing lockfiles in a separate RAMA release directory; preserve the active environment, APP_KEY, cookie/cache namespace and private storage at deployment.

## 5. Removed Foreman runtime dependencies

Removed the enum role, team authorization scope, user manager relationship methods, role/factory selector, delegated site endpoint/configuration interface, grant editor, Foreman dashboard component/views/catalogues, manager directory/form/filter fields and active manager validation messages. Admin scopes are company-wide; employee scopes use server-side ownership. `TeamScope` remains a class name for the shared visibility service, not a third role.

The only remaining Foreman terminology in application runtime source is the narrowly scoped `WeeklySnapshot` V1 compatibility reader. Historical migrations and test-only legacy-upgrade fixtures retain historical names intentionally. `MonthlyEngine.teamId` remains inert compatibility metadata, always null from the reporting service; it is absent from live filters, controller input, Livewire state and export links. Factual calculation code was not changed.

## 6. Final role and permission matrix

| Operation | Active Administrator | Active Employee |
| --- | --- | --- |
| Dashboard | Company oversight | Personal records |
| Account directory/status/credentials | Existing secure administration, last-active-Admin protection | Own profile/password workflows only |
| Worksites/GPS/assignments | Create/edit/activate/manage assignments | Select existing authorized active sites only |
| Attendance | Oversight; no employee impersonation | Own automatic/manual factual events/history |
| Working schedules | Company management | Own schedule |
| Leave | Review/approve/reject, no self-decision | Own submit/history; no decision authority |
| Material orders | Company review/accept/cancel | Own create/history; injected grant confers no decision authority |
| Daily reports/attachments | Submitted content only | Own drafts/submissions; no peer access |
| Weekly reports/PDF/email retry | Company draft/close/archive/download/retry | Denied |
| Monthly operational PDF/Excel | Allowed, employee/period/status filters | Denied |
| Notifications | Own notices + administrative failed-delivery panel | Own notices only |

Suspended/archived accounts are denied protected operations. Administrative mutations refresh the persisted actor rather than trusting client role/actor identifiers. Existing session revocation and last-active-Administrator protections are retained and exercised by regression tests.

## 7. Updated workflows

**Leave:** active employee validates/submits → pending row + audit/outbox in the transaction → active Admin queue → locked pending→approved/rejected transition → actor/time/reason recorded → required owner notice. Historical approval columns stay populated for approved requests and are preserved on upgrade. A replay returns the same request. Conflicting or repeated decisions fail. No Admin leaves the request pending and exposes the unresolved condition to the employee; Settings permits Admin recovery later.

**Orders:** original submission/numbering/items/delivery-policy flow stays intact. Fresh Admin authorization precedes a locked terminal decision. Immutable status history and duplicate/stale transition protection remain. Requests route to active Admins, decisions to owner. Legacy grants cannot widen Employee authority.

**Weekly:** shared company-week draft → review submitted daily content and site evidence → administrative text/preview → one immutable V2 snapshot and delivery row → closed archive/PDF. New snapshots use neutral `preparedBy` and `administratorComments`; payload `schema=2`, scope `company`. Snapshot row version remains 1 for its single final revision, distinct from payload schema version. V1 JSON is adapted only in memory for display/PDF/mail; raw bytes and hash remain untouched.

**Notifications:** unique outbox event key plus recipient/event uniqueness; locked idempotent delivery. A failed notification savepoint rolls back delivery, not the business request. Status/attempt count/error category persist; Admin can retry pending/unresolved/failed records. Outbox errors do not store exception text or user reasons. Settings surfaces the first 100 unresolved deliveries; processing some reveals later rows. Optional preferences still apply to optional categories.

**Attendance/daily/monthly:** no replacement of time engines or source evidence. Employee reports remain immutable after submit; attachments stay private. Monthly reports remain operational attendance exports with factual formulas, not SMGV/payroll compliance.

## 8. Prepared database migrations

Original 16 migrations remain byte-identical. Only the following forward files are new, applied **only to the test database**:

| Order | Migration | Changes |
| --- | --- | --- |
| 1 — expand | `2026_11_26_100000_expand_two_role_workflows.php` | Guard DB identity and unresolved legacy roles/manager references/drafts; add leave decision FK/time/reason; backfill new neutral fields from historical approvals; expand leave/type checks; add weekly preparer/company-week/comments and unique identity check/index; make retained legacy author nullable; create durable outbox and configuration archive |
| 2 — switch | `2026_11_26_110000_switch_to_two_runtime_roles.php` | Refuse unexpected roles; preserve active Admin; archive/remove only Foreman order grants; archive/remove role/users delegation JSON while preserving unrelated keys; restrict persisted roles to admin/worker and grant target CHECK to Admin role or explicit user |

An explicit user grant may remain stored for historical compatibility, but application decision authority ignores it. New weekly identity CHECK requires either a retained legacy author with null company_week, or a neutral preparer with company_week=week_start and no legacy author. The DB unique company_week index prevents cross-Admin duplication.

`PhaseTwoMigration::guard()` requires actual DB/account identity: testing + `rama_workforce_laravel_test`/`rama_test@127.0.0.1`, or the active RAMA DB/account with separately approved process flag. It refuses generic/wrong targets. Production approval flag was not set or used during this task. Both down() methods deliberately refuse automatic destructive rollback.

Partial expansion detection refuses blind reapplication. This is not a transactional DDL recovery mechanism; use section 15. No shared grants/server settings changed. No DROP/CREATE TRIGGER operations occur in these new migrations.

## 9. Remaining legacy compatibility structures

Retained users/worksites.foreman_id columns and FKs; weekly legacy author/week unique identity and comments; approved_by_id/approved_at; historical notification types; table/model names such as weekly_team_reports; archived delegation/grant JSON; V1 payload author/comments. Live form/service code never writes manager assignments. Historical author IDs and immutable records are not rewritten.

No contract migration is included or executed. If contract is later desired, first inventory every FK, audit/history consumer, V1 PDF/mail/archive reader and deployment window. Any drop, historical rewrite or account mapping needs a separately reviewed migration and explicit owner approval. Legacy role accounts or assigned manager relationships cause expansion to stop, not automatic promotion/deletion.

## 10. Integrity trigger verification

All **26 existing triggers** were compared by name, table, event, timing and action statement against the original RAMA test metadata fixture (`tests/Fixtures/integrity-triggers.json`). Upgrade additionally compared all trigger names/bodies before and after expansion/switch. They remained identical.

Regression tests exercise raw attendance/GPS/audit immutability, daily child/attachment finality, immutable order items/status history/policies, read-state-only notifications, weekly snapshot immutability and closed weekly finality. The upgrade test attempts a forbidden V1 snapshot edit and confirms DB rejection. No trigger was disabled to migrate history.

## 11. Test results

Final PHP executions:

| Suite | Tests | Passed | Failures | Errors | Skipped | Assertions |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| main | 540 | 442 | 0 | 0 | 98 | 8662 |
| memory | 97 | 96 | 0 | 0 | 1 | 741 |
| upgrade | 2 | 2 | 0 | 0 | 0 | 27 |

Across the three PHP commands: 639 test executions, 540 passed, 99 skipped, zero failures/errors, 9430 assertions. Distinct PHP cases: 542; 540 passed across the appropriate harnesses and two deliberately skipped cases.

The memory suite is a subset of tests discovered by the main suite; do not add them as distinct coverage. Main-suite 97 memory-only skips are exercised separately; its other skip targets an intentionally unmigrated site schema. Memory has one optional synthetic browser-preview export skip because `QW_MANUAL_PREVIEW_DIR` was not supplied. Neither skip hides a failed business/security assertion. The optional browser capture and pre-migration-only schema scenario remain unexecuted in the final schema; the partial-DDL test covers migration refusal separately. The release middleware is implemented but no separate missing-column HTTP fixture was run.

Main skip distribution:

| Class | Skipped in main | Reason |
| --- | ---: | --- |
| AttendanceFeedbackTest | 4 | Guarded SQLite fixture suite; run separately |
| DemoWorksiteDeletionTest | 6 | Guarded SQLite fixture suite; run separately |
| EmployeeDashboardTest | 9 | Guarded SQLite fixture suite; run separately |
| EmployeeManagementUiTest | 4 | Guarded SQLite fixture suite; run separately |
| ManualAttendanceTest | 9 | Guarded SQLite fixture suite; run separately |
| ProfileEditingTest | 6 | Guarded SQLite fixture suite; run separately |
| ReturnTravelTest | 13 | Guarded SQLite fixture suite; run separately |
| SixStepTravelTest | 11 | Guarded SQLite fixture suite; run separately |
| WorkerScanningFlowTest | 15 | Guarded SQLite fixture suite; run separately |
| WorksiteManagementTest | 20 | Guarded SQLite fixture suite; run separately |
| WorksiteSelectionAvailabilityTest | 1 | Pre-migration-only schema case |

The synthetic upgrade suite verifies partial expansion refusal, explicit legacy-account transition refusal, no automatic role changes, fresh/upgrade SHOW CREATE equivalence (only AUTO_INCREMENT counters normalized), original membership/approval preservation, archive fidelity, V1 byte/hash preservation and trigger preservation. Its synthetic historical Foreman→worker mapping is an explicit test fixture action, never an application migration rule.

The new acceptance class covers exact runtime/persisted roles, all triggers, no-manager leave submission, no-Admin recovery, both decisions, stale/forged authority, peer denials, preference bypass/deduplication/failure recovery, personal-grant denial, shared company identity, DB uniqueness/decision constraints, site evidence/private drafts, V1 archive/PDF stability and both locales. Existing tests were adapted to approved two-role behavior, not deleted wholesale; original test names may retain their provenance.

T1 role/direct-URL/forged actions; T2 users/navigation/last Admin/sq-de; T3 leave; T4 material decisions; T5 daily/weekly/privacy; T6 notification routing/retry; T7 site/membership/GPS; T8 factual/manual/travel/break/schedule/DST; T9 PDF/Excel/formula safety; T11 migrations/history; T12 isolation all exercised. T10 is future SMGV-only and deliberately excluded. The future 14-page SMGV export contract in T9 is also excluded.

Frontend: 6 Node runner entries passed (including the timer file's 30 internal checks); no failures/skips. Production Vite build passed. Blade compilation, route caching/clear and PHP lint of 128 changed/new PHP files passed; new upgrade method was also executed by PHP. Git whitespace check passed. No outbound transport/browser calls to the active application were used for tests.

A concurrent main+SQLite run encountered a Windows Blade cache rename lock. Both suites were rerun successfully with the SQLite suite sequential. Run these suites sequentially unless separate compiled-view directories are configured. Earlier intermediate failures were superseded by the final recorded runs.

Evidence: `.tools/phase02-main.json`, `phase02-memory.json`, `phase02-upgrade.json`, matching JUnit XML, and `phase02-verification.json` within staging. Only sanitized final result summaries are included in review documentation; environment credentials are excluded.

## 12. UI/UX validation

Existing RAMA branding, typography, layout classes/components and responsive design system retained. Changes remove role/delegation fields, replace Admin review actions and extend existing weekly sections. Both locales render account selectors with exactly two values, Admin weekly/daily/leave/orders/settings routes, Employee own views, rejection reason and notification recovery state. Blade/Livewire rendering and HTML/privacy assertions pass; PDF downloads render successfully and Excel round-trips retain formulas/charts/injection safety.

No new interactive browser screenshot/device/GPS-permission walkthrough was performed in this phase. Therefore this report does not claim visual pixel validation or live-device geolocation acceptance. The optional synthetic capture remains skipped; owner smoke review on an isolated candidate, including narrow/mobile layouts, is a deployment acceptance step.

## 13. Security validation

Positive active-role checks, persisted actor refresh, Employee ownership, last-active-Admin protection, session revocation, CSRF/auth middleware and private downloads remain enforced. Tests include direct URLs, forged Livewire review components, revoked/stale actors, personal grant injection, peer report/request/file IDs and terminal decision conflicts. A stale worker object promoted in DB cannot bypass the fresh Admin draft restriction. No content is copied into audit records for reasons/report text.

Weekly duplicate prevention is tested through different Admins and direct DB duplicate insertion; service locks and unique constraint are both present. Leave uses row locks plus conditional pending update. Original status-race/idempotency tests pass. This is not a claim of a separate multi-process load/stress test.

Existing attendance engines, state machine and schedule calculations retain their factual behavior. No automatic payroll credit, overtime policy replacement, GAV entitlement or absence accounting was added.

## 14. Quality isolation verification

No Quality source/config/credentials/database/storage/service was read, changed, queried or started. The inherited cookie-isolation test was replaced **before running tests** with a random independent synthetic encryption key; the database-isolation check verifies only RAMA's configured test connection. Negative configuration tests contain a forbidden database-name/URL string solely to prove rejection before connection; they do not access that database. An inherited browser helper has a historical preview name but was not executed.

Only RAMA configuration supplied the verified local PDO read-only preflight. Tests use RAMA's test schema/account or guarded SQLite `:memory:`. No shared MariaDB privileges/server settings were changed. RAMA session cookie `rama_ag_session`, cache prefix `rama_ag_cache_`, independent storage and APP_KEY isolation remain. Other Laravel DB connections are removed by the isolation provider. Mail is forced to array, outbound mail events are cancelled, non-database notifications are cancelled and stray Laravel HTTP requests are blocked.

The active source/file baseline is unchanged. Active DDL, migrations, trigger bodies, grants, role counts and operational counts remain at Phase 01 state; the observed session count change is disclosed in section 2.

## 15. Deployment and recovery instructions — PREPARED, NOT EXECUTED

### Before owner approval

Review this source proposal, business defaults and remaining limitations. Keep localhost:3400 on its current release. Do not replace its environment with the staged `.env` or `.env.testing`, and do not point its web root at staging, which is test-only. Review ZIP/manifest and prepare a separate RAMA candidate release with its own dependencies and compiled assets; do not run tests against the application DB.

### Approved deployment sequence

1. Obtain explicit owner approval for Phase 02 release, business defaults and the two forward migrations against the active RAMA DB. Confirm a maintenance window and responsible recovery operator. Do not bundle a legacy-column contract or SMGV work.
2. Re-run read-only preflight using the protected RAMA account. Require actual DATABASE()=`rama_workforce_laravel`, CURRENT_USER()=`rama_local@127.0.0.1`, host/port 127.0.0.1:3307, expected migration hashes/history, at least one active Admin. Inventory current counts of roles, grants, manager references, sites/memberships, leave, weekly drafts/snapshots, daily/attendance/schedules. Stop on new Foreman accounts, manager assignments, unmapped legacy drafts or unexpected dependencies and obtain an explicit data-transition plan. Never promote/delete accounts automatically.
3. Put the **old active release** into maintenance, stop RAMA web/job writers, wait for in-flight transactions and confirm the boundary. Do not stop or alter other projects/services.
4. Take a restorable RAMA-only predeployment DB backup including data, schema and triggers, with a protected interactive credential mechanism. Back up the old code release and protected environment/APP_KEY and private report attachments. Store securely outside the release ZIP. Validate checksum and restore the backup to an isolated disposable RAMA recovery target before proceeding. Backup/restore was not executed on the active DB in this task.
5. Prepare the candidate with the active RAMA protected environment, `APP_ENV=local` as used by the existing installation, the exact application DB account, correct APP_KEY/cookie/cache/storage paths and outbound blockers. Preserve historical private storage; never copy synthetic test files or test credentials into it. Make the verified original 16 migrations and the two reviewed new files available in this candidate. Keep old and new web processes stopped during the schema switch.
6. In that candidate terminal only, after identity verification and approval, set `$env:RAMA_PHASE02_DEPLOY_APPROVED = 'owner-approved-phase02'`. Apply **expand first**, then **switch**, with the candidate's PHP/artisan:

   ```powershell
   & $ramaPhp artisan migrate --force --path=database/migrations/2026_11_26_100000_expand_two_role_workflows.php
   & $ramaPhp artisan migrate --force --path=database/migrations/2026_11_26_110000_switch_to_two_runtime_roles.php
   Remove-Item Env:RAMA_PHASE02_DEPLOY_APPROVED
   ```

   `$ramaPhp` must resolve to the verified RAMA PHP binary; working directory must be the prepared candidate, never Quality. Stop at the first nonzero exit. Do not retry partial DDL blindly, mark migrations manually, drop constraints/triggers or use migrate:fresh/rollback on the application DB. Keep maintenance until recovery or all checks pass.
7. Verify 18 migration rows, exactly admin/worker CHECK, no obsolete role grants, neutral weekly constraints/FKs/index, decision/type constraints, outbox/archive schema, 26 original trigger bodies and unchanged factual/historical record counts. Approved historical decision fields must match old actor/time; V1 payload bytes/hash and membership IDs must match backup. Check migration archive JSON before any activation.
8. Refresh candidate configuration/view/route caches using existing RAMA procedures; compiled Vite assets must match the manifest. No composer/npm/network update is needed during the maintenance switch if dependencies/assets were prepared. Do not alter shared server caches. Switch the RAMA release pointer/web root to the candidate only after schema checks pass, then restart only RAMA writers. Preserve any applicable session revocation for separately approved role changes.
9. Verify an existing Administrator login without resetting its credentials. Confirm two roles and no delegation UI, employee/site management, monthly exports and archive/PDF. Use a separately authorized synthetic Employee/site, not real-record manipulation, to smoke-test personal attendance/GPS/manual/break/travel, private daily draft/submit, leave approve/reject, order decision, notifications/preferences/retry and company weekly duplicate protection with two Admins. Check both sq/de and narrow/mobile layouts. Do not submit synthetic records to active production without explicit approval for those fixtures; an isolated candidate is preferred.
10. Confirm outbound communication remains blocked, review logs and delivery status, remove maintenance only after owner acceptance. Archive release hash, backup identity, pre/post counts and test/smoke evidence. No live Phase 02 deployment step above was executed here.

### Recovery

MariaDB DDL implicitly commits. The first migration may have added columns, backfilled neutral fields or replaced some checks before a failure; the migration-table row may still be absent. The second may have archived/deleted grants before a subsequent DDL failure. Application rollback alone is unsafe because old code writes the old leave schema and new code requires expansion/switch.

Keep both releases blocked from writing. Capture current migration history, SHOW CREATE tables/triggers, archive rows and logs without secrets. Compare with the verified predeployment backup and the exact migration statement that failed. Choose either a separately reviewed targeted forward repair, preserving all evidence/triggers, or a RAMA-only full restore of the verified predeployment backup and matching old code/environment/private storage. Do not assume down() can restore the prior state; it intentionally refuses.

If no writes occurred after backup, restore under the existing maintenance boundary and verify schema, 26 triggers, hashes, memberships, grants, active Admin and counts before reopening the old release. If the new release accepted real writes, preserve the incident snapshot and obtain explicit owner approval for reconciliation before any restore that could discard data. Never blindly restore an old backup over new real evidence. Do not change shared grants/server configuration or other project data. Partial-DDL refusal was tested synthetically; an operator-run full backup/restore rehearsal is still required before active deployment.

## 16. Outstanding blockers and limitations

No unresolved failing critical regression in the final isolated suites. Deployment is blocked by the intentional approval/maintenance boundary. Required before activation: owner acceptance of defaults (especially site attribution and weekly historical population), current-data preflight, verified backup restore rehearsal and isolated interactive/mobile smoke acceptance.

Two deliberately unexecuted scenarios remain: optional browser HTML capture and an old unmigrated worksite schema test. The final schema and partial-migration failure guard are covered separately; no separate missing-column HTTP fixture was run for the release middleware. No browser/GPS-device acceptance or multi-process stress benchmark is claimed. No destructive contract, automatic mapping or new payroll/SMGV rules exist. Normal application-session lifecycle continued during the read-only active metadata observations.

## 17. Required approvals

Explicit owner approval is required for: business defaults; active application database migration; release activation/maintenance window; actual backup/restore procedure; handling any newly discovered legacy actors/drafts/manager history; and any active smoke fixtures. Legacy-column contract, outbound communication enablement and SMGV implementation remain separate approvals, not implied by deploying this phase.

## 18. Recommendation for Phase 03

First complete the controlled deployment acceptance if approved. Then obtain the actual SMGV reference PDF, validated accounting rules, employment/history/absence/overtime/travel/break/calendar/rounding/carry-forward requirements and export contract. Prepare a separate specification and authorization matrix. Do not interpret existing operational monthly totals as SMGV compliant. No Phase 03 code was started.

**STOP: await explicit owner deployment approval.**

## Appendix — Full Phase 02 file inventory

Paths are relative to the isolated staging root. Historical migrations are intentionally absent from this changed-file list. Runtime/generated storage, credentials, dependencies and build outputs are excluded; compiled assets are nevertheless included in the release ZIP.

- `RAMA_AG_SMGV_PHASE_02_IMPLEMENTATION_REPORT.md` (new)
- `app/Domain/Reports/WeeklyAggregator.php`
- `app/Enums/AccessScope.php`
- `app/Enums/AppModule.php`
- `app/Enums/NotificationType.php`
- `app/Enums/Role.php`
- `app/Http/Controllers/MonthlyExportController.php`
- `app/Http/Controllers/PageController.php`
- `app/Http/Controllers/ReportAttachmentController.php`
- `app/Http/Controllers/ReportPdfController.php`
- `app/Http/Controllers/WorksiteController.php`
- `app/Http/Middleware/EnsureModuleAccess.php`
- `app/Http/Middleware/EnsurePhaseTwoSchema.php` (new)
- `app/Http/Middleware/RamaRequestForgery.php`
- `app/Livewire/AdminDashboard.php`
- `app/Livewire/AttendanceOverview.php`
- `app/Livewire/ChangePasswordForm.php`
- `app/Livewire/DailyReportEditor.php`
- `app/Livewire/ForemanDashboard.php` (removed)
- `app/Livewire/LeaveApprovals.php`
- `app/Livewire/MonthlyReport.php`
- `app/Livewire/NavigationCounter.php`
- `app/Livewire/NotificationBell.php`
- `app/Livewire/NotificationDeliveryStatus.php` (new)
- `app/Livewire/NotificationHistory.php`
- `app/Livewire/NotificationPreferences.php`
- `app/Livewire/OrderBuilder.php`
- `app/Livewire/OrderSettings.php`
- `app/Livewire/OrdersExplorer.php`
- `app/Livewire/ReportEmailSettings.php`
- `app/Livewire/ScheduleEditor.php`
- `app/Livewire/ScheduleOverview.php`
- `app/Livewire/TeamDailyReports.php`
- `app/Livewire/WeeklyReportBuilder.php`
- `app/Livewire/WeeklyReportsList.php`
- `app/Livewire/WorkerAttendance.php`
- `app/Livewire/WorkerHistory.php`
- `app/Livewire/WorkerLeave.php`
- `app/Livewire/WorkersDirectory.php`
- `app/Mail/WeeklyReportMail.php`
- `app/Models/LeaveRequest.php`
- `app/Models/User.php`
- `app/Models/WeeklyTeamReport.php`
- `app/Models/Worksite.php`
- `app/Policies/UserPolicy.php`
- `app/Providers/RamaIsolationServiceProvider.php`
- `app/Services/DailyReportService.php`
- `app/Services/DashboardService.php`
- `app/Services/LeaveService.php`
- `app/Services/MonthlyReportService.php`
- `app/Services/MonthlyWorkbook.php`
- `app/Services/NavigationCounts.php`
- `app/Services/NotificationService.php`
- `app/Services/OrderConfigService.php`
- `app/Services/OrderService.php`
- `app/Services/ReportPdfService.php`
- `app/Services/RequiredNotifications.php` (new)
- `app/Services/ScheduleService.php`
- `app/Services/TeamScope.php`
- `app/Services/UserManagement.php`
- `app/Services/WeeklyDeliveryService.php`
- `app/Services/WeeklyReportService.php`
- `app/Services/WorksiteAccess.php`
- `app/Services/WorksiteManagement.php`
- `app/Support/Actor.php` (new)
- `app/Support/NotificationText.php`
- `app/Support/PhaseTwoMigration.php` (new)
- `app/Support/WeeklySnapshot.php` (new)
- `bootstrap/app.php`
- `database/factories/UserFactory.php`
- `database/migrations/2026_11_26_100000_expand_two_role_workflows.php` (new)
- `database/migrations/2026_11_26_110000_switch_to_two_runtime_roles.php` (new)
- `lang/de/adminDash.php`
- `lang/de/employeeCenter.php`
- `lang/de/foremanDash.php` (removed)
- `lang/de/leave.php`
- `lang/de/notifications.php`
- `lang/de/portal.php`
- `lang/de/reportEmail.php`
- `lang/de/reportExport.php`
- `lang/de/reports.php`
- `lang/de/roles.php`
- `lang/de/twoRole.php` (new)
- `lang/de/users.php`
- `lang/de/worksiteManagement.php`
- `lang/sq/adminDash.php`
- `lang/sq/employeeCenter.php`
- `lang/sq/foremanDash.php` (removed)
- `lang/sq/leave.php`
- `lang/sq/notifications.php`
- `lang/sq/portal.php`
- `lang/sq/reportEmail.php`
- `lang/sq/reportExport.php`
- `lang/sq/reports.php`
- `lang/sq/roles.php`
- `lang/sq/twoRole.php` (new)
- `lang/sq/users.php`
- `lang/sq/worksiteManagement.php`
- `resources/css/admin-reference.css`
- `resources/css/employee-management.css`
- `resources/js/employee-management.js`
- `resources/views/components/global-sidebar.blade.php`
- `resources/views/components/layouts/app.blade.php`
- `resources/views/dashboard/_orders-panel.blade.php`
- `resources/views/dashboard/foreman.blade.php` (removed)
- `resources/views/emails/weekly-report-text.blade.php`
- `resources/views/emails/weekly-report.blade.php`
- `resources/views/livewire/_employee-dashboard.blade.php`
- `resources/views/livewire/_employee-modal.blade.php`
- `resources/views/livewire/_weekly-worksites.blade.php` (new)
- `resources/views/livewire/admin-dashboard.blade.php`
- `resources/views/livewire/foreman-dashboard.blade.php` (removed)
- `resources/views/livewire/leave-approvals.blade.php`
- `resources/views/livewire/monthly-report.blade.php`
- `resources/views/livewire/notification-delivery-status.blade.php` (new)
- `resources/views/livewire/order-settings.blade.php`
- `resources/views/livewire/weekly-report-builder.blade.php`
- `resources/views/livewire/weekly-reports-list.blade.php`
- `resources/views/livewire/worker-leave.blade.php`
- `resources/views/livewire/workers-directory.blade.php`
- `resources/views/orders.blade.php`
- `resources/views/pdf/weekly.blade.php`
- `resources/views/reports.blade.php`
- `resources/views/schedules.blade.php`
- `resources/views/settings.blade.php`
- `resources/views/worksites/edit.blade.php`
- `resources/views/worksites/index.blade.php`
- `resources/views/worksites/permissions.blade.php` (removed)
- `routes/web.php`
- `tests/Feature/AdminDashboardTest.php`
- `tests/Feature/AttendanceFlowTest.php`
- `tests/Feature/AttendanceHistoryTest.php`
- `tests/Feature/AttendanceUiTest.php`
- `tests/Feature/DailyReportsTest.php`
- `tests/Feature/DailyReportsUiTest.php`
- `tests/Feature/DashboardOrderPopupTest.php`
- `tests/Feature/DashboardPresentationTest.php`
- `tests/Feature/DatabaseIntegrityTest.php`
- `tests/Feature/DemoWorksiteDeletionTest.php`
- `tests/Feature/EmployeeManagementUiTest.php`
- `tests/Feature/GlobalSidebarTest.php`
- `tests/Feature/LeaveTest.php`
- `tests/Feature/MonthlyReportTest.php`
- `tests/Feature/NavigationCountsTest.php`
- `tests/Feature/NotificationsTest.php`
- `tests/Feature/OrderDecisionsDefaultTest.php`
- `tests/Feature/OrdersTest.php`
- `tests/Feature/OrdersUiTest.php`
- `tests/Feature/PhaseTwoArchitectureTest.php` (new)
- `tests/Feature/RamaIsolationTest.php`
- `tests/Feature/ReportPdfTest.php`
- `tests/Feature/ReturnTravelTest.php`
- `tests/Feature/RoleAccessTest.php`
- `tests/Feature/SchedulesTest.php`
- `tests/Feature/SixStepTravelTest.php`
- `tests/Feature/WeeklyReportsTest.php`
- `tests/Feature/WeeklyReportsUiTest.php`
- `tests/Feature/WorkersDirectoryTest.php`
- `tests/Feature/WorksiteManagementTest.php`
- `tests/Feature/WorksiteSelectionTest.php`
- `tests/Fixtures/WorksiteManagementSchema.php`
- `tests/Fixtures/integrity-triggers.json` (new)
- `tests/ROLE_TRANSITIONS.md` (new)
- `tests/Upgrade/PhaseTwoMigrationTest.php` (new)
- `tests/upgrade.xml` (new)
