Jump to content

MindAttic.Storage/SPEC

From MindAttic Docs

MindAttic.Storage — 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.Storage owns the files concern: apps store and serve uploaded files through it.

MindAttic.Storage (formerly MindAttic.Media) is drop-in media storage for ASP.NET Core apps: one upload API, one catalog row per file and a /_media/{uid} endpoint that serves the file back safely. Azure was decommissioned on 2026-11-26, so the finished product is a local-disk-only library: MindAttic.Storage 2.0.0 on the local feed, with the frozen Azure package removed once its last consumers have switched.

2. Scope boundary

2.1 In the product

  • MindAttic.Storage: IMediaStore, the EF model, LocalDiskMediaStore, the spill stream and the media endpoint.
  • Docs that name the supported path and how consumers move to it.
  • Until MS-154: the frozen MindAttic.Storage.Azure package, for consumers that still reference it.

2.2 Never in the product

  • New Azure or other cloud backends. Azure is decommissioned; no new cloud work.
  • Azure tests, signer or SAS work. The Azure package is frozen until it is removed.
  • Image processing. Width and height are recorded when given; nothing resizes or transcodes.
  • Databases other than SQL Server. The column mapping targets SQL Server.
  • Generic cleanups, bughunts and repo sweeps.

3. Users and roles

  • A consuming app (Prose, IdeaCms) adds uploads in two lines and serves files by a stable id.
  • A browser fetches /_media/{uid} and must never be served active content inline.

4. Requirements

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

E1. Media storage library — M.MDIA-T39 — built

F1.1 Upload and catalog — M.MDIA-T40 — built

  • S1.1.1 Streaming upload with hash — M.MDIA-T41 — built. As an app, UploadAsync streams once, computing size and SHA-256 in the same pass. Evidence: MediaStreams.CopyAndHashAsync.
  • S1.1.2 Inline or spill by size — M.MDIA-T42 — built. As an app, payloads up to InlineThresholdBytes (2 MB) live in the row; larger ones spill to MediaRoot/{uid}/{file}. Evidence: ThresholdSpillStream.
  • S1.1.3 Soft delete — M.MDIA-T43 — built. As an app, DeleteAsync flags the row and keeps the file.
  • S1.1.4 No orphans on failure — M.MDIA-T44 — built. As an app, a cancelled upload removes its spill file. Evidence: 4817589.
  • S1.1.5 Legacy names still resolve — M.MDIA-T45 — built. As an app, rows stored under the old naming rule still resolve. Evidence: MediaNaming.LegacySanitizeFileName.

F1.2 Serving — M.MDIA-T46 — built

  • S1.2.1 Media endpoint — M.MDIA-T47 — built. As a browser, GET /_media/{uid} streams with ETag, Last-Modified and Range. Evidence: MapMediaEndpoints.
  • S1.2.2 Safe to serve — M.MDIA-T48 — built. As a user, every response carries nosniff and active content only downloads, under a sandbox CSP. Evidence: fe7d3cb, M.MDIA-T18.

F1.3 Packages 1.0 — M.MDIA-T49 — built

  • S1.3.1 Storage 1.0.0 packages — M.MDIA-T50 — built. As a consumer, I reference MindAttic.Storage 1.0.0 from C:\LocalNuGet, with MIGRATION.md mapping the old Media names. Evidence: d73f2c1, 5c18aad.
  • S1.3.2 Azure Blob backend (frozen) — M.MDIA-T51 — built. As an existing consumer, AddMediaAzure stores files in a blob container. Evidence: src/MindAttic.Storage.Azure.

E2. Local-disk store proven — M.MDIA-T31 — built

F2.1 DI wiring — M.MDIA-T32 — built

  • M.MDIA-T4 — built. As an app developer, AddMedia registers a scoped LocalDiskMediaStore as IMediaStore and applies my options (or the defaults). Acceptance: given AddMedia with no options, when IMediaStore is resolved, then it is a LocalDiskMediaStore with default MediaStoreOptions. Evidence: ServiceCollectionExtensionsTests (build-verified).

E3. Consumers guided off Azure — M.MDIA-T33 — built

F3.1 Overview marks Azure frozen — M.MDIA-T34 — built

  • M.MDIA-T10 — built. As a new consumer, docs/overview.md presents the local-disk store as the supported path and the Azure package as frozen. Evidence: the overview's intro, diagram, quick start and "Azure is frozen" notice.

F3.2 Consumer switch note — M.MDIA-T35 — built

  • M.MDIA-T36 — built. As Prose or IdeaCms, MIGRATION.md names me as still on Storage.Azure 1.0.0 and tells me how to switch to AddMedia<TContext> with a local MediaRoot. Evidence: MIGRATION.md "Switching off MindAttic.Storage.Azure" (follow-ups PRS-T1408, IDEA-T213).
  • S3.0.1 One path off Azure (membrane) — M.MDIA-T57 — built. Acceptance: given both docs written, when a consumer starts at the overview, then it reaches MIGRATION.md by a link and every API either page names exists in the code. Joins F3.1 and F3.2.

E4. One storage package — M.MDIA-T52 — MS-154

F4.1 Remove the Azure package — M.MDIA-T53 — MS-154

  • S4.1.1 Azure project removed — M.MDIA-T54 — MS-154. As the maintainer, once no workspace project references MindAttic.Storage.Azure, the Azure project, its tests and the signer leave the solution. Acceptance: given a workspace grep finds no Storage.Azure reference, when the solution builds, then it has no Azure project. It also takes IMediaUrlSigner, the endpoint's signed-URL branch and SignedUrlLifetime, which serve only Azure.

F4.2 Storage 2.0 polish and release — M.MDIA-T55 — MS-154

  • S4.2.1 Storage 2.0.0 released — M.MDIA-T56 — MS-154. As a consumer, 2.0.0 is on C:\LocalNuGet, the docs describe the local-disk-only library, and the owner signs off.
  • S4.0.1 The package on the feed (membrane) — M.MDIA-T58 — MS-154. Acceptance: given 2.0.0 on C:\LocalNuGet, when a scratch app restores it alone, registers AddMedia, maps /_media/{uid} and stores and reads one file, then it works and the package holds no Azure types. Joins F4.1 and F4.2.

5. Non-functional requirements

  • .NET 10, ASP.NET Core and EF Core on SQL Server. Streaming, never buffering whole uploads.
  • Active content never renders inline (M.MDIA-LAW-2); public type names and /_media stay stable (M.MDIA-LAW-4).

6. Interfaces and dependencies

Platform concerns it uses (docs/ECOSYSTEM.md): none directly; the host app passes its storage root, which it reads through MindAttic.Vault.

  • Consumers: Prose (Prose.Core) and IdeaCms (IdeaCms.Blazor). Their switch off Storage.Azure gates MS-154.

7. Release sequence

  1. MS-57 — MindAttic.Storage 1.x: local-disk store, Azure frozen (active): E2, E3.
  2. MS-154 — MindAttic.Storage 2.0: local-disk only (planned): E4, ending with polish and release. Reaching it finishes the product.

8. Change log

Date Change to scope Ticket
2026-11-30 Specification written from the BIBLE, charter, MIGRATION.md, code and ticket history; the Azure package's removal became MS-154 MAT-T397
2026-11-30 MAT-T462 single-source pass: 3 renamed, 0 buckets, 1 requires added (MS-154 after MS-57), 0 platform re-points MAT-T465
2026-12-01 Build-up plan phase: ledger 26/26 read and seated (every history credit was the rename sweep, R22); Azure-only code assigned to S4.1.1 (M.MDIA-T54), which now names IMediaUrlSigner and the signer branch; membranes S3.0.1 (M.MDIA-T57) and S4.0.1 (M.MDIA-T58) M.MDIA-T52
2026-12-01 Build-up: AddMedia registration tests (ServiceCollectionExtensionsTests); F2.1 built M.MDIA-T4
2026-12-01 Build-up: docs/overview.md presents AddMedia as the supported path and marks MindAttic.Storage.Azure frozen; F3.1 built M.MDIA-T10
2026-12-01 Build-up: MIGRATION.md names Prose and IdeaCms as still on Storage.Azure 1.0.0 and gives the switch to AddMedia<TContext>; F3.2 built M.MDIA-T36
2026-12-01 Build-up membrane: the overview's frozen notice links MIGRATION.md's switch section; a cross-read found every API name on both pages in the code; E3 built M.MDIA-T57
From MindAttic.Storage/docs/SPEC.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.