Files
Anubis/docs/adr/0004-componenti-esterni.md
T
Alby96andClaude Opus 5.5 f9d71559e8
ci / test (postgres) (push) Successful in 2m22s
ci / test (sqlite) (push) Failing after 2m27s
ci / image (push) Skipped
feat(server): web server, interface shell, demo mode and Docker image (refs #11 #12 #13 #14 #15 #16 #17)
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>
2026-11-10 12:40:15 +01:00

5.0 KiB

0004 — Nessun SDK o componente esterno senza il permesso dell'utente

Data: 2026-11-09 · Stato: accettata · Precisata dagli ADR 0006 (MSTest tramite i suoi pacchetti di base; libgomp1 nella Fase 8) e 0007 (ProtectedData dalla Fase 1; carattere di sistema finché Instrument Sans non è scaricato)

Contesto

L'utente ha chiesto che il bot non usi SDK né componenti aggiuntivi. Se uno è davvero indispensabile, va chiesto prima, spiegando cosa si aggiunge e perché. Il motivo: ogni libreria esterna porta codice che non si controlla, aggiornamenti da seguire e, a volte, cose da installare sulla macchina.

Questa regola fa eccezione alla SPEC 2.1 ("non chiedere conferme"): per i componenti esterni si chiede sempre.

Decisione

Cosa è sempre permesso. .NET 10 e i suoi framework condivisi:

  • Microsoft.NETCore.App;
  • Microsoft.AspNetCore.App, che comprende Blazor;
  • Microsoft.WindowsDesktop.App, che comprende WinForms.

Con questi si scrive tutto il resto in casa.

Componenti autorizzati dall'utente (9 novembre 2026). Sono gli unici pacchetti NuGet ammessi, con le versioni fissate in Directory.Packages.props:

Componente Di chi A cosa serve Dove finisce
Microsoft.Data.Sqlite Microsoft Database SQLite Applicazione
System.Security.Cryptography.ProtectedData Microsoft Cifra la chiave dei segreti con DPAPI su Windows Applicazione desktop
Microsoft.Web.WebView2 Microsoft Finestra dell'applicazione desktop (il runtime è già in Windows 11) Applicazione desktop
MSTest Microsoft Test Solo sviluppo
Npgsql Progetto open source (licenza PostgreSQL) Database PostgreSQL Applicazione
Microsoft.ML, Microsoft.ML.LightGbm, Microsoft.ML.FastTree Microsoft Modelli della Fase 5. LightGBM porta una libreria nativa; in Docker serve libgomp1 Applicazione
Microsoft.ML.OnnxRuntime, Microsoft.ML.Tokenizers Microsoft Classificatore locale delle notizie della Fase 7 Applicazione

I pacchetti che questi si portano dietro si accettano con loro. Per esempio Microsoft.Data.Sqlite usa SQLitePCLRaw, che contiene la libreria nativa di SQLite. La Fase 0 attiva i file di blocco (packages.lock.json) ed elenca in docs/API-NOTES.md ogni dipendenza indiretta. Se una di queste è di terze parti, lo dice all'utente nel riepilogo della fase.

Infrastruttura, già prevista dalla specifica:

  • immagini Docker ufficiali mcr.microsoft.com/dotnet/sdk:10.0 e aspnet:10.0, più il pacchetto di sistema libgomp1;
  • PostgreSQL, se l'utente lo sceglie, come server a parte;
  • per sviluppare: .NET 10 SDK, Docker, git e Microsoft Edge (già in Windows) per le fotografie delle schermate.

Risorse che non sono codice:

  • il carattere Instrument Sans (licenza SIL OFL), incluso come file nell'applicazione e non caricato da internet;
  • il modello ONNX del classificatore, scaricato con revisione e hash fissati (SPEC 10).

Escluso, e sostituito da codice scritto in casa:

Escluso Al suo posto
Alpaca.Markets, ccxt Client su HttpClient e ClientWebSocket
Parquet.Net File .csv.gz con GZipStream
EF Core, Dapper ADO.NET con mappatura ed esecutore di migrazioni propri
System.ServiceModel.Syndication Lettura di RSS e Atom con System.Xml.Linq
ASP.NET Core Identity PBKDF2 del framework, TOTP (RFC 6238) in casa
React, Vite, Tailwind, TanStack Query, lightweight-charts, qualsiasi pacchetto npm Blazor e componenti SVG propri
xUnit, FsCheck, Playwright, bUnit MSTest, generatore casuale a seme fisso, Edge senza finestra
Photino.NET Finestra WinForms con WebView2
Inno Setup, WiX Installatore Anubis.Setup scritto in C#
make tools/Anubis.Tasks
Azioni GitHub nella CI (actions/checkout …) Passi run: con git, dotnet e docker
Librerie di analisi tecnica e di backtest Già vietate da SPEC 2.7: indicatori e motore scritti in casa

Come si aggiunge qualcosa che non è in elenco:

  1. Ci si ferma prima di aggiungerlo.
  2. Si chiede all'utente, spiegando in italiano semplice:
    • cos'è e di chi è;
    • a cosa serve e perché scriverlo in casa non conviene (tempo, rischio, qualità);
    • cosa si porta dietro e se richiede di installare qualcosa.
  3. Solo con il sì dell'utente si aggiunge, con un nuovo ADR che aggiorna questa tabella.

Alternative scartate

  • Lasciare l'appendice D così com'è, con SDK dei broker, ccxt, Parquet.Net, xUnit, FsCheck, Playwright, React e Inno Setup. Contraddice la richiesta dell'utente.
  • Scrivere in casa anche il driver PostgreSQL e i modelli di apprendimento. Sarebbe lavoro enorme e rischioso senza vantaggi; per questo l'utente li ha autorizzati.

Conseguenze

  • Un controllo in tasks check fallisce se in un progetto compare un pacchetto non presente in Directory.Packages.props. Quel file contiene solo i pacchetti di questa tabella.
  • Più codice proprio nelle Fasi 2 e 3 (client dei broker) e nella Fase 10 (installatore). Ogni parte scritta in casa ha i suoi test.