docs(adr): mobile data, one file store, shared spaces
The developer's decisions of 10 Nov 2026 on their evening's requests:
- ADR 0042: every app holds its sync back on a metered connection, as the
OS says, and asks in a quiet banner (Sync now, Without files, Not now);
an answer holds until the connection changes; Settings › Sync chooses
Ask, Without files or Everything.
- ADR 0043: Learn's file store moves into halkyon_base, room counted per
service; Todo gets sealed attachments in descriptions and comments, any
file up to 100 MB, fetched when shown.
- ADR 0044: shared spaces in halkyon_base for every app, Learn's studysets
first: Owner, Editor and Viewer, keys wrapped to members' key pairs,
invites by handle or email, links off at first, the material to publish
chosen item by item, and agents as accounts of their own whose changes
are suggestions a person accepts. Its open questions come before
building, first how rows move between spaces.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-10 23:07:01 +01:00
|
|
|
# ADR 0043: One file store in halkyon_base; Todo's attachments
|
|
|
|
|
|
|
|
|
|
- **Status:** decided 10 Nov 2026 by the developer: D1 and D2 are their own requests,
|
|
|
|
|
D3 their choice over the agent's recommendation (20 MB), D4 and D5 the agent's
|
refactor(base,learn): people's files kept by halkyon_base
ADR 0043, D2, D4, D6 and D7, the first step towards Todo's attachments:
Learn's file store moves into the module, for every server that keeps
files, and Learn becomes its first host.
halkyon_base gets the store as Learn had it: uploads into the caller's
own space by SHA-256, downloads by a row the caller may read, each
person's room (FILE_LIMIT_IDENTIFIED_MB, FILE_LIMIT_INSTANCE_MB, the
operator's file_allowance, which moves into the module unchanged) and
the pruning of files no live row names. It stays free of the sync
engine: a host hands it a FileStore saying which of its rows name a file
and what it takes (HalkyonBase.files); without one the files endpoint
refuses. Its tests, with refusals, run on a stand-in host.
Learn hands it learnFiles: its asset rows, read by their space's members,
a readable file over 20 MB only as a PDF, up to 100 MB. Its app calls the
module; its own asset endpoint stays for released apps alone, forwarding
to the module in Learn's own models, whose names are on the wire. Its
file tests still pass through it, end to end.
Migrations: the module's creates file_allowance. Learn's server migration
holds version rows alone, as tables are matched by name (ADR 0014); its
device migration creates the module's empty table, as every module's.
Todo's, Train's and Meditate's create the empty table.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-11 00:11:36 +01:00
|
|
|
recommendations, which they chose. D2, D4, D6 and D7 built 10 Nov 2026 (below);
|
|
|
|
|
Todo's attachments come next.
|
docs(adr): mobile data, one file store, shared spaces
The developer's decisions of 10 Nov 2026 on their evening's requests:
- ADR 0042: every app holds its sync back on a metered connection, as the
OS says, and asks in a quiet banner (Sync now, Without files, Not now);
an answer holds until the connection changes; Settings › Sync chooses
Ask, Without files or Everything.
- ADR 0043: Learn's file store moves into halkyon_base, room counted per
service; Todo gets sealed attachments in descriptions and comments, any
file up to 100 MB, fetched when shown.
- ADR 0044: shared spaces in halkyon_base for every app, Learn's studysets
first: Owner, Editor and Viewer, keys wrapped to members' key pairs,
invites by handle or email, links off at first, the material to publish
chosen item by item, and agents as accounts of their own whose changes
are suggestions a person accepts. Its open questions come before
building, first how rows move between spaces.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-10 23:07:01 +01:00
|
|
|
- **Builds on:** ADR 0004 (Learn's assets, rule 5), ADR 0014 (the module), ADR 0017
|
|
|
|
|
(the account's keys), ADR 0019 (sealed files), ADR 0033 (Todo), ADR 0042 (mobile data).
|
|
|
|
|
|
|
|
|
|
## Context
|
|
|
|
|
|
|
|
|
|
Learn keeps people's files (images, sounds, PDFs) in the server's private storage by
|
|
|
|
|
space and SHA-256 (`AssetEndpoint`, `file_limits.dart`, `file_pruning.dart`), counts
|
|
|
|
|
each person's room against `FILE_LIMIT_IDENTIFIED_MB` and the operator's allowances,
|
|
|
|
|
and seals a private studyset's files on the device (`HLKF`, ADR 0019). Todo has
|
|
|
|
|
descriptions and comments as rich text (ADR 0033, D36, D38) and no files. The developer
|
|
|
|
|
asked for attachments in both, now (10 Nov 2026).
|
|
|
|
|
|
|
|
|
|
## Decisions
|
|
|
|
|
|
|
|
|
|
- **D1.** Todo gets attachments in a task's description and in comments: an image shows
|
|
|
|
|
inline, any other file as a chip with its name and size that opens in the system's
|
|
|
|
|
app (or saves, on a desktop).
|
|
|
|
|
- **D2.** The file store moves into **halkyon_base**: the endpoint (upload by hash into
|
|
|
|
|
the caller's own space, finish, usage, download by a row a member may read), the
|
|
|
|
|
limits, the room counted and the pruning. Learn's server uses the module's and drops
|
|
|
|
|
its own; the tables keep their names and data (a move with the version rows alone,
|
|
|
|
|
as ADR 0014's moves). The module asks each app, through a hook as `deletePersonData`,
|
|
|
|
|
which synced rows name a file, for download rights and the pruning: Learn's `asset`
|
|
|
|
|
rows, Todo's attachment rows.
|
|
|
|
|
- **D3.** Todo takes **any file up to 100 MB**, as Learn's PDFs. Every Todo file is
|
|
|
|
|
sealed (everything of Todo's is, ADR 0033, D5), so the server can't look into it and
|
|
|
|
|
checks only its size and the sealed header; Learn's rule for readable files (over 20
|
|
|
|
|
MB only a PDF) stays Learn's.
|
|
|
|
|
- **D4.** **Room per service**, Learn's rule: each server counts its own people's files
|
|
|
|
|
against its own `FILE_LIMIT_IDENTIFIED_MB` (500 MB by default), `FILE_LIMIT_INSTANCE_MB`
|
|
|
|
|
and allowances. The operator's grants screen (ADR 0021) grants a service's room on
|
|
|
|
|
that service.
|
|
|
|
|
- **D5.** A device fetches a file **when it is shown**, then keeps it in the person's
|
|
|
|
|
folder; offline, it has what was seen. On mobile data, *Without files* (ADR 0042)
|
|
|
|
|
holds back uploads and downloads alike; a file not fetched shows as its chip with
|
|
|
|
|
*Download*.
|
|
|
|
|
|
refactor(base,learn): people's files kept by halkyon_base
ADR 0043, D2, D4, D6 and D7, the first step towards Todo's attachments:
Learn's file store moves into the module, for every server that keeps
files, and Learn becomes its first host.
halkyon_base gets the store as Learn had it: uploads into the caller's
own space by SHA-256, downloads by a row the caller may read, each
person's room (FILE_LIMIT_IDENTIFIED_MB, FILE_LIMIT_INSTANCE_MB, the
operator's file_allowance, which moves into the module unchanged) and
the pruning of files no live row names. It stays free of the sync
engine: a host hands it a FileStore saying which of its rows name a file
and what it takes (HalkyonBase.files); without one the files endpoint
refuses. Its tests, with refusals, run on a stand-in host.
Learn hands it learnFiles: its asset rows, read by their space's members,
a readable file over 20 MB only as a PDF, up to 100 MB. Its app calls the
module; its own asset endpoint stays for released apps alone, forwarding
to the module in Learn's own models, whose names are on the wire. Its
file tests still pass through it, end to end.
Migrations: the module's creates file_allowance. Learn's server migration
holds version rows alone, as tables are matched by name (ADR 0014); its
device migration creates the module's empty table, as every module's.
Todo's, Train's and Meditate's create the empty table.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-11 00:11:36 +01:00
|
|
|
## Decided while building (10 Nov 2026, the developer's choices of the agent's recommendations)
|
|
|
|
|
|
|
|
|
|
- **D6.** **The module stays free of the sync engine.** Each app's server hands it hooks,
|
|
|
|
|
as `deletePersonData`: which file a row the caller may read names (for downloads, by
|
|
|
|
|
the row's ID, as Learn's `download(assetId)`), which hashes a space's live rows name
|
|
|
|
|
(for the room counted and the pruning), and what it accepts (Learn: a readable file
|
|
|
|
|
over 20 MB only as a PDF; Todo: sealed files alone). A server without them offers no
|
|
|
|
|
files (Train, Meditate).
|
|
|
|
|
- **D7.** **Older Learn apps keep working:** Learn's `asset` endpoint stays as a thin
|
|
|
|
|
forwarder to the module's, with its own `FileUsage` and `FileLimitExceededException`
|
|
|
|
|
(their names on the wire are Learn's), until a later release raises
|
|
|
|
|
`minimumAppBuild` and drops it.
|
|
|
|
|
- **D8.** **Todo shows attachments in a row below the text** of a description or a
|
|
|
|
|
comment, as Todoist does: images as thumbnails opening full-size, other files as chips;
|
|
|
|
|
added with a paperclip button. halkyon_editor doesn't change.
|
|
|
|
|
|
docs(adr): mobile data, one file store, shared spaces
The developer's decisions of 10 Nov 2026 on their evening's requests:
- ADR 0042: every app holds its sync back on a metered connection, as the
OS says, and asks in a quiet banner (Sync now, Without files, Not now);
an answer holds until the connection changes; Settings › Sync chooses
Ask, Without files or Everything.
- ADR 0043: Learn's file store moves into halkyon_base, room counted per
service; Todo gets sealed attachments in descriptions and comments, any
file up to 100 MB, fetched when shown.
- ADR 0044: shared spaces in halkyon_base for every app, Learn's studysets
first: Owner, Editor and Viewer, keys wrapped to members' key pairs,
invites by handle or email, links off at first, the material to publish
chosen item by item, and agents as accounts of their own whose changes
are suggestions a person accepts. Its open questions come before
building, first how rows move between spaces.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-10 23:07:01 +01:00
|
|
|
## Todo's rows
|
|
|
|
|
|
|
|
|
|
An `attachment` table, synced and sealed as every Todo table: the file's hash, sealed
|
|
|
|
|
size and kind (image or file), its name and the task or comment it belongs to, all in
|
|
|
|
|
the sealed payload but the hash, which the server needs to count and serve. The rich
|
|
|
|
|
text names the attachment by its row ID, as Learn's editor names an asset. Deleting a
|
|
|
|
|
task or a comment blanks its attachment rows (the payload first, ADR 0002, rule 2); the
|
|
|
|
|
module's pruning removes a file no row names any more.
|
|
|
|
|
|
|
|
|
|
## To work out when building
|
|
|
|
|
|
|
|
|
|
- The move of Learn's tables into the module: their migration SQL (version rows only,
|
|
|
|
|
or a rename where the module's naming differs), explained before it is applied.
|
|
|
|
|
- Whether the sealed header (`HLKF`) and Learn's `SealedFile` move to `halkyon_keys`
|
|
|
|
|
for Todo to share, which the recommendation is.
|
|
|
|
|
- The quota's text in Todo's Settings: Learn shows the room used in its Sync card.
|
refactor(base,learn): people's files kept by halkyon_base
ADR 0043, D2, D4, D6 and D7, the first step towards Todo's attachments:
Learn's file store moves into the module, for every server that keeps
files, and Learn becomes its first host.
halkyon_base gets the store as Learn had it: uploads into the caller's
own space by SHA-256, downloads by a row the caller may read, each
person's room (FILE_LIMIT_IDENTIFIED_MB, FILE_LIMIT_INSTANCE_MB, the
operator's file_allowance, which moves into the module unchanged) and
the pruning of files no live row names. It stays free of the sync
engine: a host hands it a FileStore saying which of its rows name a file
and what it takes (HalkyonBase.files); without one the files endpoint
refuses. Its tests, with refusals, run on a stand-in host.
Learn hands it learnFiles: its asset rows, read by their space's members,
a readable file over 20 MB only as a PDF, up to 100 MB. Its app calls the
module; its own asset endpoint stays for released apps alone, forwarding
to the module in Learn's own models, whose names are on the wire. Its
file tests still pass through it, end to end.
Migrations: the module's creates file_allowance. Learn's server migration
holds version rows alone, as tables are matched by name (ADR 0014); its
device migration creates the module's empty table, as every module's.
Todo's, Train's and Meditate's create the empty table.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-11 00:11:36 +01:00
|
|
|
|
|
|
|
|
## As built: the store in halkyon_base (10 Nov 2026)
|
|
|
|
|
|
|
|
|
|
- `packages/halkyon_base_server/lib/src/files/`: `FileStore` (the host's hooks
|
|
|
|
|
`fileOfRow`, `liveHashes`, `accepts`; `maxBytes`, 100 MB unless said), the store's
|
|
|
|
|
logic as functions (`startFileUpload`, `finishFileUpload`, `fileUsageOf`,
|
|
|
|
|
`downloadFile`) under the `files` endpoint, the room (`file_limits.dart`) and the
|
|
|
|
|
pruning (`pruneUnreferencedFiles`, scheduled by each host in a future call of its own),
|
|
|
|
|
moved from Learn with their tests; `FileAllowance` moved as it was (its table keeps its
|
|
|
|
|
name), deleted with the person by the module now. Models of the module's own:
|
|
|
|
|
`FileUsage`, `FileLimitExceededException`, `StoredFileNotFoundException`.
|
|
|
|
|
- Migrations: the module's `file-store` creates `file_allowance`; Learn's holds version
|
|
|
|
|
rows alone (Serverpod matches tables by name, as ADR 0014 found), its device migration
|
|
|
|
|
creating the module's empty table, as every module's; Todo's, Train's and Meditate's
|
|
|
|
|
create the empty table, which only Todo will use.
|
|
|
|
|
- Learn: `learnFiles` (its `asset` rows, their spaces' members, a readable file over
|
|
|
|
|
20 MB only as a PDF); `AssetEndpoint` a forwarder in Learn's models for released apps;
|
|
|
|
|
the app calls the module (`client.modules.base.files`).
|
|
|
|
|
|