Fase 1 — Fondamenta #86

Merged
Alby96 merged 3 commits from fase-1 into main 2026-11-10 13:10:46 +01:00
Owner

Fase 1: piattaforma, database portabile su PostgreSQL e SQLite, nucleo, accesso, server con API e WebSocket, guscio dell'interfaccia, modalità dimostrativa e immagine Docker definitiva. Scelte nell'ADR 0007.

CI verde sul commit 101dcbb (run 174): test su SQLite e PostgreSQL, immagine Docker. L'ultimo commit corregge due problemi di tempi emersi solo nella CI su Linux (ADR 0007, punto 10).

Closes #7
Closes #8
Closes #9
Closes #10
Closes #11
Closes #12
Closes #13
Closes #14
Closes #15
Closes #16
Closes #17

🤖 Generated with Claude Code

Fase 1: piattaforma, database portabile su PostgreSQL e SQLite, nucleo, accesso, server con API e WebSocket, guscio dell'interfaccia, modalità dimostrativa e immagine Docker definitiva. Scelte nell'ADR 0007. CI verde sul commit 101dcbb (run 174): test su SQLite e PostgreSQL, immagine Docker. L'ultimo commit corregge due problemi di tempi emersi solo nella CI su Linux (ADR 0007, punto 10). Closes #7 Closes #8 Closes #9 Closes #10 Closes #11 Closes #12 Closes #13 Closes #14 Closes #15 Closes #16 Closes #17 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Alby96 added 3 commits 2026-11-10 13:09:57 +01:00
Phase 1 foundations in the Anubis library:
- Platform: startup configuration from environment variables (Docker) or
  config.toml (desktop, in-house TOML subset), data folder layout, secret key
  custody (ANUBIS_SECRET_KEY, DPAPI on Windows, restricted file elsewhere),
  installation identity and database fingerprint.
- Db: ADO.NET with Npgsql and Microsoft.Data.Sqlite, money as NUMERIC(38,18)
  or canonical text rounded to 18 decimals, UTC moments, UUIDv7 ids; numbered
  SQL migrations with type tokens and a version table; engine-independent
  export/import with count and accounting-total checks; backups keeping 14.
- Core: injectable clock, channel event bus, scheduler with fixed, interval
  and market-relative times, settings with change log, AES-GCM secrets, log
  redaction, Italian formats.
- Access: PBKDF2-SHA512 hashes, RFC 6238 TOTP, hashed session tokens,
  sign-in attempt limit.

SQLitePCLRaw (Apache-2.0) arrives with Microsoft.Data.Sqlite and is declared
in DependencyPolicyTests and API-NOTES.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feat(server): web server, interface shell, demo mode and Docker image (refs #11 #12 #13 #14 #15 #16 #17)
ci / test (postgres) (push) Successful in 2m22s
ci / test (sqlite) (push) Failing after 2m27s
ci / image (push) Skipped
f9d71559e8
Phase 1 completed on top of the library foundations:
- Server: startup state machine (config, first run, database down, schema,
  identity, ready) with an error page that retries by itself; the configured
  database is the only one ever opened, and a vanished SQLite file is never
  recreated. REST API and status WebSocket; session cookie auth, CSRF on
  every form and write call; desktop and demo answer only the computer itself.
- Interface: static Blazor rendering with plain forms (no interactive
  runtime), menu, top bar and phone bottom bar as in the mockups, light and
  dark themes with appendix C tokens and a contrast test, Panoramica, Diario,
  Rischio, Impostazioni; service pages for sign-in, first access, desktop
  first run and the database error page with its choices.
- Demo mode (tasks seed-demo): appendix F in a database of its own under the
  temp folder, frozen clock, never touches the configured installation.
- Docker: entrypoint gives /data to PUID:PGID and drops root with setpriv,
  HEALTHCHECK through bash /dev/tcp; proven with SQLite, PostgreSQL, a wrong
  configuration and a database that goes away and comes back.
- tasks screenshots drives the installed Edge/Chrome through DevTools for
  exact 1440 and 390 pixel shots; anubis db export|import on the command line.

Fixes from the independent review: return paths without control characters,
Host check against DNS rebinding, attempt limit counted before the check and
also on the error-page password, one-use TOTP codes and a code to switch the
second factor off, error-page choices serialized with the startup loop,
identity checked before migrating, restore restarts with "Ferma tutto" on,
damaged archives reported instead of crashing. Running the server tests on
PostgreSQL exposed pages rendered before their data arrived; data-loading
components now load first (LoadedComponent).

Decisions in ADR 0007. Tests: 100 on SQLite and on PostgreSQL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix two startup races found by CI on Linux (refs #9 #14)
ci / test (postgres) (push) Successful in 2m31s
ci / test (sqlite) (push) Successful in 2m8s
ci / image (push) Successful in 59s
ci / test (postgres) (pull_request) Successful in 2m23s
ci / test (sqlite) (pull_request) Successful in 2m4s
ci / image (pull_request) Successful in 9s
101dcbb152
An error-page choice released the startup loop before resetting the
services, so the loop could start the application and then lose its
services while reporting ready. The reset now happens while the loop is
still held, and moves the status back to Starting.

A SQLite file could vanish between the existence check and the open;
with create allowed, the open would put an empty database in its place.
Once the file has been seen, connections open read-write only and fail
on a missing file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Alby96 merged commit cf6d0536aa into main 2026-11-10 13:10:46 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: BalboSoft/Anubis#86