From 1583e302dae639eba556e323a309435b56907df1 Mon Sep 17 00:00:00 2001 From: Mattsson <111893710+mattssonn@users.noreply.github.com> Date: Wed, 22 Apr 2026 15:33:04 +0200 Subject: [PATCH] Bug/delete not working (#347) * Refactor code structure and remove redundant changes for improved clarity and maintainability * feat: add booking template usage tracking and related policies * feat(migrations): Add default voucher series, enhance inbox functionality, and improve journal entry tracking - Add `default_voucher_series` column to `company_settings` for UI default selection. - Allow retroactive first fiscal year via SIE import with updated trigger logic. - Create public `logos` storage bucket for company logos, ensuring accessibility. - Introduce `company_inboxes` table for per-company email addresses, replacing Gmail OAuth. - Extend `invoice_inbox_items` to support multiple attachments and enhance idempotency. - Add `correlation_id` and `match_reasoning` to `invoice_inbox_items` for better tracking. - Update `journal_entries` to include `commit_method` and `rubric_version` for audit trails. - Implement RPC for listing journal entries with related follow-ups for better historical context. - Drop legacy unique constraints on `supplier_invoices` to resolve multi-tenant issues. - Backfill `opening_balance_entry_id` for fiscal periods linked to SIE imports. - Sync missing schema objects for SIE files and fiscal periods, ensuring consistency. - Add immutability trigger to `processing_history` to prevent deletions. - Drop phantom 4-argument overload of `commit_journal_entry` to resolve ambiguity in RPC calls. * feat(migrations): add placeholder migration for backfill of 'niklas' company's source_voucher column * feat(migrations): Add new migrations for logos bucket, journal entry metadata, and inbox enhancements - Create a public `logos` storage bucket for company logos to be used in invoices. - Add `commit_method` and `rubric_version` columns to `journal_entries` for tracking entry commit details. - Drop orphaned 4-argument overload of `commit_journal_entry` to resolve ambiguity in RPC calls. - Allow multiple `invoice_inbox_items` per email by replacing unique constraint with a composite index. - Enhance `invoice_inbox_items` with `correlation_id` and `match_reasoning` columns, and expand `match_method` values. - Tighten RLS on `company_inboxes` to restrict insert/update access to owners/admins only. - Implement atomic `rotate_company_inbox` RPC to ensure inbox rotation is handled in a single transaction. - Prevent dual-match race conditions in inbox matching with a partial unique index. - Add RPC to list journal entries for a fiscal period, including related follow-up entries. - Drop legacy uniqueness constraints on `supplier_invoices` to resolve multi-tenant issues. - Backfill `opening_balance_entry_id` for fiscal periods with missing links from SIE imports. - Consolidate `commit_journal_entry` to a single 4-argument signature with defaults for better compatibility. - Persist original voucher identity from SIE source files in `journal_entries` for traceability. - Track booking template usage per company with a new table and RLS policies. - Add `updated_at` column to `booking_template_usage` for audit consistency. - Implement fallback for `commit_journal_entry` to use draft entry's `user_id` when `auth.uid()` is NULL. - Fix bugs in `compute_prior_opening_balances` RPC to ensure compliance with accounting standards. * Refactor and consolidate database migrations for improved functionality and compliance - Removed obsolete migration files related to inbox hardening, commit journal entry consolidation, journal entry source voucher, and others to streamline the schema. - Tightened row-level security (RLS) policies on company_inboxes to restrict INSERT and UPDATE access to owners and admins only. - Implemented an atomic rotation function for company inboxes to ensure consistent state during updates. - Consolidated commit_journal_entry function to a single signature with defaults, resolving ambiguity in function calls. - Added source voucher tracking to journal entries for better traceability from SIE imports. - Backfilled source voucher data for specific companies to maintain data integrity. - Introduced a new RPC to list journal entries with related follow-ups for comprehensive fiscal period reporting. - Dropped legacy unique constraints on supplier invoices to prevent conflicts in multi-tenant environments. - Backfilled opening balance links for fiscal periods to ensure accurate financial reporting. - Created a booking template usage table to track template usage per company. - Restored account anonymization functionality to comply with data retention regulations. - Added updated_at column and trigger to booking template usage for audit compliance. --- .claude/skills/swarm-a11y-agent/SKILL.md | 177 ++ .../swarm-asset-accounting-agent/SKILL.md | 88 + .claude/skills/swarm-auth-mfa-agent/SKILL.md | 160 ++ .../swarm-bookkeeping-engine-agent/SKILL.md | 96 + .../swarm-document-retention-agent/SKILL.md | 139 ++ .../swarm-error-handling-agent/SKILL.md | 145 ++ .claude/skills/swarm-event-bus-agent/SKILL.md | 150 ++ .../swarm-financial-reporting-agent/SKILL.md | 95 + .../swarm-invoice-compliance-agent/SKILL.md | 84 + .claude/skills/swarm-logging-agent/SKILL.md | 166 ++ .claude/skills/swarm-mobile-ux-agent/SKILL.md | 159 ++ .claude/skills/swarm-payroll-agent/SKILL.md | 84 + .../skills/swarm-performance-agent/SKILL.md | 160 ++ .../swarm-project-accounting-agent/SKILL.md | 94 + .../swarm-provider-connections-agent/SKILL.md | 137 ++ .../skills/swarm-rate-limits-agent/SKILL.md | 148 ++ .../swarm-rls-multitenancy-agent/SKILL.md | 138 ++ .claude/skills/swarm-security-agent/SKILL.md | 133 ++ .claude/skills/swarm-sie-agent/SKILL.md | 83 + .claude/skills/swarm-sru-agent/SKILL.md | 82 + .../skills/swarm-tax-planning-agent/SKILL.md | 95 + .claude/skills/swarm-testing-agent/SKILL.md | 169 ++ .claude/skills/swarm-ticket-drafter/SKILL.md | 111 ++ .claude/skills/swarm-ui-ux-agent/SKILL.md | 183 ++ .claude/skills/swarm-vat-agent/SKILL.md | 83 + .claude/skills/swarm-year-end-agent/SKILL.md | 85 + .claude/skills/swarm/SKILL.md | 252 +++ .gitignore | 3 + findings.md | 1719 +++++++++++++++++ 29 files changed, 5218 insertions(+) create mode 100644 .claude/skills/swarm-a11y-agent/SKILL.md create mode 100644 .claude/skills/swarm-asset-accounting-agent/SKILL.md create mode 100644 .claude/skills/swarm-auth-mfa-agent/SKILL.md create mode 100644 .claude/skills/swarm-bookkeeping-engine-agent/SKILL.md create mode 100644 .claude/skills/swarm-document-retention-agent/SKILL.md create mode 100644 .claude/skills/swarm-error-handling-agent/SKILL.md create mode 100644 .claude/skills/swarm-event-bus-agent/SKILL.md create mode 100644 .claude/skills/swarm-financial-reporting-agent/SKILL.md create mode 100644 .claude/skills/swarm-invoice-compliance-agent/SKILL.md create mode 100644 .claude/skills/swarm-logging-agent/SKILL.md create mode 100644 .claude/skills/swarm-mobile-ux-agent/SKILL.md create mode 100644 .claude/skills/swarm-payroll-agent/SKILL.md create mode 100644 .claude/skills/swarm-performance-agent/SKILL.md create mode 100644 .claude/skills/swarm-project-accounting-agent/SKILL.md create mode 100644 .claude/skills/swarm-provider-connections-agent/SKILL.md create mode 100644 .claude/skills/swarm-rate-limits-agent/SKILL.md create mode 100644 .claude/skills/swarm-rls-multitenancy-agent/SKILL.md create mode 100644 .claude/skills/swarm-security-agent/SKILL.md create mode 100644 .claude/skills/swarm-sie-agent/SKILL.md create mode 100644 .claude/skills/swarm-sru-agent/SKILL.md create mode 100644 .claude/skills/swarm-tax-planning-agent/SKILL.md create mode 100644 .claude/skills/swarm-testing-agent/SKILL.md create mode 100644 .claude/skills/swarm-ticket-drafter/SKILL.md create mode 100644 .claude/skills/swarm-ui-ux-agent/SKILL.md create mode 100644 .claude/skills/swarm-vat-agent/SKILL.md create mode 100644 .claude/skills/swarm-year-end-agent/SKILL.md create mode 100644 .claude/skills/swarm/SKILL.md create mode 100644 findings.md diff --git a/.claude/skills/swarm-a11y-agent/SKILL.md b/.claude/skills/swarm-a11y-agent/SKILL.md new file mode 100644 index 00000000..a587f958 --- /dev/null +++ b/.claude/skills/swarm-a11y-agent/SKILL.md @@ -0,0 +1,177 @@ +--- +name: swarm-a11y-agent +description: "Read-only accessibility audit agent for gnubok. Sweeps for WCAG AA violations: text contrast (4.5:1), UI contrast (3:1), keyboard navigation, visible focus rings, aria-labels on icon-only buttons, semantic HTML, form label association, color-only indicators, motion respect for prefers-reduced-motion, screen reader support. Invoked by /swarm — not for direct user use." +--- + +# swarm-a11y-agent + +You are a read-only accessibility audit agent. Your lens is **WCAG AA compliance**. You never write code, never create tickets, never commit. + +## Baseline (from `CLAUDE.md` § Accessibility) + +- **WCAG AA**: 4.5:1 text contrast, 3:1 UI contrast +- Keyboard-navigable with visible focus rings +- Respect `prefers-reduced-motion` +- Color never the sole indicator of state — pair with icon, text, or shape + +Users: Swedish professionals using gnubok in short, focused sessions. Keyboard use is common for power users (tab through forms rapidly). Screen reader users are fewer but a compliance requirement. + +## Files to sweep + +- `app/**/*.tsx` and `app/**/*.jsx` — pages, layouts +- `components/**/*.tsx` — reusable UI +- `app/globals.css`, Tailwind config — focus ring styles, color tokens + +Skip: `node_modules/`, `.next/`, `.swarm/`, `packages/gnubok-mcp/dist/`, `lib/extensions/_generated/`, `app/api/**`. + +## What to look for + +### Keyboard navigation +- Every interactive element is focusable via Tab (no `tabIndex={-1}` on primary actions) +- Tab order matches visual order (no weird jumps due to CSS positioning) +- Custom components handle keyboard properly: + - Custom `` has an associated `