Jump to content

MindAttic.Log/SPEC

From MindAttic Docs

MindAttic.Log — Product specification

The complete product, written down before it is built (owner, 2026-11-30, MAT-T360). Every epic, feature and story the finished product will have is listed here, built or not. The ticket tree mirrors this file one to one: every ID below is a ticket. Nothing gets built unless it is here, and anything taken out of here is closed wont-do in the tree. docs/RELEASE.md says which part of this the current milestone delivers.

1. Product definition

In docs/ECOSYSTEM.md MindAttic.Log owns the logging concern: every app logs through it, and no app keeps its own log files.

MindAttic.Log is the one logging pipeline for every MindAttic app. Apps keep calling ILogger<T>; the package writes every entry in one strict schema to that app's own MindAttic.Log.db (SQLite, WAL) under the Vault Logging root, or to the shared SQL Server MindAttic.Log database, and the WPF Log Reader discovers and browses every app's logs. The finished product is MindAttic.Log 4.0.0 on the local feed with both stores, a sink that can never take its host down, and canon docs that describe both stores and every consumer.

2. Scope boundary

2.1 In the product

  • The MindAttic.Log library: schema, AddMindAtticLog/WriteToMindAtticLog, the store registry, the SQLite and SQL Server sinks, retention and the SQLite-to-SQL-Server migrator.
  • MindAttic.Log.Reader: the WPF + WebView2 reader, deployed to R:\MindAttic\Apps\MindAttic.Log.
  • The package on C:\LocalNuGet and the docs (BIBLE.md, MIGRATION.md, overview.md).

2.2 Never in the product

  • A log aggregation server or ingestion API. Every app owns its store; the Reader reads stores directly (BIBLE §3).
  • MindAttic.Log.Issues triage over raw logs. Prose's LogIssue view stays in Prose; no second consumer has asked.
  • Folding domain audit tables into MindAttic_Log. Auth's and MediaButler's audit logs have their own audience.
  • A Blazor Reader. The Reader stays WPF + WebView2 like its sibling apps.
  • Flat-file logging. A log is always a queryable database.
  • Moving the ~20 consumers to 4.0.0. Each consumer's own repo owns its upgrade.
  • Extra migrator edge-case suites, column-mapping audits, sweeps and bughunts. The migrator is a one-shot tool.

3. Users and roles

  • A MindAttic app writes logs without changing its call sites and must never crash because logging failed.
  • The owner reads every app's logs in one Reader and chooses SQLite or SQL Server per app.

4. Requirements

Status is built (closed ticket, with evidence) or MS-n: the milestone in §7 that delivers it.

E1. Logging pipeline — M.LOGS-T49 — built

F1.1 Write path — M.LOGS-T50 — built

  • S1.1.1 One schema via ILogger — M.LOGS-T51 — built As an app, I call AddMindAtticLog and keep logging through ILogger<T>, so that every row lands in the strict LogEntry/MindAttic_Log schema. Acceptance: given an app logs an Information event, when the provider flushes, then one row with every schema column exists. Evidence: MindAttic.Log/Extensions, Schema/LogSchema.cs.
  • S1.1.2 Per-app SQLite in WAL — M.LOGS-T52 — built As an app, my logs go to my own MindAttic.Log.db in WAL mode, so that the Reader can read while I write. Evidence: MindAtticSqliteSink.cs.
  • S1.1.3 Retention prune — M.LOGS-T53 — built As an app, rows older than RetainedDays are pruned on a timer; 0 or less keeps everything. Evidence: MindAtticSqliteSink.PruneOldRows.

F1.2 Pluggable stores — M.LOGS-T17 — built

  • S1.2.1 Store registry — M.LOGS-T29 — built. As an app, I pick a store through MindAtticLogOptions.Store; SQLite stays the default. Evidence: bf5054b.
  • S1.2.2 SQL Server store — M.LOGS-T30 — built. As an app with a ConnectionString, my logs go to the shared MindAttic.Log database, created on first write. Evidence: 2a016bd.
  • S1.2.3 SQLite to SQL Server migrator — M.LOGS-T32 — built. As the owner, MigrateSqliteToSqlServerAsync copies an app's SQLite log into SQL Server by per-application watermark. Evidence: 25869dc.
  • S1.2.4 Reader discovers every store — M.LOGS-T31 — built. As the owner, the Reader lists SQLite files and SQL Server databases through per-store readers. Evidence: 5a9a126.

F1.3 Log Reader — M.LOGS-T54 — built

  • S1.3.1 Literal filter and search — M.LOGS-T37 — built. As the owner, % and _ in a filter match literally. Evidence: 95a7926.
  • S1.3.2 Reader settings in Vault Desktop — M.LOGS-T20 — built. As the owner, the Reader's settings and keys live in Vault.Desktop.
  • S1.3.3 Reader deploys to R: — M.LOGS-T55 — built. As the owner, I deploy and run the Reader from R:\MindAttic\Apps\MindAttic.Log through the shared run menu. Evidence: 5af4b5d.

F1.4 Package 3.0 — M.LOGS-T56 — built

  • S1.4.1 3.0.0 on the local feed — M.LOGS-T57 — built. As a consuming app, I reference 3.0.0 (with snupkg) from C:\LocalNuGet. Evidence: C:\LocalNuGet\MindAttic.Log.3.0.0.nupkg.

Build-up comb (MAT-T484). Built: M.LOGS-T63 (browse and filter an app's log, F1.3; M.LOGS-T2, T3 seated under it), T64 (old logs move in once, F1.1), feature T65 (build and repo tooling), built membrane T66 (one options bag and the Reader's composition, joining F1.1 to F1.3). Debt: T67 (one severity map), T68 (one batched sink; requires T5), T69 (split the migrator; requires T68), T70 (test vault roots in their own file), T71 (package references and descriptions; 4.0.0, T43, requires it). Fixes: T72 (Reader survives an unreadable bucket), T73 (no connection string in the page).

E2. Logging never takes an app down — M.LOGS-T38 — MS-50

F2.1 SQLite sink resilience — M.LOGS-T39 — MS-50

  • M.LOGS-T5 — MS-50. As a host app, the sink's batching, flush timer, retention and never-throw behaviour are under NUnit test. Acceptance: given the database becomes unwritable, when the app emits, flushes and disposes, then nothing throws; given batchSize is reached, then the batch is written without Dispose.

F2.2 Registration validation — M.LOGS-T40 — MS-50

  • M.LOGS-T6 — MS-50. As an app developer, WriteToMindAtticLog and AddMindAtticLog reject a blank DbPath/Application and honour MinimumLevel end to end. Acceptance: given MinimumLevel Warning, when an Information and a Warning are logged, then only the Warning row exists.

E3. Shared SQL Server log store — M.LOGS-T41 — MS-50

F3.1 Package 4.0.0 — M.LOGS-T42 — MS-50

  • M.LOGS-T43 — MS-50. As a consuming app, MindAttic.Log 4.0.0 with its snupkg is on C:\LocalNuGet and carries the SQL Server store. Acceptance: given the feed, when an app references 4.0.0, then ConnectionString selects the SQL Server store.

F3.2 Docs name every store — M.LOGS-T44 — MS-50

  • M.LOGS-T8 — MS-50. As a maintainer, MIGRATION.md lists every consuming app (IdiotProof, JobHunt, TaxRateCollector, Prose.Mcp, Tutor.Mcp included) with its logging status.
  • M.LOGS-T45 — MS-50. As a maintainer, BIBLE.md describes the store registry, the SQL Server store, the per-store readers and the migrator, and its one-backend promise matches the two stores.
  • Membranes: M.LOGS-T74 (E2: one host fails fast on a bad registration and survives an unwritable db), M.LOGS-T75 (E3: a consumer restored from the feed logs to SQL Server as the docs say), M.LOGS-T76 (F3.2: the two docs agree), M.LOGS-T77 (E4: search and grouping across apps; the 5.0 sign-off M.LOGS-T62 requires it, R51).

Added by MAT-T477 (owner stories and cross-repo links)

  • E M.LOGS-T58 Logs are searchable (MS-168 Log 5.0: searchable logs; priority 700)
    • F M.LOGS-T59 Search and issue grouping / S M.LOGS-T60 Find and group failures (requires the 4.0.0 package M.LOGS-T42; Prose's PRS-T1407 requires it). Given the shared SQL Server log store, when I search by app, level or text, then matching lines return in seconds and identical errors appear as one issue with its count.
    • F M.LOGS-T61 Polish and release 5.0 / S M.LOGS-T62 Log 5.0 released

5. Non-functional requirements

  • .NET 9 and 10; SQLite (WAL) and SQL Server; no dependency on MindAttic.Vault (the host computes DbPath).
  • A logging failure never propagates into the host (M.LOGS-LAW-3).
  • No credential in code or docs; connection strings come from the host's configuration.

6. Interfaces and dependencies

Platform concerns it uses (docs/ECOSYSTEM.md): settings and paths — MindAttic.Vault (VaultPaths.LoggingDbPath). It is itself the platform owner of logging.

  • Consumers: Prose, Orchestrator, Tickets, Vault, Launcher, IdiotProof and about twenty more (docs/MIGRATION.md).
  • Uses Serilog, Microsoft.Data.Sqlite and Microsoft.Data.SqlClient. The host passes VaultPaths.LoggingDbPath.

7. Release sequence

  1. MS-50 — MindAttic.Log 4.0: two stores, guarded sink (active): E2, E3. Reaching it finishes the product.

8. Change log

Date Change to scope Ticket
2026-11-30 Specification written from the BIBLE, charter, overview, code and ticket history; 4.0 is the finished library MAT-T397
2026-11-30 MAT-T462 single-source pass: 3 renamed, 0 buckets, 1 requires added, 0 platform re-points MAT-T465
2026-11-30 MAT-T477 owner story for Prose MAT-T477
2026-12-01 Build-up plan phase: comb 23 of 43 to 43 of 43 by reading; built M.LOGS-T63 to T66; debt T67 to T71; fixes T72, T73; membranes T74 to T77 MAT-T484
Part of MindAttic.Log.
From MindAttic.Log/docs/SPEC.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.