Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
Lägger docs/production-readiness.md och siax/production-gaps.json enligt SIAX Master Definition of Done. Underlag: git-, kod- och live-evidens 2026-11-11. Nivån är evidensbaserad, inte ett leveransgodkännande.
* chore(ci): guard bedrock-sdk against automated version bumps
The 2026-07 prod outage (empty Bedrock streams breaking invoice OCR and
the assistant) came from an unreviewed @anthropic-ai/bedrock-sdk 0.32.0
bump. The package is exact-pinned to 0.29.1, but nothing stopped an
automated PR from proposing the bump again. Add a dependabot config in
security-updates-only posture (open-pull-requests-limit: 0) with an
ignore for bedrock-sdk >=0.30.0 so neither scheduled nor security
updates can reintroduce it silently.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(enable-banking): stop renewal history floods (gap-fill default + backfill reconciliation)
Renewing a bank connection walks the same pending_selection -> active
flow as a first connect, and a fresh consent often makes the bank
release history the first connect never delivered. Two gaps turned that
into a flood of falsely 'unhandled' rows over already-bookkept periods
(11 companies, ~600 rows in prod):
- The picker defaulted every renewal to the fiscal-year lookback. It now
probes the connection's newest imported transaction and defaults a
renewal to 'continue where the last fetch stopped' (7-day overlap,
absorbed by external_id dedup), with an .attn warning when a longer
lookback re-requests already-fetched periods.
- The inline initial backfill ran without the SIE-overlap guard that the
manual /sync route and the cron both apply. It now suppresses
auto-categorization on overlap and runs the same unattended-threshold
reconciliation sweep, scoped per ledger account via
resolveCashAccountScope instead of the pooled unscoped form
(#1290/#1298), and surfaces the linked count as auto_matched in the
sync summary.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(enable-banking): renewal guard survives mid-open refetch; harden sweep scope and window
Skeptic pass findings on the renewal-flood guard:
- REFUTED: the settings panel's visibility refetch (near-certain in a
BankID reconnect) hands the open picker a fresh accounts identity; the
pre-existing reset effect then wiped the gap-fill state while the
probe effect never re-ran, silently stranding the renewal back on the
fiscal-year default with no warning. The probe now keys its state by
connectionId and shares the reset's triggers via an accounts dep, so
wipe and re-probe always pair up.
- The sweep skips accounts whose cash_accounts row did not resolve
(found: false) instead of degrading to the pooled currency-only form
(#1290 write shape), which could otherwise follow a same-request
mirror-upsert failure.
- The sweep window opens at the oldest booking date the bank actually
returned: over-returning ASPSPs ingest rows outside the requested
window, which the sweep would otherwise never examine.
- resolveGapFillStart clamps to the backend's 365-day lookback floor so
the radio never promises a start date the backfill cannot honor.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(enable-banking): address PR #1590 review findings
- zizmor: add a 7-day cooldown to the dependabot npm entry.
- CodeRabbit: clear the event bus in the accounts-route beforeEach (repo
test convention); surface probe query failures in AccountPickerDialog
so a failed probe cannot read as a first connect and silently restore
the fiscal-year default; build the sweep's ledger-account list with a
string filter instead of a nullish fallback so the pooled scope path
is structurally unreachable.
- Swedish compliance review: document at the sweep site that linking
writes bank-feed metadata only, never journal tables, with the
opening-balance link trigger and unlinkReconciliation reversibility
spelled out.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Delete .github/dependabot.yml and update the two doc references that
pointed at it. Weekly grouped bumps were noise, and the #884 grouped
bump broke Bedrock streaming in prod; dependency updates are manual
and deliberate from now on. The @anthropic-ai/bedrock-sdk 0.29.1 exact
pin remains enforced by scripts/checks/no-new-antipatterns.mjs. Open
dependabot PRs #1083, #1082, #1012 closed alongside this change.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* feat(bookkeeping): per-account default VAT, oresavrundning momsfri
Add a per-account "Standard moms" setting to the chart of accounts and use
it to auto-fill the moms on a leverantorsfaktura-rad when that konto is
picked. Oresavrundning (3740) ships as "Ingen moms", so a rounding line no
longer inherits the 25 % rad-default and skews the moms.
- chart_of_accounts.default_vat_rate (0/0.06/0.12/0.25, CHECK-constrained)
- BEFORE INSERT trigger ships 3740 momsfri on every insert path; backfills
existing 3740 rows
- kontoplan editor: dead free-text momskod replaced with a Standard moms select
- supplier-invoice rad auto-fills the rate from the konto default
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(supplier-invoices): configurable start number for the ankomstnummer series
Add a company_settings.next_arrival_number start floor so a company can continue its leverantorsfaktura numbering from a previous system (e.g. Fortnox) instead of restarting the ankomstnummer at 1. get_next_arrival_number now floors the series via GREATEST(MAX(arrival_number)+1, next_arrival_number), so the floor can never move the series backwards or collide with the (company_id, arrival_number) unique index.
The RPC is hardened while rewritten: SET search_path to empty, schema-qualified refs, and an auth.uid() membership check matching generate_invoice_number.
Includes the settings UI field, sv/en strings, migration, and pg-real coverage. The CompanySettings type and Zod schema field for this feature landed earlier in 1bf3b641 (swept into the per-account VAT commit).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(dependabot): reduce open pull requests limit and group updates for better management
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(db): reconcile prod-orphaned migrations blocking Supabase branching
Prod's schema_migrations carries three versions with no committed file on
main, leaving the default Supabase branch in MIGRATIONS_FAILED and stopping
preview branches from being created:
20260707113729 add_transactions_enrichment (adopted from #927)
20260708120000 ledger_stats_committed_at_lag (adopted from #935)
20260708130000 ledger_deep_context (adopted from #935)
Adopt the byte-identical SQL under the exact apply-time versions, plus the
matching pg-tests and fixtures for the two RPCs so pg-real stays green:
20260708120000 switches get_ledger_usage_stats' median_booking_lag_days to
committed_at, so the existing test now asserts the new behavior. Idempotent
(ADD COLUMN IF NOT EXISTS / CREATE OR REPLACE FUNCTION): no-op on prod,
clean on fresh replays, no-op on #927/#935's next rebase. The knowledge-page
UI/lib/i18n stay in #935.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(deps): pin @anthropic-ai/bedrock-sdk to 0.29.1
0.32.0 (grouped dependabot bump #884) broke Bedrock streaming in prod: empty stream / "request ended without sending any chunks", taking down the in-app AI assistant and invoice OCR. Local dev ran the stale 0.29.1 in node_modules, so it only failed on deploys built fresh from the lockfile. Revert to the six-week-stable 0.29.1; creds/region were never the cause (proven AKIA key + eu-west-1).
Guard against an accidental re-bump three ways: exact pin (no caret), a dependabot ignore, and a pinned-dep check in scripts/checks/no-new-antipatterns.mjs (check:guards). Unpin only once 0.32.x streaming is verified against Bedrock. See DECISIONS.md.
* feat(api): implement caching and logging in health check endpoint
- Added in-memory caching for health check responses to reduce load on Postgres.
- Introduced logging for error handling in health check.
- Updated response structure to exclude error details from public responses.
feat(api): enhance OAuth consent UI and scope handling
- Improved consent UI to reflect exact requested scopes and added better user guidance.
- Updated scope handling logic to ensure least-privilege access.
- Enhanced styling for better user experience and accessibility.
chore(docker): improve security and resource management in Docker setup
- Updated Docker Compose configuration to enforce read-only file systems and resource limits.
- Added health checks and logging options for better observability.
- Introduced optional Caddy reverse proxy for TLS termination.
fix(migrations): resolve ambiguity in create_company_with_owner function
- Dropped orphaned 3-arg overload of create_company_with_owner function.
- Recreated canonical 4-arg version with cash account seeding logic.
- Ensured proper permissions for function execution in Postgres.
* feat: enhance security checks for team membership in company creation