@davoodmehraban89 / Factor-easy / commits / 4403817
Fork 0

سامانه صدور فاکتور و حسابداری

Document verified Office Slice C6 evidence

davoodmehraban89 committed Oct 1, 2026 at 00:20 UTC 44038172578bd8fc08e276469e320bb250efab76
1 file changed +58
docs/OFFICE_SLICE_C6_VERIFICATION.md new
+58
@@ -0,0 +1,58 @@
1 +# Office Slice C6 — SLA Reminder / Escalation Verification
2 +
3 +Date: 2026-10-01
4 +Project: `hcsixhqbyuhpshfwqpjx`
5 +
6 +## Delivered
7 +- Server-derived SLA queue for pending Office referrals and internal approval requests.
8 +- Overdue state and overdue hours are calculated server-side from immutable work evidence.
9 +- Internal `sla_reminder` and `sla_escalated` events are append-only Office audit evidence.
10 +- Event target/requester/correspondence/due time are derived from the original work item; clients cannot substitute them.
11 +- Reminder policy window is server-derived per UTC day; escalation is a one-time `overdue-24h` policy window.
12 +- Advisory locking plus evidence lookup rejects duplicate events in the same policy window.
13 +- Escalation requires at least 24 hours overdue.
14 +- Only organization owner, original requester, or Office `configure` authority can emit SLA events.
15 +- Assigned targets can see authorized queue rows but cannot impersonate the requester/admin to emit SLA events.
16 +- Completed referrals, decided approvals and stale content-bound approvals reject new SLA events.
17 +- UI exposes «SLA و یادآوری», overdue hours, last reminder, escalation state and authorized actions.
18 +- C6 performs **no external delivery**. Email/SMS/webhook adapters remain outside verified scope.
19 +
20 +## Production migration
21 +- `20260930204536 office_slice_c6_sla_reminder_escalation`
22 +- Exact production SQL is archived at `supabase/migrations/20260930204536_office_slice_c6_sla_reminder_escalation.sql`.
23 +
24 +A continuity drift found before C6 was also repaired: live migration `20260930203839 office_c5_content_digest_hardening` existed in Production but was missing from Git. Its exact SQL was recovered from `supabase_migrations.schema_migrations.statements` and archived as `supabase/migrations/20260930203839_office_c5_content_digest_hardening.sql`.
25 +
26 +## Production adversarial verification
27 +Transactional verification used existing legitimate principals and rolled back all temporary state.
28 +
29 +PASS:
30 +1. Owner/requester sees overdue referral and approval SLA rows.
31 +2. Daily reminder evidence is created once and duplicate same-window reminder is rejected.
32 +3. Referral overdue by 48h can be escalated; duplicate escalation is rejected.
33 +4. Approval overdue by only 2h cannot be escalated.
34 +5. Assigned target can see its authorized work but `can_emit=false` and cannot emit SLA evidence.
35 +6. Completed referral rejects later SLA events.
36 +7. Approved request rejects later SLA events.
37 +8. Stale approval whose content changed after request is exposed as `stale`, is not treated as overdue, and cannot receive SLA reminder evidence.
38 +9. Cross-tenant principal receives no SLA queue rows.
39 +10. Rollback residue is zero; temporary member is absent and temporary seat expansion returned to `max_users=1`.
40 +
41 +## Function security
42 +- Public API functions `office_emit_sla_event` and `office_sla_work_queue` are SECURITY INVOKER.
43 +- Privileged implementations live in `private`, use `search_path=''`, and are not executable by `anon`.
44 +- C6 did not increase the public authenticated SECURITY DEFINER advisor warning count.
45 +
46 +## CI evidence
47 +Verified runtime head: `ba06af2bcaf5b63e37f5421fb49c4246d85ba762`.
48 +- Quality `36775081078`: PASS, including JavaScript syntax, accounting/Golden/ELI/C1-C6 invariants and Real-DOM.
49 +- Security `36775081089`: CodeQL JavaScript PASS. Dependency Review remains skipped because repository Dependency Graph is not enabled.
50 +- Pages `36775080542`: build/deploy/report PASS.
51 +
52 +## Advisor status
53 +- Security advisor still reports 20 pre-existing authenticated-callable public SECURITY DEFINER warnings and leaked-password protection disabled.
54 +- Performance advisor reports 12 unused-index informational notices.
55 +- No new C6 public SECURITY DEFINER warning was introduced.
56 +
57 +## Scope boundary
58 +C6 does not claim automatic external reminders, email/SMS/webhook delivery, qualified digital signature, real Persian OCR quality, or persistent two-real-user browser E2E.