# RAMA AG — SMGV Phase 01 System Audit & Role Simplification

**Date:** 26 November 2026 (Europe/Warsaw)  
**Mode:** AUDIT ONLY — implementation is not authorized by this report.  
**Project root:** C:\Users\PANDAZZ\Desktop\RAMA-AG\rama-workforce-laravel  
**Application identity:** http://localhost:3400 / rama_workforce_laravel / 127.0.0.1:3307  
**Reviewed Git revision:** 675f1c3. File references below are relative to this project root; line references identify the audited version.

## 1. Executive summary

RAMA currently implements **three** application roles: admin, foreman and worker. The confirmed target is exactly **Administrator / Employee**, retaining the existing internal identifiers admin and worker. Albanian labels already are Administrator/Punëtor; German labels already are Administrator/Mitarbeiter.

Removing an enum case or hiding a role selector alone would break functioning workflows. Vacation submission requires an active Foreman; approval expressly excludes Administrators. Weekly report creation, drafting and closing require a Foreman and derive report membership from users.foreman_id. Site administration delegates capabilities to Foremen, and material-order decisions use role/personal grants.

The read-only RAMA database snapshot contains **one active Administrator, no Employee or Foreman accounts**, no attendance, leave, orders, schedules, worksites or weekly reports, and **two Foreman role-grant rows** among four order grants. Thus no current Foreman account transition is needed, but database constraints and seeded permission records still require a future migration. This is a snapshot finding, not permission to modify records or an assumption that the database will remain empty.

The audit identifies **126 first-party files with direct role/name references**, plus the transitive dependencies listed in section 4. The inventory distinguishes executable restrictions, schema relationships, display text, pure aggregation, historical migration comments and synthetic tests.

SMGV has useful factual attendance and export foundations, but no employment contracts/percentages, vacation entitlement ledger, payroll holiday calendar, correction approval ledger, monthly lock, Basisblatt, Jahresübersicht or 14-page annual export. Existing overtime is an explicitly provisional actual-versus-schedule metric. It is not a validated GAV calculation.

**Recommendation:** approve a separate two-role implementation phase with explicit forward migrations and synthetic regression tests. Resolve weekly report scope and request decision semantics before implementation. Build SMGV only in a later, separately specified phase.

## 2. Current architecture and audit method

Locked dependencies are Laravel v13.40.0, Livewire v4.4.8, Dompdf v3.1.6 and PhpSpreadsheet 5.11.0 (composer.lock). Presentation uses Blade, Tailwind/Vite, Alpine/Livewire and sq/de catalogues.

- app/Enums/Role.php defines identities; AppModule.php supplies eight module scopes; AccessScope.php defines all/team/own/none.
- AppServiceProvider defines the module Gate and persistent active-account middleware for Livewire. UserPolicy controls account visibility. Services implement record scopes and workflow checks.
- routes/web.php exposes authenticated/active/password.changed module pages, private report downloads and separate worksite management routes. There is no routes/api.php or first-party REST API controller layer. Livewire actions remain network-reachable and must be secured independently.
- Controllers delegate mutations/exports to services; Eloquent models supply relationships and immutable/frozen-record guards.
- MariaDB has **32 tables, 37 foreign keys, 43 CHECK definitions (including JSON-validity checks), 26 triggers and 16 migration-history entries**.
- NotificationService uses in-app rows and polling. WeeklyDeliveryService has durable delivery state and synchronous post-close sending; WeeklyReportMail is not a queued export implementation.
- No custom app/Jobs directory or scheduled application workflows were found. routes/console.php contains only the inspire command; app/Console/Commands contains integrity checking and interactive Administrator onboarding. Queue tables/configuration are infrastructure, not evidence of a monthly-closing job.
- RamaIsolationServiceProvider enforces the RAMA connection identity, namespaces and local storage, blocks outgoing mail/external notification channels and prevents un-faked Laravel HTTP calls.

**Audit operations:** first-party source/schema/test/configuration searches, static source reads, Git status/log reads, in-memory file hashes, and direct PDO reads of RAMA metadata/anonymized counts. The PDO session used START TRANSACTION READ ONLY and rollback; Laravel was not booted. No HTTP pages/downloads were requested: some controllers and dashboard mounts append audit records. No Artisan command, migration, seed, test suite, asset build, queue worker, schema change or shared privilege operation was run.

Search covered foreman/foremen, supervisor, vorarbeiter, kryepunetor/kryepunëtor, team leader/team lead, Teamleiter and Polier, case-insensitively. Third-party vendor/node_modules, generated build assets, runtime logs and secrets were not treated as first-party role architecture. Generated assets must eventually be rebuilt from changed source.

## 3. Existing role structure

| Identifier | Current labels sq / de | Current authority | Target |
| --- | --- | --- | --- |
| admin | Administrator / Administrator | Broad management, all active employees, schedules, monthly reports, sites; leave approval and weekly authoring are currently excluded; order approval can be removed through grants | Administrator: company-wide administration and exclusive approval/SMGV authority |
| foreman | Kryepunëtor / Vorarbeiter; worksite catalogue also says Polier | Assigned-team viewing, leave approval, weekly preparation/closing, granted site operations and material decisions | No application role, account option, permission branch or live role-specific UI |
| worker | Punëtor / Mitarbeiter | Own attendance/manual entries/travel, daily reports, leave requests, material requests, assigned-site selection, personal history/profile | Employee with own-record operations; retain worker identifier to avoid unnecessary worker_id migrations |

Users store one role string and an enum cast, not a separate many-to-many roles system. users_role_check allows the three values. Statuses active/suspended/archived are account states, not extra roles. Team membership is users.foreman_id; site membership is the independent worksite_user pivot.

**Naming interpretation:** Polier in lang/de/worksiteManagement.php is another display term for the same role: its keys foremanRole/foreman and permission code prove the link. No independent supervisor/Teamleiter role or separate supervisory business entity was found. Team labels can describe grouping without being authorization; do not remove employee site memberships or pure aggregation because they mention a team. A process supervisor in third-party infrastructure would not constitute an application role.

## 4. Complete Foreman dependency inventory

Appendix A contains a row for **every directly matching first-party file**, with evidence lines, class/component, current behavior, permission, proposed future behavior, modification, risk and regression coverage. Appendix B enumerates user foreign keys; Appendix C records every trigger.

Regression identifiers T1–T12 are defined in section 14. “Change” below and in appendices is a recommendation for a future authorized phase, never work executed during this audit.

### 4.1 Transitive dependencies without a direct Foreman keyword

| File/component | Current behavior and associated permission | Proposed behavior / required modification | Risk | Regression |
| --- | --- | --- | --- | --- |
| routes/web.php | module:* routes; worksite permissions endpoint; daily/weekly/monthly downloads depend on role-aware services | Keep Employee own routes, remove obsolete worksite delegation endpoint, guard Admin weekly operations; add separate SMGV route group later | Critical | T1,T3,T5,T7,T10 |
| routes/console.php; app/Console/Commands/CheckIntegrity.php | No role workflow job; reports immutable-record trigger presence | Retain; no automatic role/data conversion or monthly-close side effects | Medium | T11,T12 |
| bootstrap/app.php; app/Providers/AppServiceProvider.php | Authentication/active/module middleware; Livewire persistent active check and Gate | Retain and integrate explicit SMGV policy/middleware; enforce role checks on updates/actions too | Critical | T1,T10 |
| app/Http/Middleware/EnsureModuleAccess.php | Delegates module authorization to AppModule | Two-role matrix; SMGV must not inherit Employee reports access | Critical | T1,T10 |
| app/Http/Middleware/EnsureUserIsActive.php | Revalidates account and eight-hour session; can write auth audit events | Preserve immediate deactivation/revocation; recheck fresh Administrator role before privileged mutations | High | T1,T10 |
| app/Http/Middleware/EnsurePasswordIsChanged.php | Compatibility alias currently passes requests through | Do not assume it supplies authorization or password-change enforcement | Medium | T1 |
| app/Providers/RamaIsolationServiceProvider.php; config/database.php; config/session.php; config/cache.php; config/filesystems.php; bootstrap/providers.php | Database/user/host checks, namespaced sessions/cache, local private storage and outbound blockade | Preserve isolation as-is throughout role/SMGV work; no server privilege changes | Critical | T12 |
| app/Enums/AccessScope.php | Team scope exists alongside all/own/none | Make team unused by role matrix; remove only after callers are verified, without widening Employee own scope | High | T1 |
| app/Livewire/MonthlyReport.php; resources/views/livewire/monthly-report.blade.php | Admin-only screen carries teamId selector and team query links | Retire Foreman team filter end to end; preserve employee/date filters | High | T8,T9 |
| app/Http/Controllers/MonthlyExportController.php | Admin-only Excel export accepts team parameter, appends export audit and temporary file | Remove obsolete team filter; keep private audited export; future SMGV separate policy | High | T9,T10 |
| app/Domain/Reports/MonthlyEngine.php | teamId copied to result; factual daily net/schedule comparison and monthly sums | Remove manager grouping metadata as needed; keep factual engine separate from new SMGV accounting | High | T8,T9 |
| app/Services/MonthlyWorkbook.php; resources/views/pdf/monthly.blade.php; lang/sq/monthlyXlsx.php; lang/de/monthlyXlsx.php | Existing monthly operational workbook/PDF; indirect role scope inherited from model | Preserve useful reports; do not call them SMGV or infer yearly/GAV correctness | High | T8,T9 |
| app/Services/ReportPdfService.php; resources/views/pdf/layout.blade.php | Shared private A4 Dompdf rendering, repeated header/footer, current locale | Retain safe renderer; new German SMGV templates/pagination needed later | High | T9,T10 |
| resources/views/settings.blade.php | Admin includes worksites.permissions; all users own account/notification settings | Remove obsolete delegation include; preserve Employee own settings | Medium | T2,T7 |
| resources/views/leave.blade.php; resources/views/livewire/leave-approvals.blade.php | Employee form vs non-worker queue; actions rendered through canApprove | Administrator approval/rejection UI; server authorization remains authoritative | High | T3,T10 |
| resources/views/workers.blade.php; resources/views/attendance.blade.php; resources/views/orders.blade.php | Role-aware modules indirectly depend on services/components | Verify only Admin/Employee compositions; preserve own operations | High | T1,T2,T4,T8 |
| lang/sq/nav.php; lang/de/nav.php | scopeTeam catalogue keys drive Foreman navigation | Retire live team-role labels; keep sq/de own/admin navigation | Medium | T2 |
| app/Livewire/AdminDashboard.php; app/Livewire/NavigationCounter.php | Admin operational dashboard and refreshed queue counters; dashboard may append map audit | Consolidate required review widgets; do not expose Admin datasets to Employee polling | High | T2,T6,T10 |
| app/Livewire/ScheduleEditor.php; app/Livewire/ReportEmailSettings.php | Existing Admin-only management | Preserve; refresh authority on mutations; email remains disabled | High | T8,T12 |
| app/Services/AttendanceService.php; app/Livewire/WorkerAttendance.php | Active Employee-only factual automatic/manual event recording; no decision queue | Preserve recording; any requested review/correction requires additive audited overlay, not overwritten events | Critical | T8,T11 |
| app/Services/WorksiteSelection.php; app/Services/WorksiteScanning.php; app/Services/WorksiteReadiness.php | Employee assigned-active-site selection/GPS; Admin readiness review | Preserve; remove no memberships when removing manager role | High | T7,T8 |
| database/seeders/DatabaseSeeder.php; app/Console/Commands/OnboardRamaAdmin.php | Seeder refuses automatic accounts; onboarding creates an Admin interactively | Keep; no automatic promotion/default account during role migration | High | T2,T12 |
| app/Models/AuditLog.php; app/Models/AttendanceEvent.php; app/Models/WeeklyReportSnapshot.php; app/Models/MaterialOrderStatusHistory.php | Role-neutral actor/evidence relationships and immutable history | Keep IDs and frozen payloads; translate historical format through a reader, not mutation | Critical | T11 |
| tests/Feature/Auth/LoginTest.php; Auth/SimpleCredentialsTest.php; tests/Feature/LocalizationTest.php | Auth, credential/profile and localization regression surface | Add two-role/forged-role cases while keeping login/profile behavior | High | T1,T2 |
| tests/Feature/ManualAttendanceTest.php; EmployeeDashboardTest.php; WorkerScanningFlowTest.php; ProfileEditingTest.php; AttendanceFeedbackTest.php; tests/Fixtures/WorkerScanningSchema.php | Role-independent Employee operations backed by synthetic fixture schema | Retain tests; update shared fixture relationship shape after future migrations | High | T7,T8,T11 |
| tests/Feature/RamaIsolationTest.php | Current local cookie test reads Quality .env; other tests assert connection/mail safeguards | Do not run that source-reading test under this audit boundary; later replace cross-app key dependency with synthetic independent keys | Critical | T12 |
| phpunit.xml; tests/memory.xml; tests/*.xml; tests/TestCase.php | Separate MariaDB test DB and guarded memory suites | Keep fixtures away from application DB and Quality; audit does not run tests | Critical | T11,T12 |

**Documentation/build artifacts:** README.md and RAMA_AG_PHASE_01_CLONE_REPORT.md are historical/context documents, not authorization sources. Preserve historical evidence; later explain new two-role behavior in maintained documentation. public/build is generated, not an independent permission system. Rebuild only during implementation after first-party source changes. config/auth.php has a web session guard, not a hidden Foreman guard. Other config files contain no extra supervisory role.

## 5. Read-only database findings

### 5.1 Current data, without personal information

| Finding | Observed count |
| --- | ---: |
| Active admin accounts | 1 |
| Worker accounts / Foreman accounts / unknown role values | 0 / 0 / 0 |
| users.foreman_id, worksites.foreman_id or weekly_team_reports.foreman_id populated | 0 / 0 / 0 |
| Employee-site memberships, schedules, attendance sessions/events/locations | 0 |
| Leave requests, material orders/history/items | 0 |
| Daily reports/items/attachments, weekly reports/snapshots/deliveries | 0 |
| Foreman capability grants | 2 |
| Administrator capability grants | 2 |
| Nonempty worksite_permissions configuration | 0 |
| Other existing initialization/runtime rows | company_settings=1, audit_logs=1, migrations=16, sessions=3 at snapshot |

The Foreman grants are accept_order and cancel_order, one each; the same two capabilities also have admin grants. They are role-level grants, not Foreman accounts. No names, emails, real account IDs, passwords, keys, personal document contents or notification contents are included here. No anonymized Foreman identifiers are needed because no Foreman accounts were found.

### 5.2 Role-specific schema

- users.role is VARCHAR(16) with users_role_check permitting admin, foreman, worker. Application-only removal cannot enforce exactly two persisted roles.
- users.foreman_id → users.id is nullable, ON DELETE SET NULL, and currently represents the employee's manager assignment.
- worksites.foreman_id → users.id is nullable with deletion restricted; index (foreman_id, active) supplies manager scope.
- weekly_team_reports.foreman_id → users.id is **not nullable**, with deletion restricted and unique (foreman_id, week_start). It is report identity as well as an actor link, so deleting/renaming it without a replacement breaks weekly authoring and uniqueness.
- order_capability_grants.role allows admin/foreman through grants_target_check; individual user_id targets are also possible. grant_key is a generated unique expression. The CHECK does not verify the target user's current role.
- company_settings.worksite_permissions is JSON: role capability defaults and per-user overrides are interpreted specifically as Foreman permissions by WorksiteAccess.
- leave_requests.approved_by_id and actor/created_by/changed_by columns are neutral user references, not role assignments. Preserve their history rather than deleting their users.
- sessions.user_id is indexed but not an FK in the audited schema. Future conversion must explicitly revoke sessions if an account changes role.

### 5.3 Decision and evidence constraints

leave_status_check accepts **pending/approved only**. leave_approval_check couples approval actor/time to approved status and rejects self-approval. A genuine rejected status needs an explicit migration, decision/reason representation and revised invariants. There is no rejection actor/time/reason column.

Material status CHECKs accept submitted/accepted/cancelled, including the status-history CHECK. Rejection terminology must either be explicitly mapped to cancellation or introduced as a real domain state with coordinated migrations. notifications_type_check currently has request/approved types but no LEAVE_REJECTED.

All 26 triggers protect immutability/finality or allowed field updates. Their bodies contain no Foreman identity or role predicates: **none should be dropped merely to simplify roles**. In particular, submitted daily reports, closed weekly reports and weekly snapshots cannot be rewritten; material history and audit logs are append-only. No database trigger supplies the missing Administrator leave authorization or a monthly accounting lock.

## 6. Approval workflow analysis

| Workflow | Actual current behavior/evidence | Direct Administrator–Employee proposal | Transition risks |
| --- | --- | --- | --- |
| Vacation/time-off | LeaveService::create requires active assigned Foreman and notifies only that Foreman; approve rejects Admin; pending→approved only | Employee submits without manager prerequisite; active Admin queue reviews and approves/rejects atomically; owner gets decision notice | Missing approver/NO_FOREMAN; overlooked conditional team predicate; unsupported rejected CHECK; stale/double decisions; lost actor audit |
| Other absences | Same undifferentiated date/comment leave table; no typed sickness/accident/unpaid absence flow | Confirm categories, evidence/privacy, submission rights and Admin decisions before adding typed requests | Treating all absences as vacation; exposing sensitive medical text; incorrect hours/balance integration |
| Materials | Only Worker submits. Admin sees all; Foreman sees team. Capability grants control submitted→accepted/cancelled; immutable history | Employee request → Admin review/decision → employee notification; preserve existing terminal states unless explicitly redefined | Removing default grants may leave no approver; accidentally inherited personal Employee grant; duplicate counter/history or invalid transition |
| Attendance corrections | No correction request/decision entity; raw events immutable | Later: Employee correction request → Admin reviewed adjustment layer with old/new values, reason and decision audit | Editing/deleting evidence, invalid sequences, silently recalculating old exports; pretending current manual mode is a correction workflow |
| Manual attendance | Employee enters same-business-day, nonfuture chronological timestamps with reason; records stored immediately with submission metadata/GPS evidence; no approver | Keep existing direct factual recording in role-only phase. If review is required, add an explicit pending/review overlay after policy decision | Retrospective behavior change, counting unapproved data inconsistently, mixing entered time and actual submission time |
| Daily reports | Employee draft→submitted, immutable afterward. Admin/Foreman can read submitted reports; drafts are private; no approve/reject | Employee submits; Admin reviews using existing functionality. Add acceptance/revision only if separately confirmed | Bypassing frozen triggers, exposing drafts, equating review with a nonexistent approval status |
| Weekly business reports | Only Foreman builds/closes own team report; frozen V1 snapshot, durable delivery, Admin archive/retry | Admin prepares/closes for an explicitly agreed company/site scope; retain archive and retry; Employee no administration | No eligible author, NO_TEAM, unique-key collisions, changed snapshot hashes, loss of historical prepared-by meaning |
| Site administration | Admin full; Foreman may receive create/edit/assign/gps/activate permissions for assigned sites | Admin manages sites and Employee memberships directly; Employees still select authorized active sites | Dropping worksite_user with manager assignment; forged employee/site IDs; stale Foreman-specific readiness checks |
| Employee assignments | users.foreman_id creates teams; separate worksite_user assigns sites | Remove required manager relation; Admin assigns employee↔site directly | Orphaned reporting groups, loss of old team facts, accidental access to all sites |
| Notifications | Team recipients combine Admins/Foreman; leave emitter targets Foreman alone. Owner decision notices exist for leave approval/orders; no rejection type | Central server resolver: submission→active Admins, decision→request owner; reauthorize deep links and support required decisions independently of optional preferences | Inactive/stale recipients, old payload keys/links, duplicate notices, preferences suppressing required decisions |
| Monthly attendance closing | MonthlyReportService computes live operational output; no monthly lock, closure actor, version or reopening workflow | Later Admin-only SMGV freeze/version/adjustment workflow with deterministic exports | Mistaking weekly closed status for monthly close; late events changing historical totals; unauthorized reopen |
| Work schedules | Admin already edits effective-dated plans; Foreman team read, Employee own | Preserve Admin edit/Employee own; remove team branch | Broken old plans/overlap rules; excluding former employees in historical report |

The generic target request flow applies to actual decision-bearing requests. It must not silently convert all factual attendance recording, immutable daily submission or weekly report preparation into new approval processes. Business decisions are required for those extensions.

NotificationService isolates notification failures using a savepoint and catches/logs errors while business work commits. Thus current behavior is best-effort in-app notification, not guaranteed delivery. For the required “Employee receives notification,” propose an idempotent durable decision/outbox strategy in a later authorized implementation, with retries, visible failures and privacy-safe payloads. Retain the current external-email blockade.

## 7. Proposed two-role architecture

1. Keep backed identifiers admin and worker. Remove Role::Foreman and all active Foreman role options only after the migration preflight confirms no remaining unhandled values.
2. Use explicit positive permissions: active Admin for administrative actions; active Employee plus ownership for self-service. Replace “not worker” and fallback “else means foreman” branches with exact intended roles.
3. Centralize company Employee visibility and personal ownership. Remove authorization derived from users.foreman_id; keep employee-site memberships independent.
4. Admin approval authority is mandatory under this requirement. Do not leave approval rights revocable or delegatable to an Employee through personal capability grants.
5. Preserve fresh role/status validation, last-active-Admin locks, session revocation, throttles, idempotency keys, conditional transitions and audit history.
6. Keep business invariants independent of authorization: full Admin access does not mean bypassing immutable raw evidence, frozen submissions or future closed periods.
7. Introduce versioned weekly payloads and neutral names (e.g. preparedBy/reviewerComments); read V1 snapshots through an adapter. Do not replace strings inside hashed historical JSON.
8. No automatic Foreman→Admin promotion. If a later preflight finds such accounts, an authorized owner chooses each account's target role and operational responsibilities; record an anonymized plan and approved mapping before execution.

## 8. Proposed permission matrix

“All” means company scope appropriate to the operation; “own” is server-filtered ownership, never a client-supplied user ID.

| Capability | Administrator | Employee |
| --- | --- | --- |
| Dashboard | Company review and approval queues | Personal status/history |
| User/role/account management | All; protect last active Admin | None; own profile/credentials only |
| Attendance registry | Company view and authorized future corrections | Own history and recording |
| Automatic/manual attendance, breaks, travel | Administrative oversight; no implicit employee impersonation | Own operations under existing rules |
| Schedule management | Create/version plans | Read own |
| Worksite registry/GPS/activation | All | No management |
| Site selection | Administration of memberships | Assigned active sites only |
| Leave/absence request | Company review/approve/reject | Own submit/status; no decision actions |
| Material requests | All review/decisions | Own submit/status |
| Daily reports/attachments | Review submitted company records | Own draft/submit and private attachment access |
| Weekly business reports | Prepare/close/archive/export/retry, pending scope decision | No administrative access |
| Existing monthly operational report/Excel/PDF | All | None |
| Company settings and GAV settings | All | None |
| Personal language/password/notification settings | Own plus authorized management | Own |
| In-app notifications | Own admin notices | Own request/decision notices |
| Every future SMGV function listed below | Exclusive access | Denied, including own SMGV administrative datasets |

Future SMGV exclusive functions: dashboard, Employee Basisblatt, monthly/annual reports, vacation balances, overtime compensation, manual corrections, monthly closing/reopening, historical imports, GAV settings, PDF and Excel exports.

## 9. Required application changes (future phase)

- Role enum, module scopes, policies, selectors, server validation, role-label catalogues and synthetic factories/tests must change together.
- LeaveService and LeaveApprovals require a real authority and state-machine change; changing the button alone is insufficient. Keep ownership and double-decision prevention.
- OrderService decisions must explicitly require a fresh active Admin, even if an individual grant exists. OrderConfigService currently matches role OR user_id, and the DB permits user grants without validating the user's role: no such Employee grants were found, but relying on UI grant restrictions alone is insufficient for the target architecture.
- Site permission delegation/overrides and team-scoped management must be removed. Employee memberships/GPS selection must remain.
- Weekly reports need Admin authoring and an agreed reporting population. Admin currently has no weekly-builder tab. Keep the functionality rather than deleting the weekly module.
- Monthly team filters span Livewire state, Blade links, controllers and service filters, not just a select element.
- Foreman dashboard class/view/catalogues can be retired after useful review widgets are consolidated into Admin. Employee “your Foreman” blocks and employee-directory manager filters/cards must go.
- Preserve existing spacing, typography, components, responsive behavior and colors. Remove only role-specific UI and its unused styles; no redesign is authorized.
- Update source comments/roadmap labels after implementation: some still say Admin is read-only for leave or monthly reports are “to come,” despite existing monthly code. Do not use comments as authority over actual implementation.
- Rebuild generated assets and compile views/routes in the future implementation phase; this audit did neither.

## 10. Potential database migration requirements

**A migration is required.** Application-only simplification would leave three allowed persisted roles, two Foreman grant rows, manager-specific schema and incompatible leave rejection constraints.

| Area | Minimum safe future operation | Preservation rule |
| --- | --- | --- |
| users role CHECK | Re-preflight actual users; tighten users_role_check to admin/worker after resolving every Foreman/unknown role | Never reset users or infer Admin promotion |
| Order grants | Targeted removal/retirement of the two role=foreman grants; preserve Admin mandatory authority; tighten grants_target_check to admin or reviewed neutral model | Snapshot/audit grants; check personal user grants too |
| User/site manager relations | Expand application to stop manager writes/reads, then remove obsolete FKs/indexes/columns in a later contract step | Preserve site memberships and any required historical relationship evidence |
| Weekly identity | Approved neutral preparer and company/site scope key, compatible FK/unique indexes and V2 payload reader | No loss/rewrite of closed rows, snapshot hashes or actor IDs |
| Leave decisions | If rejected is confirmed, add decision actor/time/reason representation; revise status/approval checks consistently | Existing approved_by/time history stays valid; prohibit impossible/self decisions |
| Notification types | Add approved rejection vocabulary to notifications_type_check and catalogue/enum/links together | Preserve old notifications and dedupe keys |
| Worksite permissions JSON | Retire Foreman role/user settings only through a reviewed targeted migration if any exist | Do not mass-clear unrelated company settings |
| Future SMGV | New effective-dated employee contract/basis, validated calendar/rules, ledgers, correction decisions, period closures, snapshots/export metadata | Separate later specification; not part of a role-removal migration |

Do not edit already-applied migrations to make existing installations appear migrated. Add forward migrations that produce the final two-role schema on both a fresh install and an upgraded RAMA schema. Historical migration files can retain the old role as migration history; it must not remain an available live role after the complete migration chain.

MariaDB DDL cannot be assumed to roll back as an ordinary application transaction. Prepare backup/recovery and ordered expand/backfill/switch/contract checkpoints only when implementation is authorized. The current empty operational tables make migration simpler, but must be rechecked at deployment. Existing integrity triggers remain enabled; design additive history/adjustments rather than disabling guards to backfill frozen data.

**If Foreman records appear later:** identify accounts as F001/F002 in review material, retain the approved actual-ID mapping privately, inventory all 25 user-FK relationships plus sessions/JSON payloads, preserve neutral historical actors, decide target role explicitly, resolve approval queues/weekly responsibility, revoke changed-role sessions and verify no orphaned references. No deletions, mappings or record changes were performed here.

## 11. SMGV Arbeitszeitkontrolle readiness matrix

The reference **smgv-zeitkontrolle-alle-2026.pdf was not found** in the RAMA project, current workspace or this request's attachment directory (which contains only Pasted text.txt). No PDF pages, fields, layout or hidden calculations were inspected. Search did not traverse Quality or unrelated personal directories. The client-described 14-page structure is a requirement, not a verified description of an available artifact.

| Capability | Status | Actual foundation / gap | Next requirement |
| --- | --- | --- | --- |
| Employee basic personal information | PARTIALLY AVAILABLE | users has name, email, phone, username, locale/status; no dedicated personnel/Basisblatt model | Confirm required PDF fields and privacy/minimization |
| Employment start/end dates | MISSING | users timestamps and schedules.valid_from/to are not employment dates | Effective employment periods including rehire/termination |
| Employment percentage | MISSING | No contract percentage/history fields | Effective-dated contractual percentage |
| Contractual weekly/yearly hours | MISSING | Schedules describe planned shifts, not an employment contract | Contract/rules effective dates and approved source values |
| Working schedules | AVAILABLE | worker_schedules: weekday, time, planned break, valid_from/to; ScheduleRules and Admin editor | Preserve versioning; validate use for SMGV target hours |
| Attendance event evidence | AVAILABLE | AttendanceSession/Event/Location, server identity, unique sequence/idempotency, immutable events | Keep evidence; resolve incomplete/open days explicitly |
| Break durations | AVAILABLE | DurationEngine separates breakMs from net work | Validate paid/unpaid treatment, thresholds and rounding later |
| Outbound/return travel | PARTIALLY AVAILABLE | TravelWorkflow/DurationEngine support legacy/dual/six-step profiles; journey metadata | Confirm counting/compensation and unknown legacy legs |
| Daily factual working hours | AVAILABLE | AttendanceSummaries and DurationEngine compute net event-based work | Define ledger/calculation version boundary |
| Weekly factual working hours | PARTIALLY AVAILABLE | DashboardService::hours aggregates week and day; weekly work reports summarize narrative reports, not contractual time | Dedicated weekly accounting reconciliation and target hours |
| Monthly factual working hours | AVAILABLE | MonthlyReportService/MonthlyEngine, daily detail and operational totals | Reuse facts without inheriting unvalidated accounting rules |
| Overtime and compensation | REQUIRES BUSINESS VALIDATION | compareDay computes actual−planned; positive daily variances summed, not offset by short days; no approved compensation ledger | Validated rules/categories, carry-forward and approval semantics |
| Vacation requests | REQUIRES REDESIGN | Simple leave date/comment flow needs Foreman; no rejection/category or holiday debit | Admin decisions, validated absence classification |
| Vacation balances/entitlements | MISSING | No entitlement, carry-forward, accrual or debit ledger; days() counts inclusive calendar days | Approved units and effective-year entitlement policy |
| Payroll public holidays | MISSING | holidays JSON belongs only to delivery_policies/DeliveryEstimator | Separate validated canton/employee calendar; never reuse delivery holidays as payroll facts |
| Absence categories/credited hours | MISSING | Approved leave flags dates; private_leave is a time interval, not typed sick/accident/etc absence accounting | Business categories, evidence and credit rules |
| Manual attendance entries | PARTIALLY AVAILABLE | Employee same-day back-entry with reason and entered/submission timestamps; no review/approval status | Decide review policy independently of correction workflow |
| Manual corrections | MISSING | Immutable events deliberately state corrections would be separate records; no correction entity/actions | Add requests, Admin decisions and append-only effective adjustments |
| Approval history | PARTIALLY AVAILABLE | Leave approved_by/at, immutable material history, AuditLog | Rejection/reason history; no general timesheet/correction approval ledger |
| Monthly closing/reopening | MISSING | Operational report is recomputed live; weekly closed status is unrelated | Admin-only period lock/version/adjustment/reopen policy |
| Historical reporting for inactive employees | REQUIRES REDESIGN | TeamScope Admin query includes only active workers; monthly report uses it | Period-aware population that includes former/suspended employees where applicable |
| Basisblatt | MISSING | No dedicated form, contract model or reference template | Obtain PDF; define exact fields, history and source-of-truth |
| January–December SMGV sheets | REQUIRES REDESIGN | Existing monthly PDF is an operational company summary, not the client's per-employee form | German fixed-layout templates and approved accounting model |
| Jahresübersicht | MISSING | No annual accounting/overview model or template | Year aggregation, carry-forward and reconciliations |
| Existing PDF generation | AVAILABLE | Dompdf, A4, DejaVu Sans, remote/PHP disabled, headers/footers and private downloads | Retain renderer; add explicit German report context and deterministic page boundaries |
| Existing Excel generation | AVAILABLE | PhpSpreadsheet monthly six-sheet workbook with formulas, input escaping and admin-only export | Build a separately specified SMGV workbook only if requested; existing export is not the unavailable original |
| 14-page complete annual PDF | MISSING | No Basisblatt+12 months+annual compositor or page-count contract | Implement pagination QA later after PDF supplied |
| Selected/all employee combined exports | PARTIALLY AVAILABLE | Company monthly data and per-employee detail exist; no annual batch composition | Authorized employee selection, private batch artifacts, bounded queue generation |
| German localization | PARTIALLY AVAILABLE | de catalogue/font support; current generic PDF uses viewer locale, Excel has legacy Albanian sheet names | Force German for SMGV independently of UI language; review all headings/months/number formatting |
| SMGV administrative authorization | MISSING | Existing monthly Admin checks are reusable patterns; no SMGV module/gate/policies/routes | Separate Admin-only authorization described below |
| GAV/SMGV calculation rules | REQUIRES BUSINESS VALIDATION | No validated rules/versioning; existing comments explicitly disavow payroll | Client-approved governing documents and specialist-validated examples |

Do not treat missing daily records as confirmed absence, approved leave as worked hours, schedule validity as employment duration, or an operational “COMPLETE” month as an approved/closed accounting period. Existing flooring to whole minutes and DST/overnight handling require reconciliation with the future approved report rules.

The requested complete report is Basisblatt + January through December + Jahresübersicht = **14 pages per employee when all months are included**. Future exports must separately support one month, annual overview, full employee, selected employees and all employees. None is represented as completed by this audit. No GAV formula or regulatory-compliance claim is made.

## 12. Security and privacy considerations / future SMGV authorization

- Add an explicit SMGV module/gate with only active Admin allowed. A future auth/active/SMGV route group must cover dashboard, employee basis, months/year, balances, compensation, corrections, closing, imports, rules and both export types. Do not reuse module:reports alone: Employees legitimately access their own existing reports.
- Provide object/action policies (e.g. basis view/update, period view/close, correction decide, import execute, export create/download). Deny Employees even for their own SMGV administrative identifier.
- Enforce authorization in controllers, every Livewire action/update/render/load path, service entry points and queued jobs at execution; do not rely on a hidden tab or mount-only check. Resolve active role freshly when mutating/exporting.
- Query allowed company/employee/period records server-side; validate nested employee/period/export IDs, bulk arrays, pagination and filters. User-provided prepared_by/approver/user_id must never determine the actor.
- If exports are queued later, retain owner/context, recheck permission when executing/downloading, keep artifacts in private storage, prevent public predictable URLs and expire/revoke access on account changes. URLs/signatures alone do not replace policy checks.
- Audit decisions, overrides, closure/reopen and exports with minimal actor/action/period metadata; exclude credentials, GPS coordinates, report bodies and personal medical narratives from audit logs.
- Maintain append-only raw evidence and versioned report snapshots. Avoid a blanket Admin override that bypasses domain finality.
- Preserve session/cache/storage/database isolation and the external-delivery blockade. Read-only inspection used only RAMA's existing configured connection; no shared grants were inspected or changed during this audit. The prior clone report's inherited PUBLIC-grant exception remains an earlier documented limitation, not a new authorization to alter the server.
- Prefer strong interactive Admin onboarding; existing general PasswordPolicy allows six-character credentials, while onboarding requires twelve. Review this mismatch as a separate security policy decision; no password was read into this report or changed.
- User-role casts fail on unsupported strings; eliminate unhandled legacy values before deploying the reduced enum.
- Current RamaIsolationTest reads Quality's key file locally. It was inspected statically only. Future isolation regression must use synthetic keys rather than touching Quality.
- No external sources or regulatory interpretations were required or used: readiness statements are findings about this repository/schema.

## 13. Risk assessment

| Risk | Severity | Evidence / mitigation |
| --- | --- | --- |
| No eligible leave submitter/approver after naive removal | Critical | LeaveService active Foreman prerequisite and approve guard; change entire transaction/UI/constraints and test |
| Loss of weekly reporting | Critical | Foreman-only builder + mandatory FK + NO_TEAM; agree scope, implement Admin authoring and V1 archive adapter |
| Employee gaining decision rights | Critical | Generic personal grants/negative-role guards; enforce explicit fresh Admin checks and reject forged identifiers |
| Orphaned or rewritten history | Critical | 25 user FKs; frozen weekly snapshots and append-only actors; keep identities and additive transitions |
| Invalid rejected-state rollout | High | Leave/status/notification CHECKs lack rejection; coordinate code/DDL and nullability invariants |
| Dropped assigned-site access | High | Manager relation and worksite_user are different structures; preserve pivot memberships/GPS workflow |
| False SMGV/GAV confidence | Critical | Reference PDF absent; rules and employment/entitlement/closing data absent; no compliance claims |
| Historical employees omitted | High | TeamScope filters active workers; create period-aware SMGV population |
| Old UI/notifications imply an approver that no longer exists | High | 24 language files, payload keys, sidebar and components; bilingual regression and compatibility reader |
| Notifications lost despite successful decisions | High | Savepoint/caught errors and preference filtering; durable decision delivery/retry design |
| Partial MariaDB migration | High | DDL implicit commits and restrictive constraints; staged preflight, recovery and fixture rehearsal |
| Unrelated Quality/server change | Critical | Maintain target-only commands and identity guards; never run legacy cross-source tests in this phase |

## 14. Regression testing strategy (planned, not executed)

No tests were run during this audit because even synthetic integration suites write records/schema and some inherited tests read Quality. Existing tests were inspected as specifications to change, not counted as current passing results.

| ID | Required future tests and existing starting points |
| --- | --- |
| T1 — role/authorization | RoleAccessTest (currently asserts exactly three and original matrix), UserPolicy, every module/direct URL, forged role=foreman, suspended/revoked sessions, forged Livewire hydration/action IDs; exactly two enum/persisted roles |
| T2 — users/navigation/UI | WorkersDirectoryTest, EmployeeManagementUiTest, AdminDashboardTest, DashboardPresentationTest, GlobalSidebarTest, auth/profile/localization; Admin manages both roles, last-Admin protected, Employee no directory, no manager selectors, two dashboard variants, sq/de responsive layouts |
| T3 — leave/absence | LeaveTest currently proves Admin cannot approve and no-Foreman submission fails: replace with Admin positive/Employee negative cases, pending→approve/reject, no-Admin handling, own history, immutable decision actor/time/reason, concurrency/idempotency and no automatic hour/balance effects |
| T4 — material decisions | OrdersTest, OrdersUiTest, OrderDecisionsDefaultTest, DashboardOrderPopupTest; Admin always decides, Employee never decides even with injected personal grant, own visibility, terminal/stale transition races, counter uniqueness, history and notifications |
| T5 — daily/weekly/attachments | DailyReportsTest/Ui, WeeklyReportsTest/Ui, ReportPdfTest, WeeklyDomainTest; Admin authoring and agreed population, Employee own draft/submit only, draft privacy, one close/snapshot/delivery, old V1 payload hash stable, no source record mutation, private attachment/download ID tampering |
| T6 — notifications | NotificationsTest, NavigationCountsTest; request→Admins, decision→owner, inactive/demoted recipients excluded, dedupe, queue counters, rejection type and deep-link reauthorization; simulate delivery failure/preference suppression explicitly |
| T7 — sites/assignment | WorksiteManagementTest, WorksiteSelectionTest, WorkerScanningFlowTest, DemoWorksiteDeletionTest; Admin-only management, no delegation endpoint, preserve memberships, active/authorized site selection, forged site/employee IDs, GPS and revocation |
| T8 — factual time/history | AttendanceFlowTest, AttendanceHistoryTest, AttendanceUiTest, ManualAttendanceTest, RepeatedBreaksTest, SixStepTravelTest, ReturnTravelTest, DurationEngineTest, BusinessCalendarTest, SchedulesTest; event order/replay, same-day/manual submission evidence, DST/overnight, travel splits, missing ends, versioned plans |
| T9 — reporting/artifacts | MonthlyReportTest, MonthlyEngineTest, ReportPdfTest and frontend timer/GPS tests; unchanged factual totals, removed manager filter, formula injection/escaped text, German glyphs, future 14-page contract, selected/all employee counts, inactive/historical employees |
| T10 — SMGV isolation (new later) | Every SMGV route/action/export/import/setting/closing denied to Employee, including own IDs; direct URLs/API-like requests/Livewire actions and manipulated bulk IDs; jobs/downloads reauthorize after Admin revocation |
| T11 — migrations/history | DatabaseIntegrityTest, schema fixtures and synthetic upgrade fixtures with anonymized Foreman accounts, active/archived relations, overlapping historical weekly scopes, closed snapshots and pending requests; fresh install=upgraded final schema; checks/FKs/triggers preserved; no enum-cast crash |
| T12 — project/privacy isolation | Synthetic-key connection/session/cache/filesystem/outbound safeguards; tests only rama_workforce_laravel_test or guarded SQLite :memory:; no reads/writes to Quality and no shared-grant/server operations; no default accounts or credential leaks |

Keep retired-role fixtures only in a dedicated synthetic legacy-upgrade test harness, not as a third runtime role/factory option. Do not delete old tests wholesale: replace Foreman approvals with Admin assertions while retaining unauthorized-peer, history and concurrency coverage.

## 15. Proposed implementation sequence

1. Obtain explicit approval for a **two-role implementation phase only**, decide weekly scope, rejection semantics, no-active-Admin behavior, and whether manual/day-report review changes are required.
2. Re-run RAMA-only read-only preflight and privately inventory any new records; agree data mapping/recovery. Preserve the sole active Admin and prohibit automatic promotion.
3. Add synthetic legacy-upgrade and two-role acceptance specifications in the isolated test environment; refactor cross-source isolation tests first.
4. Prepare forward expand migrations for decisions/neutral weekly ownership and required CHECK changes. Design compatibility readers for old records; do not rewrite snapshots.
5. Change authorization/scopes/services, Admin approval workflows and weekly authoring coherently; keep raw Employee operations stable.
6. Change Livewire actions, controllers, forms/navigation/catalogues and permission configuration in the same controlled release. Retain the visual system.
7. Rehearse on synthetic schemas, including partial-migration recovery and old data. Verify fresh-install/upgraded equivalence and report reconciliation.
8. Once approved for actual application data, apply targeted transitions/migrations, revoke changed-role sessions and verify zero live Foreman roles/grants/callers. No blanket reset or truncate.
9. Contract unused manager columns/delegation structures only after code/payload readers and archived history are safe. Keep required immutable triggers.
10. Produce an implementation validation report. Begin SMGV specification only after receiving the PDF and business rules; design/calculation implementation/export rendering remains a separate approval.

No step above was started by this audit.

## 16. Unresolved business requirements

- Supply the reference PDF. Confirm exact Basisblatt fields, month/year form versions, signature fields, units, blank-month behavior and page layout; no original workbook/formulas are available.
- Confirm weekly narrative reporting: retain it as company-wide, by worksite or another explicit reporting scope? One report per Admin is not automatically the same as one report per company/week.
- Define vacation/other absence categories, reject/cancel/withdraw/reopen semantics, required reasons, notification obligations and behavior when no active Admin exists.
- Does “full administrative access” include reading private drafts? Current behavior protects them; preserve that until explicitly changed.
- Are Employee manual entries reviewed before affecting accounting? Are submitted daily reports approved or only reviewed? Existing functionality does not implement those approvals.
- May the owner/Admin also register personal time or submit requests? Current recording/submission is Worker-only; do not create a third role to solve this.
- Confirm material rejection versus existing cancellation; avoid changing terminal business states only for wording.
- Confirm employment periods/percentage, contractual targets, applicable calendar/holidays, absence credits, travel/break treatment, rounding, overtime categories/compensation, carry-forward and governing validated rule sources. No values are inferred.
- Define monthly closure/reopening authority, late corrections, snapshot versioning, historical imports/reconciliation and retention.
- Confirm reporting for terminated/suspended/rehired employees and how effective periods intersect years/contract changes.
- Confirm combined-export ordering, employee selection limits, expected scale, German output details and whether a separate SMGV Excel output is actually required.
- Review existing account password policy and previous shared-server PUBLIC-grant exception separately; this audit authorizes neither credential changes nor shared privilege changes.

## 17. Confirmation of Quality Workforce isolation

All project reads and database metadata/count queries in this phase targeted RAMA. No Quality directory or database was opened, no Quality HTTP request was sent, and no Quality migration/Artisan/test command was executed. The Quality path was identified only from the supplied boundary and a static string already present inside a RAMA test. That test was not executed.

No database records/schemas, shared MariaDB privileges, shared server configuration, services or application source files were modified. The read-only database session rolled back normally. Environment values were used in memory solely to authenticate to the verified RAMA identity and were never printed in this report. No employee/business data was copied to another application.

The final verification record below documents source-file hash comparison and the single permitted report artifact. Git was not staged/committed and no implementation files were created.

## 18. Final recommendation

**Audit complete; implementation remains pending explicit approval.** RAMA is not yet a two-role application. The existing Foreman role must remain untouched in this phase.

Proceed next with a scoped two-role migration/application change, resolving the critical leave and weekly authoring dependencies together and preserving evidence. Do not bundle an unvalidated SMGV calculation engine into role cleanup. The missing PDF and business rules block SMGV layout/formula specification, but do not prevent a carefully specified Administrator–Employee architecture.

The report appendices provide the actionable per-file inventory and preservation requirements. Stop here and await the owner's explicit authorization before any implementation, migration or data transition.

## Appendix A — Complete direct dependency register (126 files)

All evidence lines below refer to the audited source; each row records the required change, not an implemented edit. Per-language catalogue rows are separate because both translations must change together. Historical comments/pure helpers are explicitly distinguished from executable permissions.

### A.1 Application classes (41)

| File and evidence lines | Class/component | Current behavior | Associated permission | Proposed future behavior | Required modification | Risk | Regression |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `app/Enums/AppModule.php`:30–38 | `App\Enums\AppModule` | Eight modules map Admin=all, Foreman=team/own, Worker=own/none; team navigation labels. | module gate | Two-role module matrix; separate admin-only SMGV gate. | Remove foreman branches; add SMGV only in its later phase. | Critical | T1,T10 |
| `app/Enums/NotificationType.php`:64 | `App\Enums\NotificationType` | Role-specific preference switches; weekly/leave vocabulary has no rejection type. | Notification preferences | Two-role preferences and approved/rejected request events. | Remove Foreman arm; define rejection type with DB constraint migration. | High | T6 |
| `app/Enums/Role.php`:9, 12 | `App\Enums\Role` | Three backed cases: admin, foreman, worker; uppercase catalogue keys. | All role checks | Exactly admin and worker; keep employee labels. | Remove Foreman only after data preflight; retain stable IDs. | Critical | T1 |
| `app/Livewire/AttendanceOverview.php`:21, 50 | `App\Livewire\AttendanceOverview` | Admin/Foreman scoped worker history; only Admin sees coordinates. | Attendance module + scopedWorkers | Admin overview; Employee own history elsewhere. | Remove Foreman branch through scopes; preserve sensitive coordinate restriction. | High | T8,T10 |
| `app/Livewire/ForemanDashboard.php`:10–11, 15, 18, 25, 31, 43 | `App\Livewire\ForemanDashboard` | Dedicated role guard, polling revision and Foreman service render. | Foreman dashboard only | No Foreman component registration/use. | Retire class after moving required Admin widgets and removing Blade caller. | High | T2,T10 |
| `app/Livewire/LeaveApprovals.php`:14, 55, 93 | `App\Livewire\LeaveApprovals` | Admin may list/open; askApprove(), render canApprove and service approve require Foreman. | Leave module plus Foreman decision | Admin confirmation and approve/reject; Employee denied reviewer actions. | Guard every action with fresh active Admin; add reject and stale/double-decision handling. | Critical | T3,T10 |
| `app/Livewire/OrderSettings.php`:120 | `App\Livewire\OrderSettings` | Admin controls policies and grants; people includes Admin and Foreman. | Admin settings | Admin policy settings; no Foreman/Employee decision delegation. | Restrict/remove capability selector; decisions fixed to Admin per confirmed requirement. | High | T4 |
| `app/Livewire/OrdersExplorer.php`:18 | `App\Livewire\OrdersExplorer` | Own/team/all view and capability-dependent status confirmation. | Orders module and status capability | Employee own registry; Admin review/decisions. | Retain UI/filters; ensure confirm() cannot confer Employee decision rights. | High | T4,T10 |
| `app/Livewire/ScheduleOverview.php`:11 | `App\Livewire\ScheduleOverview` | All allowed roles read a scoped schedule overview; Foreman in comment. | Schedules module | Admin all and Employee own. | Keep component; update role scopes/comment, no plan-edit rights for Employee. | Medium | T8 |
| `app/Livewire/TeamDailyReports.php`:13, 54 | `App\Livewire\TeamDailyReports` | Non-worker scoped review; only submitted report detail. | Reports module + TeamScope | Admin review across employees; no Foreman team screen. | Rename neutral component if useful; explicit Admin guard and source scopes. | High | T5 |
| `app/Livewire/WeeklyReportBuilder.php`:15, 23, 33, 36, 43, 74, 80, 107, 132, 146, 154 | `App\Livewire\WeeklyReportBuilder` | foreman() guard, public texts.foremanComments, draft/close/retry calls. | Foreman + reports module | Admin weekly preparer UI without Employee access. | Replace guards/payload keys in all actions, not just mount; preserve limits/finality. | Critical | T5,T10 |
| `app/Livewire/WeeklyReportsList.php`:12 | `App\Livewire\WeeklyReportsList` | Admin all/Foreman own via snapshot service; open/retry actions. | Non-worker reports | Admin-only weekly archive/retry. | Use explicit Admin guard and neutral authors; keep snapshot access checks. | High | T5,T10 |
| `app/Livewire/WorkerLeave.php`:15 | `App\Livewire\WorkerLeave` | Employee own submit/history; service fails NO_FOREMAN; no rejection display. | Worker leave module | Own requests with Admin status updates. | Keep actor server-derived; replace manager messaging and show rejection reason/state. | High | T3 |
| `app/Livewire/WorkersDirectory.php`:15, 36, 81, 114, 123, 159, 168 | `App\Livewire\WorkersDirectory` | Admin manages three-role form, foremanId hydration/save; Foreman read-only directory. | workers module + adminActor | Admin two-role directory; Employee no directory, own profile kept. | Remove foremanId transport/selectors and invalid-role inputs; keep server mutation guards. | High | T2,T10 |
| `app/Mail/WeeklyReportMail.php`:24 | `App\Mail\WeeklyReportMail` | Subject and body read payload.foreman; no queued job interface. | Authorized weekly snapshot delivery | Admin-authored V2 payload plus legacy V1 reader; sending stays disabled. | Adapt payload presentation only; preserve snapshot truth and outbound safety. | High | T5,T12 |
| `app/Models/LeaveRequest.php`:8 | `App\Models\LeaveRequest` | pending/approved model, approvedBy FK and inclusive calendar-day count. | Leave approval/history | Admin decision; retain historical actor IDs. | Add rejection decision model after workflow sign-off; do not treat days() as vacation debit. | High | T3,T11 |
| `app/Models/User.php`:20, 51, 53, 61–62, 64, 67, 70 | `App\Models\User` | Role enum cast, fillable foreman_id, isForeman(), foreman()/team() relations. | Account identity and team scope | Two roles; employees independent of a foreman. | Remove live role helpers/assignment writes; contract legacy fields later. | Critical | T1,T2,T11 |
| `app/Models/WeeklyTeamReport.php`:11, 44, 46 | `App\Models\WeeklyTeamReport` | Required foreman relation; closed rows guarded against update/delete. | Weekly report ownership/finality | Admin-prepared weekly business report with historical snapshot support. | Introduce neutral preparer relation/versioned schema; preserve frozen records. | Critical | T5,T11 |
| `app/Models/Worksite.php`:20, 23, 25 | `App\Models\Worksite` | foreman_id integer cast and foreman relation alongside worker memberships. | Worksite management scope | Admin manages; authorized employees select assigned sites. | Retire manager-role association; preserve worksite_user and historical metadata. | High | T7,T11 |
| `app/Policies/UserPolicy.php`:10–11, 17, 24 | `App\Policies\UserPolicy` | Admin/Foreman viewAny; Foreman views self/assigned users; Worker self. | UserPolicy viewAny/view | Admin directory; Employee personal data only. | Replace team branch with explicit Admin/Employee policy decisions. | Critical | T1,T2 |
| `app/Services/DailyReportService.php`:24, 188, 206 | `App\Services\DailyReportService` | Worker drafts/submits; Admin/Foreman sees submitted reports only within TeamScope; submission emits team notifications. | Daily report read/write/attachments | Employee own draft/submit; Admin company review; drafts remain private. | Repoint reviewer recipients and two-role scope; retain submitted-report finality. | High | T5,T6 |
| `app/Services/DashboardService.php`:121, 126, 128, 208 | `App\Services\DashboardService` | Admin and Foreman variants; Foreman team KPIs; closed weekly eager-loads foreman relation. | Dashboard/scoped operational data | Admin consolidated review, Employee own dashboard. | Retire foreman(); retain useful review widgets under Admin and replace legacy author relation. | High | T2,T5,T6 |
| `app/Services/LeaveService.php`:19–20, 43, 70, 88–90, 103, 132–133, 135–136, 140, 145, 160 | `App\Services\LeaveService` | Submission requires active Foreman; only current assigned Foreman approves; Admin read-only; no reject. | Leave submit/approve/scope | Employee submits directly to active Admin reviewers; Admin approve/reject. | Replace NO_FOREMAN prerequisite and both team predicates; add decision states/audit/notification atomically. | Critical | T3,T6,T11 |
| `app/Services/MonthlyReportService.php`:52, 86, 95 | `App\Services\MonthlyReportService` | Admin-only report; active-worker source selects foreman_id/teamId; team filters; approved leave only flags dates. | Monthly reports/export | Admin reports by Employee/period; no Foreman filter; historical employment included. | Remove team selection/filter coupling; separate future SMGV period model from live worker selector. | High | T8,T9,T10 |
| `app/Services/NavigationCounts.php`:14 | `App\Services\NavigationCounts` | Fresh Admin/Foreman sees pending orders/leave counts; Employee zero. | Navigation review badges | Admin badges; Employee no review queue counts. | Use Admin-only test; recompute after decisions without widening data scope. | Medium | T2,T6 |
| `app/Services/NotificationService.php`:41, 44, 46–47, 54, 62–64, 245 | `App\Services\NotificationService` | Admin+own Foreman recipient resolvers; leave differs at emitter; deep links recheck role/team; preference filtering and savepoint isolation. | Notification routing/read/links | Requests notify Admins; decisions notify owner; archived-role links remain safe. | Remove role-derived recipients/team branches; add rejection links and decide guaranteed in-app decision delivery. | High | T3,T4,T6 |
| `app/Services/OrderConfigService.php`:79–80, 94, 100 | `App\Services\OrderConfigService` | Role/user grants accept Admin/Foreman; hasCapability trusts matching role OR individual grant. | Order grants and delivery-policy settings | Every active Admin has required decisions; no Employee decision grants. | Remove Foreman targets and delegatable approval UI; explicit Admin guard, reviewed legacy grant cleanup. | Critical | T4,T11 |
| `app/Services/OrderService.php`:24, 49, 259 | `App\Services\OrderService` | Worker creates; Foreman team/Admin all/Worker own; decisions depend on capability grants and terminal transitions. | accept_order, cancel_order | Employee submits; Admin exclusively decides; own visibility preserved. | Require fresh active Admin for decisions; remove team scope; preserve counters/history/idempotency. | Critical | T4,T6 |
| `app/Services/ScheduleService.php`:18 | `App\Services\ScheduleService` | Only Admin edits versioned plans; visible workers come from TeamScope. | Schedule manage/read | Admin edits; Employee reads own historical plans. | Keep save rules; remove obsolete team description/scope dependency through TeamScope. | High | T8 |
| `app/Services/TeamScope.php`:10–11, 20 | `App\Services\TeamScope` | Central queries: active workers all/team/self based on role. | Record-level visibility | Admin all employees; Employee only self. | Remove Foreman branch; use separate period-aware employee selector for historical SMGV. | Critical | T1,T8,T10 |
| `app/Services/UserManagement.php`:14, 29–30, 35–36, 38, 62, 68, 113, 145, 151–153, 199, 253–254, 256, 259–261, 264 | `App\Services\UserManagement` | Admin mutations; team lists; validates active foreman assignment; demotion/archive clears assignments and revokes sessions. | Manage accounts; last-admin protection | Admin manages two roles without manager assignment. | Remove foremen()/foremanFor() and team mutation paths; keep lockout/session/history protections. | Critical | T2,T11 |
| `app/Services/WeeklyDeliveryService.php`:130–131, 135 | `App\Services\WeeklyDeliveryService` | Failed delivery targets Admins plus weekly foreman_id; durable delivery claim/retry. | Weekly delivery/retry | Admin recipients and neutral preparer; no employee administration. | Replace Foreman recipient field; retain Phase-01 outbound blockade and deduplication. | High | T5,T6,T12 |
| `app/Services/WeeklyReportService.php`:23, 29, 33, 36, 67–68, 70, 87, 93, 100, 104, 116, 118–120, 141, 144, 149, 151, 168, 172, 176, 184, 187, 192, 198, 200, 213, 220–221, 224, 230, 236 | `App\Services\WeeklyReportService` | requireForeman blocks Admin builder; team membership uses users.foreman_id; snapshot schema=1 contains foreman/foremanComments; closes once. | Weekly build/close/read/retry | Admin builds/closes retained weekly workflow; Employee cannot administer. | Change author/scope/unique semantics after business choice; introduce V2 snapshots and legacy read adapter. | Critical | T5,T11 |
| `app/Services/WorksiteAccess.php`:21, 43, 61, 80, 83, 88, 94–95, 97, 99, 106–107 | `App\Services\WorksiteAccess` | Admin always allowed; configurable Foreman role/user overrides scoped to assigned worksites; readiness requires foreman_id. | create/edit/assign/gps/activate | Admin-only site administration; Employee selection separate. | Remove Foreman overrides and old-column readiness coupling; preserve fresh role/status checks. | High | T7,T11 |
| `app/Services/WorksiteManagement.php`:57, 63, 69, 81, 85–88, 98, 101, 113 | `App\Services\WorksiteManagement` | Validates active Foreman, auto-assigns Foreman creator, restricts team employee assignments; admin demo deletion. | Worksite capabilities | Admin CRUD/assignments; Employee retains authorized selection. | Remove foreman input/group checks and creator autofill; keep GPS/assignment validation and history. | High | T7 |
| `app/Support/NotificationText.php`:18 | `App\Support\NotificationText` | Template substitution includes foreman payload key. | Notification text compatibility | Neutral preparer/administrator labels with legacy payload reader. | Version new payload keys; do not rewrite archived params blindly. | Medium | T6,T11 |
| `app/Domain/Reports/WeeklyAggregator.php`:77–78 | `App\Domain\Reports\WeeklyAggregator` | Pure aggregation of submitted daily reports; foreman appears only in explanatory comments. | Caller-provided report scope | Retain pure aggregation, Admin supplies selected membership. | Update terminology/comments; do not delete pure report functionality. | Low | T5 |
| `app/Http/Controllers/PageController.php`:25, 29–30 | `App\Http\Controllers\PageController` | Role match dispatches three dashboard variants; counts Foremen; Employee loads foreman relation. | module:dashboard/settings | Two variants; Admin company review, Employee own view. | Remove Foreman dispatch/count and employee manager lookup. | High | T1,T2 |
| `app/Http/Controllers/ReportAttachmentController.php`:12 | `App\Http\Controllers\ReportAttachmentController` | Private attachments owner any state; non-worker submitted only within team scope. | Attachment record authorization | Employee own files; Admin submitted report files. | Retain private storage/key guards; rely on new explicit two-role scopes. | High | T5,T10 |
| `app/Http/Controllers/ReportPdfController.php`:17–18 | `App\Http\Controllers\ReportPdfController` | Daily scoped read; weekly closed snapshot owner/Admin read; monthly admin with team query filter; audits downloads. | module:reports + service scopes | Employee own daily PDF; Admin weekly/monthly and future SMGV exports. | Remove team parameter and replace weekly payload dependency; add separate SMGV policies later. | High | T5,T9,T10 |
| `app/Http/Controllers/WorksiteController.php`:26, 42, 46, 49, 70–71, 73 | `App\Http\Controllers\WorksiteController` | Foreman eager-load/filter, Admin Foreman selector, manager-scoped edit, Foreman permission endpoint. | WorksiteAccess + active/auth routes | Admin management only; Employee selection through existing worker components. | Remove permission delegation endpoint/selector and foreman query binding after service change. | High | T7,T10 |

### A.2 Database migrations and factory (8)

| File and evidence lines | Class/component | Current behavior | Associated permission | Proposed future behavior | Required modification | Risk | Regression |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `database/factories/UserFactory.php`:41, 43 | `Database\Factories\UserFactory` | foreman() factory returns Role::Foreman. | Synthetic test fixture only | Two runtime role factories; legacy upgrade fixtures separate. | Replace role-dependent fixtures after new code/migrations are testable. | High | T1,T11 |
| `database/migrations/0001_01_01_000000_create_users_table.php`:31–32, 45 | `anonymous Migration::up/down` | Creates users.foreman_id FK and three-role CHECK. | Database role integrity/team assignment | Final migrated users allow exactly two roles. | Keep applied file immutable; add forward CHECK/relationship migration. | Critical | T1,T11 |
| `database/migrations/2026_11_09_140000_create_weekly_report_tables.php`:12, 24, 30, 35 | `anonymous Migration::up/down` | Creates mandatory Foreman FK/weekly unique key, snapshots and frozen triggers. | Weekly identity and finality | Neutral Admin preparation and legacy preserved history. | Add forward weekly schema transition; do not remove finality triggers. | Critical | T5,T11 |
| `database/migrations/2026_11_09_150000_create_leave_requests_table.php`:10 | `anonymous Migration::up/down` | Documents Foreman approval; creates only pending/approved and approval metadata checks. | Leave decision integrity | Admin decisions and an explicitly approved rejected representation. | Forward decision/CHECK migration; preserve old approval rows. | Critical | T3,T11 |
| `database/migrations/2026_11_09_160000_create_material_order_tables.php`:86, 104 | `anonymous Migration::up/down` | Creates admin/foreman grant CHECK, generated unique grant_key and order/history triggers. | Order capabilities and immutable evidence | Admin-only decisions; preserve order states/history unless agreed otherwise. | Targeted forward grant/CHECK migration; keep counters and history. | Critical | T4,T11 |
| `database/migrations/2026_11_10_090000_grant_foremen_order_decisions.php`:7–8, 16, 22 | `anonymous Migration::up/down` | Seeds Foreman accept_order/cancel_order role grants. | Order decision defaults | No live Foreman grants. | Keep historical migration; new forward migration retires only obsolete grants with audit. | High | T4,T11 |
| `database/migrations/2026_11_10_100000_grant_admins_order_decisions.php`:7 | `anonymous Migration::up/down` | Seeds Admin decision grants; comment compares Foreman role. | Admin order approvals | Retain mandatory active-Admin authority. | Preserve history/default; prevent later UI from leaving no authorized Admin. | High | T4,T11 |
| `database/migrations/2026_11_21_100000_create_worksites_and_permissions.php`:28, 37 | `anonymous Migration::up/down` | Creates worksite Foreman FK/index, JSON permissions and independent employee pivot. | Site capability/scope integrity | Admin management; memberships independent. | Forward expansion/contract only; never drop employee pivot as part of role removal. | High | T7,T11 |

### A.3 Templates, JavaScript and styles (23)

| File and evidence lines | Class/component | Current behavior | Associated permission | Proposed future behavior | Required modification | Risk | Regression |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `resources/css/admin-reference.css`:1 | `admin-reference.css` | Comment mentions Foreman; no role permission logic. | None (styling) | Retain existing Admin visual design. | No functional removal; optional terminology cleanup. | Low | T2 |
| `resources/css/employee-management.css`:46 | `employee-management.css` | em-role-foreman badge style. | Display only | Only Admin/Employee badges. | Remove unused Foreman selector after templates change. | Low | T2 |
| `resources/js/employee-management.js`:7, 12, 14, 20, 23, 62, 67 | `employee-management.js` | foremanFilter/data-foreman and foremanId form signature/errors. | Client filter/form only; server controls authorization | No Foreman filter or manager field. | Remove state/watchers/data binding; preserve pagination, errors and modal unsaved changes. | Medium | T2 |
| `resources/views/reports.blade.php`:6 | `reports.blade.php` | Foreman tabs include weekly builder; Admin tabs only daily/closed/monthly. | Reports module; component guards | Admin gets retained weekly authoring; Employee own daily report. | Two-role tab composition after weekly service redesign. | High | T5,T10 |
| `resources/views/schedules.blade.php`:5 | `schedules.blade.php` | Foreman gets titleTeam; Admin manages, Employee own. | Schedules module | Admin/own titles only. | Remove Foreman title branch; retain responsive editor/overview. | Low | T2,T8 |
| `resources/views/components/global-sidebar.blade.php`:13 | `global-sidebar.blade.php` | Module links derive matrix; review counts shown Admin or Foreman. | Module Gate; WorksiteAccess; queue count scope | Admin review badges and sites; Employee own links; no SMGV employee link. | Update canCount and new module visibility; keep persisted identity/role scope. | High | T1,T2,T10 |
| `resources/views/dashboard/foreman.blade.php`:2 | `foreman.blade.php` | Renders dedicated ForemanDashboard. | Dashboard role dispatch | No Foreman page/component. | Remove only after PageController caller and Admin widgets are handled. | Medium | T2 |
| `resources/views/dashboard/_orders-panel.blade.php`:1 | `_orders-panel.blade.php` | Reusable order panel referenced by Foreman dashboard; comment names role. | Service-scoped orders | Retain useful Admin order review functionality. | Move/reuse only if needed; remove orphan include after caller check. | Medium | T2,T4 |
| `resources/views/emails/weekly-report-text.blade.php`:3, 5 | `weekly-report-text.blade.php` | Plain-text mail uses same V1 Foreman fields. | Authorized weekly delivery; currently blocked outbound | Same content/security as HTML and V2 adapter. | Update parallel text view and placeholders. | High | T5,T12 |
| `resources/views/emails/weekly-report.blade.php`:9, 11, 14 | `weekly-report.blade.php` | HTML mail interpolates Foreman and foremanComments from final payload. | Authorized weekly delivery; currently blocked outbound | Neutral Admin-preparer presentation with V1 compatibility. | Adapt keys/translation placeholders, preserving authored text and outbound blockade. | High | T5,T12 |
| `resources/views/livewire/admin-dashboard.blade.php`:163 | `admin-dashboard.blade.php` | Weekly archive displays relation foreman name. | Admin dashboard | Show neutral report preparer/history. | Use versioned author relation/label without rewriting snapshots. | Medium | T2,T5 |
| `resources/views/livewire/foreman-dashboard.blade.php`:17–18, 25–28, 44–45, 48, 51, 55, 63, 71–72, 75, 78–80, 84, 87, 94–95, 100, 106, 113–114, 116, 130 | `foreman-dashboard.blade.php` | Complete Foreman team KPIs, reports and order actions. | ForemanDashboard role guard | No third-role dashboard. | Consolidate required review functions into Admin before retirement. | High | T2,T4,T5 |
| `resources/views/livewire/order-settings.blade.php`:37 | `order-settings.blade.php` | Role checkboxes explicitly admin/foreman and personal decision grants. | Admin order settings | No Foreman/Employee delegation; mandatory Admin decisions. | Remove obsolete grant controls; retain delivery policy form. | High | T4 |
| `resources/views/livewire/weekly-report-builder.blade.php`:6, 27, 69–70 | `weekly-report-builder.blade.php` | Displays payload foreman and foremanComments editor. | Weekly builder guard | Neutral Admin preparer/comments. | Update binding/labels with V2 service contract and legacy reader. | High | T5 |
| `resources/views/livewire/weekly-reports-list.blade.php`:21, 38, 47–48 | `weekly-reports-list.blade.php` | Reads foreman relation and V1 payload/comments. | Closed weekly report scope | Admin archive with neutral author labels and legacy compatibility. | Adapt relationship/payload rendering; retain frozen text. | High | T5,T11 |
| `resources/views/livewire/workers-directory.blade.php`:19, 26, 29 | `workers-directory.blade.php` | Manager/team filter, data-foreman rows and relation column. | Admin management / Foreman read list | Admin two-role employee registry. | Remove manager filter/data/column and keep existing responsive component layout. | Medium | T2 |
| `resources/views/livewire/_employee-dashboard.blade.php`:8 | `_employee-dashboard.blade.php` | Personal header displays assigned Foreman. | Employee dashboard | Own dashboard without required manager. | Remove manager line; preserve clocks, schedules and own actions. | Medium | T2,T8 |
| `resources/views/livewire/_employee-modal.blade.php`:4, 29–30, 33, 44 | `_employee-modal.blade.php` | Three role cards, Foreman dropdown and FOREMAN_INVALID field mapping. | Admin employee mutation | Exactly two role options; no manager input. | Remove role card, binding, error mapping, selector together with backend. | High | T2 |
| `resources/views/pdf/weekly.blade.php`:10, 32–34 | `weekly.blade.php` | V1 payload.foreman and foremanComments in weekly PDF. | Authorized closed report download | Neutral preparer labels; historical content unchanged. | Read both payload versions; no snapshot rewriting. | High | T5,T9,T11 |
| `resources/views/worksites/edit.blade.php`:26–27 | `edit.blade.php` | Admin can select active Foreman assigned to site. | Worksite assign capability | Admin employee-site membership editor without manager role. | Remove Foreman select; preserve worker IDs and GPS forms. | High | T7 |
| `resources/views/worksites/index.blade.php`:27, 30, 36 | `index.blade.php` | Foreman-specific scope hint and assigned Foreman column. | Worksite management scope | Admin site registry without Foreman column. | Retire manager display/scope hint; retain status, search and memberships. | Medium | T7 |
| `resources/views/worksites/permissions.blade.php`:5–6, 17, 23–24, 26–27 | `permissions.blade.php` | Queries Foremen and edits role/per-Foreman overrides via permission endpoint. | Admin worksite delegation | No delegated third-role site capabilities. | Remove UI/include/endpoint only after fixed Admin management is authoritative. | High | T7,T10 |
| `resources/views/components/layouts/app.blade.php`:74 | `app.blade.php` | NavigationCounter mounted for Admin or Foreman. | Authenticated shell | Admin-only review counter. | Replace role predicate; preserve locale/session/notification shell. | Medium | T2,T6 |

### A.4 Albanian and German catalogues (24)

| File and evidence lines | Class/component | Current behavior | Associated permission | Proposed future behavior | Required modification | Risk | Regression |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `lang/de/adminDash.php`:63 | `de/adminDash catalogue` | Weekly archive hint credits Foreman closing. | Admin dashboard labels | Neutral Administrator/preparer wording. | Update hint after weekly behavior changes. | Low | T2,T5 |
| `lang/de/employeeCenter.php`:7, 11–12 | `de/employeeCenter catalogue` | Unassigned-Foreman filter and manager-related form hints. | Admin employee UI | Two-role forms without manager assignment. | Remove manager hints/filter vocabulary only when no callers remain. | Medium | T2 |
| `lang/de/foremanDash.php`:3 | `de/foremanDash catalogue` | Catalogue owned by Foreman dashboard (role identified by namespace/file). | Foreman dashboard | No live third-role catalogue/callers. | Retire after component removal; reuse useful neutral copy only if needed. | Low | T2 |
| `lang/de/leave.php`:8, 12, 27, 58, 81 | `de/leave catalogue` | Says Foreman approves, Admin read-only; NO_FOREMAN error. | Leave request/approval UX | Employee submits to Admin, Admin approve/reject. | Replace descriptions/errors and add decision-status vocabulary in both languages. | High | T3 |
| `lang/de/notifications.php`:22 | `de/notifications catalogue` | WEEKLY_REPORT_CLOSED interpolates :foreman. | In-app notices | Neutral preparer plus new request decision wording. | Version placeholder binding/legacy reader; add rejection keys coherently. | Medium | T6 |
| `lang/de/portal.php`:9, 13, 19–20 | `de/portal catalogue` | Foreman dashboard/team counts and employee manager header labels. | Dashboard/account presentation | Only Admin and Employee compositions. | Remove manager display keys after callers removed. | Low | T2 |
| `lang/de/reportEmail.php`:9, 14, 17 | `de/reportEmail catalogue` | Foreman introduction/comments/footer. | Weekly mail presentation | Admin-prepared weekly report with legacy payload support. | Coordinate placeholders/HTML/text templates; do not translate authored content. | Medium | T5,T12 |
| `lang/de/reportExport.php`:40, 56 | `de/reportExport catalogue` | Weekly Foreman/preparer and comment headings. | Authorized PDF presentation | Neutral report preparer headings. | Update labels with legacy adapter and German export checks. | Medium | T5,T9 |
| `lang/de/reports.php`:20, 113, 231, 237, 270, 277, 306, 325, 340–341, 542 | `de/reports catalogue` | Weekly authoring/review/list/email settings descriptions refer to Foreman. | Daily/weekly/monthly reports UI | Admin weekly authoring and neutral reviewer text. | Update role descriptions and comments, retain actual workflow constraints. | Medium | T2,T5 |
| `lang/de/roles.php`:7 | `de/roles catalogue` | FOREMAN display key; ADMIN/WORKER already have required target labels. | Role display | Administrator/Punëtor or Administrator/Mitarbeiter only. | Remove live Foreman role label after enum/callers change; keep historical payload readers safe. | Medium | T1,T2 |
| `lang/de/users.php`:13, 24–25, 57 | `de/users catalogue` | Manager/team selector, archive hint and FOREMAN_INVALID error. | Account administration | No manager role assignment. | Remove obsolete labels/errors after server validation changes. | Medium | T2 |
| `lang/de/worksiteManagement.php`:27, 29 | `de/worksiteManagement catalogue` | Foreman/Polier delegation, role overrides and assigned-manager labels. | Site capabilities/assignment UI | Admin management; Employee assigned-site operations remain. | Remove role/delegation language; preserve worker assignment/GPS vocabulary. | High | T7 |
| `lang/sq/adminDash.php`:63 | `sq/adminDash catalogue` | Weekly archive hint credits Foreman closing. | Admin dashboard labels | Neutral Administrator/preparer wording. | Update hint after weekly behavior changes. | Low | T2,T5 |
| `lang/sq/employeeCenter.php`:7, 11–12 | `sq/employeeCenter catalogue` | Unassigned-Foreman filter and manager-related form hints. | Admin employee UI | Two-role forms without manager assignment. | Remove manager hints/filter vocabulary only when no callers remain. | Medium | T2 |
| `lang/sq/foremanDash.php`:3 | `sq/foremanDash catalogue` | Catalogue owned by Foreman dashboard (role identified by namespace/file). | Foreman dashboard | No live third-role catalogue/callers. | Retire after component removal; reuse useful neutral copy only if needed. | Low | T2 |
| `lang/sq/leave.php`:8, 12, 27, 58, 81 | `sq/leave catalogue` | Says Foreman approves, Admin read-only; NO_FOREMAN error. | Leave request/approval UX | Employee submits to Admin, Admin approve/reject. | Replace descriptions/errors and add decision-status vocabulary in both languages. | High | T3 |
| `lang/sq/notifications.php`:22 | `sq/notifications catalogue` | WEEKLY_REPORT_CLOSED interpolates :foreman. | In-app notices | Neutral preparer plus new request decision wording. | Version placeholder binding/legacy reader; add rejection keys coherently. | Medium | T6 |
| `lang/sq/portal.php`:9, 13, 19–20 | `sq/portal catalogue` | Foreman dashboard/team counts and employee manager header labels. | Dashboard/account presentation | Only Admin and Employee compositions. | Remove manager display keys after callers removed. | Low | T2 |
| `lang/sq/reportEmail.php`:9, 14, 17 | `sq/reportEmail catalogue` | Foreman introduction/comments/footer. | Weekly mail presentation | Admin-prepared weekly report with legacy payload support. | Coordinate placeholders/HTML/text templates; do not translate authored content. | Medium | T5,T12 |
| `lang/sq/reportExport.php`:40, 56 | `sq/reportExport catalogue` | Weekly Foreman/preparer and comment headings. | Authorized PDF presentation | Neutral report preparer headings. | Update labels with legacy adapter and German export checks. | Medium | T5,T9 |
| `lang/sq/reports.php`:20, 113, 231, 237, 270, 277, 306, 325, 340–341, 542 | `sq/reports catalogue` | Weekly authoring/review/list/email settings descriptions refer to Foreman. | Daily/weekly/monthly reports UI | Admin weekly authoring and neutral reviewer text. | Update role descriptions and comments, retain actual workflow constraints. | Medium | T2,T5 |
| `lang/sq/roles.php`:7 | `sq/roles catalogue` | FOREMAN display key; ADMIN/WORKER already have required target labels. | Role display | Administrator/Punëtor or Administrator/Mitarbeiter only. | Remove live Foreman role label after enum/callers change; keep historical payload readers safe. | Medium | T1,T2 |
| `lang/sq/users.php`:13, 24–25, 57 | `sq/users catalogue` | Manager/team selector, archive hint and FOREMAN_INVALID error. | Account administration | No manager role assignment. | Remove obsolete labels/errors after server validation changes. | Medium | T2 |
| `lang/sq/worksiteManagement.php`:25, 27–29, 65 | `sq/worksiteManagement catalogue` | Foreman/Polier delegation, role overrides and assigned-manager labels. | Site capabilities/assignment UI | Admin management; Employee assigned-site operations remain. | Remove role/delegation language; preserve worker assignment/GPS vocabulary. | High | T7 |

### A.5 Automated test dependencies (30)

| File and evidence lines | Class/component | Current behavior | Associated permission | Proposed future behavior | Required modification | Risk | Regression |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `tests/Feature/AdminDashboardTest.php`:51 | `Tests\Feature\AdminDashboardTest` | Rejects Foreman access to Admin dashboard. | Admin dashboard | Admin-only company view, Employee own. | Replace third-role actor with Employee denial and retain datasets. | High | T1,T2, existing tests/Feature/AdminDashboardTest.php |
| `tests/Feature/AttendanceFlowTest.php`:362, 366 | `Tests\Feature\AttendanceFlowTest` | Explicitly denies Admin and Foreman event creation. | Employee attendance recording | Own Employee records, no Admin impersonation. | Remove runtime Foreman fixture; preserve active/status/event-state denials. | High | T8, existing tests/Feature/AttendanceFlowTest.php |
| `tests/Feature/AttendanceHistoryTest.php`:142, 144–145, 149 | `Tests\Feature\AttendanceHistoryTest` | Foreman team history hides coordinates and foreign workers. | Attendance scope and GPS privacy | Admin overview; Employee own history. | Replace team fixture with Admin/Employee peer isolation and coordinate checks. | High | T8,T10, existing tests/Feature/AttendanceHistoryTest.php |
| `tests/Feature/AttendanceUiTest.php`:101, 105, 111, 113–114, 119, 152 | `Tests\Feature\AttendanceUiTest` | Foreman overview/team tests and Worker-card denial. | Attendance component authorization | Only intended Admin/Employee components. | Replace third-role overview assertions while retaining own-card boundaries. | High | T8,T10, existing tests/Feature/AttendanceUiTest.php |
| `tests/Feature/DailyReportsTest.php`:133, 198, 201–204, 207, 224, 227–228, 232–233, 240, 243, 245, 296, 298–300, 306, 310, 312, 318–319, 332, 334–335 | `Tests\Feature\DailyReportsTest` | Foreman team/foreign-scope and non-worker write denials. | Daily report ownership/review | Admin submitted review, Employee own drafts. | Replace team fixture; retain private drafts, attachments and finality. | High | T5, existing tests/Feature/DailyReportsTest.php |
| `tests/Feature/DailyReportsUiTest.php`:35, 124, 130–132, 140, 153–155, 157 | `Tests\Feature\DailyReportsUiTest` | Foreman report tabs/team reviewer fixtures. | Daily report review UI | Admin review tab; Employee own editor. | Update labels/composition and keep action authorization. | High | T2,T5, existing tests/Feature/DailyReportsUiTest.php |
| `tests/Feature/DashboardOrderPopupTest.php`:40, 42–43, 46 | `Tests\Feature\DashboardOrderPopupTest` | Foreman/team visibility for order popup events. | Order detail/decision scope | Admin company popup; Employee own. | Replace team scenario with peer ID tampering and admin decision boundary. | High | T4, existing tests/Feature/DashboardOrderPopupTest.php |
| `tests/Feature/DashboardPresentationTest.php`:61 | `Tests\Feature\DashboardPresentationTest` | Admin presentation excludes both non-admin roles. | Dashboard presentation/access | Two dashboard variants. | Remove obsolete actor; retain Admin/Employee rendering distinctions. | High | T2, existing tests/Feature/DashboardPresentationTest.php |
| `tests/Feature/DatabaseIntegrityTest.php`:57, 59–60, 62, 65, 68, 71 | `Tests\Feature\DatabaseIntegrityTest` | Deleting Foreman nulls team assignments while keeping employees. | FK/history integrity | Two-role final schema and safe legacy upgrades. | Move old manager relationship fixture to upgrade tests; keep all neutral evidence guards. | High | T11, existing tests/Feature/DatabaseIntegrityTest.php |
| `tests/Feature/DemoWorksiteDeletionTest.php`:68, 71 | `Tests\Feature\DemoWorksiteDeletionTest` | Worker and Foreman denied demo deletion. | Admin-only demo maintenance | Employee remains denied. | Remove third-role fixture; retain real/demo and historical protection. | High | T7, existing tests/Feature/DemoWorksiteDeletionTest.php |
| `tests/Feature/EmployeeManagementUiTest.php`:47, 49–50, 52, 72–73, 93–94, 103–104 | `Tests\Feature\EmployeeManagementUiTest` | Foreman read-only KPIs/rows limited to assigned team. | Employee registry authorization | Admin manages; Employee no registry. | Replace obsolete read-only team case and test two-role cards/no manager field. | High | T2, existing tests/Feature/EmployeeManagementUiTest.php |
| `tests/Feature/GlobalSidebarTest.php`:29, 50 | `Tests\Feature\GlobalSidebarTest` | Three-role scope persistence and Admin/Foreman badges. | Navigation visibility | Admin badges, Employee own links. | Update role/locale combinations; assert no unauthorized SMGV links. | High | T2,T10, existing tests/Feature/GlobalSidebarTest.php |
| `tests/Feature/LeaveTest.php`:26, 28, 41–45, 111, 113, 115–117, 141, 146–147, 149, 155–159, 164, 168, 171, 173, 175, 181–182, 186, 191–193, 204, 207, 209–210, 219, 228, 233, 235, 240–241, 267, 270, 273, 278, 292 | `Tests\Feature\LeaveTest` | Active Foreman required; Admin forbidden to approve; team reassignment changes approver. | Leave workflow | Admin approves/rejects directly; Employee own submission. | Invert obsolete authority assertions; add state/notification/CHECK/race cases. | High | T3,T6,T11, existing tests/Feature/LeaveTest.php |
| `tests/Feature/MonthlyReportTest.php`:47, 50, 52, 57–58, 70, 102 | `Tests\Feature\MonthlyReportTest` | Foreman monthly denial and team-based report fixtures/filtering. | Admin monthly report/export | Admin-only; Employee denied; no manager filter. | Replace actor/filter cases and add historical employee coverage. | High | T8,T9, existing tests/Feature/MonthlyReportTest.php |
| `tests/Feature/NavigationCountsTest.php`:29, 32–35, 43, 51–52, 60, 66–68, 71, 73, 75–76 | `Tests\Feature\NavigationCountsTest` | Pending counts for Admin and Foreman teams. | Review queue badges | Admin-only review counts. | Replace team counts with Admin global/Employee no queue and refresh cases. | High | T6, existing tests/Feature/NavigationCountsTest.php |
| `tests/Feature/NotificationsTest.php`:45, 55, 61, 73, 84, 97, 105–106, 120, 138–140, 144, 148–149, 151, 153–154, 157, 160, 162–163, 165–166, 172–174, 176, 178, 182–183, 188, 202, 212, 220 | `Tests\Feature\NotificationsTest` | Foreman recipients/preferences/team links and inactive-role fixtures. | In-app notification ownership/links | Admin request notices and owner decisions. | Replace routing fixtures; add rejection/durable delivery and legacy payload cases. | High | T6, existing tests/Feature/NotificationsTest.php |
| `tests/Feature/OrderDecisionsDefaultTest.php`:11, 21, 23–25, 27–29, 33, 35, 37, 40 | `Tests\Feature\OrderDecisionsDefaultTest` | Fresh install expressly grants Foreman decisions for own team. | Order approval defaults | Every active Admin decides; Employee never. | Change default-grant expectations and test malicious individual grant. | High | T4,T11, existing tests/Feature/OrderDecisionsDefaultTest.php |
| `tests/Feature/OrdersTest.php`:27, 29, 44, 46–50, 131, 218, 227–228, 230, 233, 240, 275, 277, 280, 282, 284, 287, 317, 319, 324, 326–327, 334–335, 352, 354, 394, 479 | `Tests\Feature\OrdersTest` | Foreman team scopes, personal/role grants, mutable decision permissions. | Order capability/status/history | Admin-exclusive decisions, Employee own scope. | Replace delegation semantics; retain idempotency, histories and stale transitions. | High | T4, existing tests/Feature/OrdersTest.php |
| `tests/Feature/OrdersUiTest.php`:25, 42, 45, 128, 136–137, 144, 169–170, 178–179, 186, 194, 196–197, 200, 202, 211, 215, 223, 231 | `Tests\Feature\OrdersUiTest` | Foreman tabs/scopes and deny-by-default grant fixtures. | Orders UI/actions | Admin review and policy UI, Employee own form/history. | Remove obsolete role tab; test forged confirm action and Admin authority. | High | T2,T4, existing tests/Feature/OrdersUiTest.php |
| `tests/Feature/ReportPdfTest.php`:43–44, 48, 50, 57–58, 64, 70, 80, 82–83, 87, 90, 92 | `Tests\Feature\ReportPdfTest` | Foreman reads submitted team daily/weekly PDFs; foreign scope denied. | Private report downloads | Admin review exports; Employee own daily only. | Replace team actors; retain private/foreign ID checks and frozen legacy snapshots. | High | T5,T9, existing tests/Feature/ReportPdfTest.php |
| `tests/Feature/ReturnTravelTest.php`:232, 283, 286–287, 289 | `Tests\Feature\ReturnTravelTest` | Foreman overview/journey-detail team scopes. | Travel evidence/history visibility | Admin overview, Employee own. | Retain travel vectors; replace manager fixtures with peer-ownership checks. | High | T8, existing tests/Feature/ReturnTravelTest.php |
| `tests/Feature/RoleAccessTest.php`:18–25, 46, 69–70, 84, 88, 90–93, 95, 97, 107–108, 113, 121, 126, 129, 131–132, 137–140 | `Tests\Feature\RoleAccessTest` | Asserts exactly three roles and original module matrix/dashboards/team policy. | Entire RBAC contract | Exactly two; Admin full approvals and Employee own. | Rewrite expected matrix and old assertions; add forged legacy-role/SMGV negative cases. | High | T1,T2,T10, existing tests/Feature/RoleAccessTest.php |
| `tests/Feature/SchedulesTest.php`:153, 155–158, 163–164, 169, 238 | `Tests\Feature\SchedulesTest` | Admin edits; Foreman team read; Worker own. | Schedule permissions/history | Admin edits; Employee own read. | Replace team actor; retain effective-date/overlap/DST behavior. | High | T8, existing tests/Feature/SchedulesTest.php |
| `tests/Feature/SixStepTravelTest.php`:307–308, 310 | `Tests\Feature\SixStepTravelTest` | Foreman assignment and management-view fixture. | Journey state/GPS/privacy | Same six-step Employee behavior; Admin overview. | Change only role fixtures, preserve factual engine vectors. | High | T8, existing tests/Feature/SixStepTravelTest.php |
| `tests/Feature/WeeklyReportsTest.php`:34, 48–52, 88, 97, 101, 104, 111, 116–120, 123, 125–126, 128, 135, 140, 151, 156–158, 165, 168, 176, 189, 192, 202, 206–207, 209, 212, 214–216, 220–221, 225–226, 235, 248, 271, 309, 317, 321, 328, 333, 342–343, 353–354, 363, 366, 376, 379, 384, 391, 400 | `Tests\Feature\WeeklyReportsTest` | Only Foremen build; one report per Foreman/week; Admin archive/retry. | Weekly authoring/snapshot/delivery | Admin prepares/closes agreed scope. | Replace author/population fixtures; retain hash/finality/unique-close/retry tests and V1 upgrade coverage. | High | T5,T11,T12, existing tests/Feature/WeeklyReportsTest.php |
| `tests/Feature/WeeklyReportsUiTest.php`:29, 32–33, 37, 42–43, 47, 53, 57–58, 65–66, 71, 78, 86, 88, 92–93, 97, 100–101, 105, 128, 134 | `Tests\Feature\WeeklyReportsUiTest` | Foreman builder tabs and final snapshot readers. | Weekly component access | Admin builder/archive; Employee denied. | Replace guards/labels/fixtures; test all direct actions and old payload rendering. | High | T5,T10, existing tests/Feature/WeeklyReportsUiTest.php |
| `tests/Feature/WorkersDirectoryTest.php`:25, 28, 42, 44–45, 48, 62, 67, 73, 95, 99, 104–107, 110, 113–115, 118, 120–121, 123, 189–190, 193, 195–196, 198 | `Tests\Feature\WorkersDirectoryTest` | Foreman can view own team but cannot manage; last-Admin/user transitions. | Account directory/mutation | Admin only; Employee personal profile. | Replace team-only view; retain lockout, credentials, archive and session revocation. | High | T2, existing tests/Feature/WorkersDirectoryTest.php |
| `tests/Feature/WorksiteManagementTest.php`:49, 51, 76, 79–83, 87, 89, 100, 102–104, 111, 114–117, 123, 126–131, 137, 140, 142–144, 246, 283, 285, 291–292, 305, 308, 311 | `Tests\Feature\WorksiteManagementTest` | Admin delegates capabilities to Foremen; team assignments/GPS and revocation. | Worksite management permissions | Admin-only management; Employee assigned-site operations. | Replace delegation/Foreman cases with Employee denials; retain per-site data/GPS validation. | High | T7, existing tests/Feature/WorksiteManagementTest.php |
| `tests/Feature/WorksiteSelectionTest.php`:128, 130 | `Tests\Feature\WorksiteSelectionTest` | Admin/Foreman cannot use Worker selection. | Own Employee site selection | Employee assigned sites only; Admin management separate. | Remove third-role loop; retain cross-employee/site/GPS denials. | High | T7,T8, existing tests/Feature/WorksiteSelectionTest.php |
| `tests/Fixtures/WorksiteManagementSchema.php`:24, 45 | `Tests\Fixtures\WorksiteManagementSchema` | Synthetic memory schema includes user/site foreman_id. | Fixture relationship shape | Final schema compatible with two roles; legacy fixture kept separately. | Update shared fixture after forward migration; no application schema writes during audit. | High | T7,T11 |

## Appendix B — Every foreign key referencing users (25)

There are 37 foreign keys overall. All 25 references to users are listed below because a historical Foreman could have served as an actor through a neutral FK, even though this snapshot has no Foreman users. Only three columns explicitly encode the Foreman relationship. Neutral user/actor references must not be deleted or renamed as if they were permissions. Source DDL omits explicit ON DELETE for RESTRICT/NO ACTION defaults.

| Table.column → users.id | Deletion behavior | Role dependency / proposed treatment | Risk / regression |
| --- | --- | --- | --- |
| `attendance_events.user_id` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `attendance_locations.user_id` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `attendance_sessions.user_id` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `audit_logs.actor_id` | SET NULL | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `audit_logs.subject_id` | SET NULL | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `daily_work_reports.user_id` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `delivery_policies.created_by_id` | SET NULL | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `late_arrival_explanations.user_id` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `leave_requests.approved_by_id` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `leave_requests.worker_id` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `material_orders.requested_by` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `material_order_status_history.changed_by_id` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `notifications.actor_id` | SET NULL | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `notifications.recipient_id` | CASCADE | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `notification_preferences.user_id` | CASCADE | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `order_capability_grants.created_by_id` | SET NULL | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `order_capability_grants.user_id` | CASCADE | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `users.foreman_id` | SET NULL | Optional manager relationship: stop live use, preserve required history, contract later. | Critical / T11 |
| `weekly_report_snapshots.created_by_id` | SET NULL | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `weekly_team_reports.foreman_id` | RESTRICT / NO ACTION | Required weekly identity: replace with approved neutral preparer/scope schema; preserve frozen history. | Critical / T11 |
| `worker_schedules.user_id` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `worksites.created_by` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `worksites.foreman_id` | RESTRICT / NO ACTION | Optional manager relationship: stop live use, preserve required history, contract later. | Critical / T11 |
| `worksites.updated_by` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |
| `worksite_user.user_id` | RESTRICT / NO ACTION | Neutral owner/actor reference; retain user identity and historical rows. | High / T11 |

`sessions.user_id` is not an FK; notification JSON, worksite permission JSON and weekly snapshot payloads also require application-level compatibility checks. No Foreman-associated records were found to reassign.

## Appendix C — Every database trigger inspected (26)

No body contains a Foreman/role authorization predicate. Preserve all these guards during role simplification. None implements an Administrator approval check or a monthly accounting close. This appendix records their actual enforcement responsibilities.

| Trigger | Table / event | Current invariant | Proposed treatment / risk / test |
| --- | --- | --- | --- |
| `attendance_events_no_delete` | `attendance_events` / DELETE | Raw attendance evidence cannot be updated/deleted. | Retain; additive versioned changes only / Critical / T11 |
| `attendance_events_no_update` | `attendance_events` / UPDATE | Raw attendance evidence cannot be updated/deleted. | Retain; additive versioned changes only / Critical / T11 |
| `attendance_locations_no_update` | `attendance_locations` / UPDATE | GPS evidence cannot be updated. | Retain; additive versioned changes only / Critical / T11 |
| `audit_logs_no_delete` | `audit_logs` / DELETE | Audit history is append-only. | Retain; additive versioned changes only / Critical / T11 |
| `audit_logs_no_update` | `audit_logs` / UPDATE | Audit history is append-only. | Retain; additive versioned changes only / Critical / T11 |
| `daily_work_reports_frozen_delete` | `daily_work_reports` / DELETE | Submitted daily report and child evidence are frozen. | Retain; additive versioned changes only / Critical / T11 |
| `daily_work_reports_frozen_update` | `daily_work_reports` / UPDATE | Submitted daily report and child evidence are frozen. | Retain; additive versioned changes only / Critical / T11 |
| `daily_work_report_items_frozen_delete` | `daily_work_report_items` / DELETE | Submitted daily report and child evidence are frozen. | Retain; additive versioned changes only / Critical / T11 |
| `daily_work_report_items_frozen_insert` | `daily_work_report_items` / INSERT | Submitted daily report and child evidence are frozen. | Retain; additive versioned changes only / Critical / T11 |
| `daily_work_report_items_frozen_update` | `daily_work_report_items` / UPDATE | Submitted daily report and child evidence are frozen. | Retain; additive versioned changes only / Critical / T11 |
| `delivery_policies_no_delete` | `delivery_policies` / DELETE | Order line/status history or delivery-policy evidence is immutable. | Retain; additive versioned changes only / Critical / T11 |
| `delivery_policies_no_update` | `delivery_policies` / UPDATE | Order line/status history or delivery-policy evidence is immutable. | Retain; additive versioned changes only / Critical / T11 |
| `material_orders_guard_update` | `material_orders` / UPDATE | Submitted order content fixed; status fields may change. | Retain; additive versioned changes only / Critical / T11 |
| `material_orders_no_delete` | `material_orders` / DELETE | Material orders cannot be deleted. | Retain; additive versioned changes only / Critical / T11 |
| `material_order_items_no_delete` | `material_order_items` / DELETE | Order line/status history or delivery-policy evidence is immutable. | Retain; additive versioned changes only / Critical / T11 |
| `material_order_items_no_update` | `material_order_items` / UPDATE | Order line/status history or delivery-policy evidence is immutable. | Retain; additive versioned changes only / Critical / T11 |
| `material_order_status_history_no_delete` | `material_order_status_history` / DELETE | Order line/status history or delivery-policy evidence is immutable. | Retain; additive versioned changes only / Critical / T11 |
| `material_order_status_history_no_update` | `material_order_status_history` / UPDATE | Order line/status history or delivery-policy evidence is immutable. | Retain; additive versioned changes only / Critical / T11 |
| `notifications_guard_update` | `notifications` / UPDATE | Notification identity/event fields fixed; read-state changes permitted. | Retain; additive versioned changes only / Critical / T11 |
| `report_attachments_frozen_delete` | `report_attachments` / DELETE | Submitted daily report and child evidence are frozen. | Retain; additive versioned changes only / Critical / T11 |
| `report_attachments_frozen_insert` | `report_attachments` / INSERT | Submitted daily report and child evidence are frozen. | Retain; additive versioned changes only / Critical / T11 |
| `report_attachments_frozen_update` | `report_attachments` / UPDATE | Submitted daily report and child evidence are frozen. | Retain; additive versioned changes only / Critical / T11 |
| `weekly_report_snapshots_no_delete` | `weekly_report_snapshots` / DELETE | Snapshot rows are immutable. | Retain; additive versioned changes only / Critical / T11 |
| `weekly_report_snapshots_no_update` | `weekly_report_snapshots` / UPDATE | Snapshot rows are immutable. | Retain; additive versioned changes only / Critical / T11 |
| `weekly_team_reports_frozen_delete` | `weekly_team_reports` / DELETE | Closed weekly reports cannot be updated/deleted. | Retain; additive versioned changes only / Critical / T11 |
| `weekly_team_reports_frozen_update` | `weekly_team_reports` / UPDATE | Closed weekly reports cannot be updated/deleted. | Retain; additive versioned changes only / Critical / T11 |

## Appendix D — Audit preservation verification

- 430 preexisting first-party/configuration/test/root files, including environment files, were hashed in memory before and after analysis: all hashes matched. Environment contents and hashes are not disclosed here.
- All 32 RAMA table definitions and row counts matched between initial and final read-only inspections. This is a structure/count comparison, not a claim that every private field was exported or compared.
- The only authorized new project artifact is `RAMA_AG_SMGV_PHASE_01_AUDIT_REPORT.md`. No helper script, test fixture, SQL dump, account, source edit, schema mutation, generated asset or database export was created.
- Git was clean at audit start. Final verification must show only this report as a new untracked file; no staging/commit is part of this audit.
- Quality was not contacted/read/modified; shared privileges and server configuration were not changed. Test suites were not run.

**Handoff:** review the findings and authorize the next phase explicitly. No implementation follows automatically.
