Repository navigation
Description
Problem
Managing a managed profile (a child, a senior in someone's care) works from the guardian's own account in every section but one: after switching to the record, Documents is empty — no upload zone, just "Documents can only be added by the record owner" — and POST /api/documents/inbound returns 403 sharing.not_permitted. A scanned lab result or discharge summary therefore has nowhere to go; it lives as a file outside HealthLog and the record has no documents at all.
Checked on v1.47.6, self-hosted (Docker Compose): Settings → Shared access → managed profile → switch to the record → Documents → the note above; the POST 403s.
docs/self-hosting/account-sharing.md says the vault is writable at no level, so this is deliberate — filing it as a feature request, not a bug.
Proposed solution
The guardian manages that record's vault the way they already manage every other section of it — add, view, edit and delete — without logging in as the child/senior and without creating a login for them:
- Upload into the record's vault from the guardian's own session (PDF, images — the types an owner upload already takes).
- See the record's documents and open or download them.
- Rename, delete and restore an entry, so a bad scan is replaced instead of piling up.
- Storage and quota count against the record the request runs inside — the child's, not the guardian's.
- The activity log names the guardian as the actor; the document belongs to the record.
- Shared records (adult–adult) unchanged: "owner only" stays as it is, at every grant level.
That is the whole ask. How it is wired is yours — I do not know the internals (managed / shared / delegations) well enough to point at the code, and I would rather not prescribe it.
Alternatives considered
- Handover to a real account. Needs a mailbox, a password and a second factor for a person who cannot look after them — the thing managed profiles exist to avoid.
- Keeping the scans outside HealthLog. Not a record: not in the profile, not counted as its documents, not in its export.
- Opening the vault to every MANAGE grant. "Owner only" is right for an adult–adult share; I am not asking for that.
- A general "upload into any record" API. Larger than the problem, and a cross-record write primitive I would not want in the tree for one guardian and one profile.
Affected surface
API, Web (PWA)
Additional context
v1.47.6, single family installation, self-hosted with Docker Compose, no telemetry.
Happy to send a PR with tests — I ran the ones on this path on my clone of tag v1.47.6: src/tests/domain-write-support-guard.test.ts (the permission table is guarded by a scan of the routes: setting documents: { manage: true } with no new route fails two tests at once, e.g. "gives a manage grant every section with a delegated route, and never the vault"), src/components/tests/delegated-write-affordances.test.tsx (56 tests green locally together with the guard) and e2e/v138-managed-record-capabilities.spec.ts → "withholds the vault's upload control and says why", which would need inverting (not run here — needs a live instance and a database).
Happy to test a build too. If you prefer to split it: the managed-profile upload path is the core, the rest of the vault verbs could follow.
Pre-flight checks
- I confirmed this is not a duplicate of an existing feature request.
- I'm proposing a feature, not asking a usage question (those go to Discussions or the docs).
Activity
MBombeck commentedon Nov 17, 2026
@ch3funio Thanks for the careful write-up. You're right about the gap: a managed profile is meant to be run entirely from the guardian's account, and the vault is the one section where that breaks, so the record ends up with no documents at all. I'd like this in, scoped the way you describe. Only managed profiles change. The guardian can upload, view, rename, delete and restore, storage counts against the record, and the activity log names the guardian as the actor. Adult shares stay owner-only at every level.
A PR is very welcome. In review I'll look for three things. The permission should hang on the managed relationship, not on a MANAGE grant in general, so a shared adult record can't reach the vault through the same path. The guard test and the e2e spec should change with it rather than get looser. And the account sharing page in the docs needs the new row. If you'd rather I take it, say so and I'll pick it up.
ch3funio commentedon Nov 17, 2026
Thanks — and managed-only is exactly the line I would draw too: the permission should follow the guardian relationship, not the grant level, so an adult share cannot reach the vault through the same path.
Please take it. And a correction to my own issue: I offered a PR there, and that was a mistake — I do not write TypeScript, and anything I sent would come from an AI assistant I could not vouch for line by line.
To be straight about how much testing I can offer: the record is new, but the paperwork behind it is not — a shelf of physical files, most of them already scanned to PDF. So there is real volume to throw at the upload, not three test files. What I cannot do is build or run a branch; I deploy released images. On a release I can report precisely:
For the shared side I would have to set up a second adult account first; if you want that path exercised before a release, say so and I will arrange it.
One more thing, no code involved: I can read the new account-sharing row as the person who has to follow it. I run this instance and I am the one setting the managed profile up, so I am a fair reader of whether that paragraph is enough — and I will say plainly if it is not.
Same disclosure as in the issue: this reply, and the issue itself, were put together with the help of my own AI agent. It read the code paths with me and did the drafting; the setup, the opinions and the checks on my instance are mine.
MBombeck commentedon Nov 17, 2026
@ch3funio Thanks for being straight about it, and no harm done. I'll build it. The shared side I'll cover with tests here, so you don't need to set up a second adult account. What would help most is what you offered: on the release, upload real scans into the managed profile, rename, delete and restore one, and tell me the storage numbers on the record and on your own account, and who the activity log names. And yes, please read the new account sharing paragraph as the person who has to follow it. I'll post here when it's out.
MBombeck commentedon Nov 18, 2026
@ch3funio This is in 1.48.0, out today (https://github.com/MBombeck/HealthLog/releases/tag/v1.48.0).
From your own account, inside the managed profile, you can now upload scans, open, rename, delete and restore them, have a lab report read and confirm the values into the profile's labs, and switch on automatic reading for the profile. Storage counts against the profile, and its activity log names you. Shared adult accounts stay as they were: documents belong to their owner at every access level.
As you offered: could you put a few real scans into the profile and tell me where it gets in the way? Upload on a phone and the lab read are the two I'm most curious about.
ch3funio commentedon Nov 19, 2026
What works
document", the file processes, and it lands in that record — it does not appear on my own account,
not even by name search. So the document belongs to the profile, as intended.
the open desktop list without a refresh) all behave.
What does not work
1. A guardian's upload is written to the audit trail as the profile's action, not the guardian's.
The release note says "its activity log names you". The row exists, but it names the child:
Rows from my own record name
chefcorrectly; every row created inside the profile names the managed user.The
detailsblob carries onlydocumentIdandmime, so there is no actor anywhere in the row.Server side,
ingest.tswritesauditLog("documents.inbound.store", { userId, … })whereuserIdis therecord, not the guardian — which is right for ownership and wrong for attribution.
2. There is no screen that shows those rows to anyone. The document actions exist only in the admin audit
log, and the "Login overview" page pins
filter=authon every request (login-overview-section.tsx), so evenpicking
documents.inbound.storefrom its action list returns zero — the server ANDs the two filters. Theprofile's own activity feed is deliberately not delegable. Net effect: the guardian cannot see the record of
what they did, and the operator can only reach it through the API.
3. A new document cannot be read by AI on this instance, and the switch cannot be turned on.
Both the document list and the profile's AI settings say: "This server has no AI provider that could read
Bernard's documents, so the switch stays off." That is true — and it is the one case a family self-hoster
hits immediately: my only providers are my own (a local model through a LiteLLM gateway on the LAN, plus a
cloud one), and a managed profile is served only by the instance-wide operator key
(
providerWorkAuthority: guardian →operator-default). A BYOK-only install therefore cannot use thefeature the release note describes ("have a lab report read and confirm the values into the profile's labs").
What I would ask for is the first of these; the second is only about honesty, not about a workaround:
The profile already has its own consent switch ("switching it on records the profile's consent"), so the
consent half exists; only the credential source is pinned to the operator.
instance-wide key to "fix" it: that key is the last entry of every account's chain, so setting it is not
enabling one profile, it is giving the whole instance a default provider that the other accounts never chose
— the opposite of what a consent-based design is for. Naming it in the docs as "managed profiles are served
by the instance key, nothing else" is enough; a self-hoster with only BYOK has to know the feature is out of
reach until that changes.
4. Storage is not visible anywhere, so "counts against the profile" cannot be checked.
The "used X of Y" line only renders when the instance has a quota set and usage is at least 80%
(
upload-zone.tsx:quotaBytes > 0 && usedFraction >= 0.8). With no quota configured there is no number atall — on the profile or on my own account. I confirmed the ownership the other way round (the file is in the
profile and nowhere in my own vault), but the paragraph promises a number a person can read.
5. The preview sheet has no Save button and no saved indicator. Title, kind and date save on commit, which
is fine once you know it — I edited three fields, closed the sheet assuming nothing had been written, and
found it had. A "Saved" line, or a Save button, would remove the guess.
6. On a phone the PDF preview never shows; downloading does work. Tapping a document opens the sheet,
the metadata is there, but the preview area shows Chrome's "This content is blocked. Contact the site owner
to fix the issue." Downloading from the same sheet works on the phone — Chrome warns about the insecure
origin and the download completes after confirming. On the desktop, over the same plain-http address, the
preview renders and the download also asks for a confirmation. So the only thing that genuinely does not
work on the phone is the in-app preview; whether that is Chrome refusing to frame a PDF or the plain-http
origin I cannot tell from here, because this instance is LAN-only with no HTTPS host to compare against.
Noting it as a mobile observation, not filing it as a bug.
7. Secondary, probably unrelated to this feature: upload from Google Drive fails on a phone. Every PDF I
tried through the Drive picker ends in "Upload failed"; the same file saved locally on the phone uploads
fine, and the same file from the desktop uploads fine. I am not filing it separately for now — mentioned in
case it is the same mobile upload path you are already touching.
Small notes
genuinely exercised.
it should.
Disclosure: this report was put together with my own local AI assistant, which also read the code paths in
tag v1.48.1. The setup, the uploads and the observations are mine.
MBombeck commentedon Nov 19, 2026
@ch3funio Thanks for testing with a real shelf. Going through your list:
MBombeck commentedon Nov 20, 2026
@ch3funio In 1.48.3, out now (https://github.com/MBombeck/HealthLog/releases/tag/v1.48.3):
Still open from your list: a screen for these audit rows, AI chains per profile, and the Google Drive picker (the error ID would help).
feat(admin): name the acting account in the audit log viewer
feat(documents): say when a detail-sheet edit was saved
feat(documents): always show the record's storage use
docs(sharing): state that managed profiles use only the server AI key
fix(documents): skip the PDF frame where the browser has no PDF viewer
1 remaining item
ch3funio commentedon Nov 20, 2026
Unrelated, from the same log: one page load produced
POST /api/internal/web-vitals 400. The route answers 400 only for an unparseable body or a schema miss (the schema is strict with a closed metric list), and the client sends exactly the six fields the schema names, so it is worth a glance but not an issue on its own. The reporter samples one page load in ten, so this is not every load.MBombeck commentedon Nov 22, 2026
@ch3funio Thanks for retesting all of it, and for the storage numbers.
The last open point from your list, AI for the profile, is on the branch for 1.49.0 and ships with that release. Under Settings, AI inside the profile, a guardian picks where the profile's AI comes from: the server's key as before, none, or one of the guardian's own provider chains. A lent chain serves only its own entries, and if the guardian loses the profile or deletes the chain, the profile gets nothing instead of falling back to the server key. The managed profile card in your own account also shows the profile's activity. Once 1.49.0 is merged, the
:edgeimage has it too. I'll leave this open until it's out.Google Drive: thanks for the trace. One successful request and nothing for the failed attempt means the upload never left the phone, so the browser failed to read the file the Drive picker handed over before HealthLog saw it. I don't have a fix for that part yet.
The
web-vitals400: worth the glance. Chrome reports a page it had discarded and loaded again with the navigation typerestore, and the schema doesn't list that value, so the whole report is refused. Harmless, but a bug, and it goes into a fix onmain.MBombeck commentedon Nov 23, 2026
@ch3funio 1.49.0 is out: https://github.com/MBombeck/HealthLog/releases/tag/v1.49.0
As promised, the last open point is in. Under Settings, AI inside the profile you pick where the profile's AI comes from: the server's key, one of your own chains, or "No AI provider". The managed profile card in your own account shows the profile's activity, and the admin audit log now picks actions by family, so your uploads into the profile are one pick away under documents. You can also make the profile's emergency card, calendar feed and scheduled report from your account.
When you have a moment on your instance, could you attach one of your chains to the profile and tell me whether a document read goes where you expect? Thank you again for the patient testing.
ch3funio commentedon Nov 25, 2026
Attached the chain and ran a read, so here is the answer you asked for — the profile's AI does go where the guardian pointed it.
What I set, and what happened
What the read left me without
The chain is fine; these are about a read being background work whose result is not where a person looks for it. With a slow local chain every step is long enough to notice, which is why I ran into them — I make no claim about how they feel on a fast one.
Nothing on the document says a read is running. I started one, read "reading in the background, you can leave this page", left, came back — every button was active again as if nothing had happened, while the run had not finished. The card in the document list says nothing either. In the code the card's chip is
!hasContentIndex && uploaded < 3 minutes, i.e. it answers "a fresh upload is not indexed yet", not "a read is running on this document". With the run record you already keep server-side (the one behind the failure card from [Feature] Named provider chains, attachable per capability — one default for everyone, custom where it matters #1404), the card could show "reading…" and the sheet could re-attach to a run in flight instead of offering the action again.The result has no address. After a few minutes the toast said "AI read your document" and nothing I could see was filled in — not the summary block, not the text panel. Where the read's output went is not something the UI tells me; the only place text does appear is the button that reads the document again, which is point 3. Whatever the read produced, say in the toast where it landed.
"Show extracted text" reads the document again, and closing the sheet throws the answer away. Two clicks on the same document: 196 s and 90 s, two identical prompts 111 s apart, the panel blinking while it worked. Close the sheet and the text is gone — reopen and the button offers the read again.
describe.tsis explicit that this is by design ("session-only … nothing here persists"), andAiRunPhaseNoteeven distinguishes "saved with the document" from "shown here". But the label promises stored text, and the request I closed the sheet on kept running on the model for another minute afterwards, GPU fan and all.Two summaries, one keeps and one forgets. In the summary block, "Wygeneruj podsumowanie" stores onto the document (
persist: true), and a second open shows the paragraph. In the AI action row right below, "Podsumuj" calls the same route with the same prompt but withoutpersist, which defaults to false — so the paragraph appears once and is dropped on close. Same wait, same model, two different fates, and nothing in the two labels tells them apart. I would keep one: let "Podsumuj" store like "Wygeneruj podsumowanie", or drop it. One small inconsistency while you are there: the route header saysmode=summarypersists onto the row since v1.30.31, while the client sendspersist=trueexplicitly and defaults it off.A model-side note, because it explains "it read it but wrote nothing": the two lab-fact reads filled the model's 8192-token context exactly — 4071 + 4121 and 4042 + 4150 — so the JSON of extracted values was cut at the limit while
finish_reasonstill saidstop. Nothing the app can do about an 8 k window, but a read that hits it could say "the model's context ended before the list did" instead of leaving the review empty.None of this is about the chain. It is that a "reading…" state, one summary action that keeps its result, and one line saying where the result landed would make a slow local chain usable for a guardian in exactly the setup this issue was about.
test(e2e): pin the stored summary and the session-only extracted text
MBombeck commentedon Nov 26, 2026
@ch3funio Thank you for running a real chain on real paperwork and writing down exactly where it got in the way. A slow local chain shows things a fast one hides, and you caught all of them. Point by point:
stop. The rows before the cut are kept and the read is marked incomplete instead of coming back empty (fix(ocr): read a reply that ends inside its JSON as cut #1543).The fixes are on
:edgenow and ship in v1.49.1 on Saturday 28 November.MBombeck commentedon Nov 26, 2026
@ch3funio Thank you for running a real read through the lent chain, and for checking the gateway log to make sure it went where you pointed it. Good to hear the chain holds. Your four points, plus the context note:
Points 2, 4 and 5 are on
:edgenow and ship in v1.49.1 on Saturday 28 November. Points 1 and 3 come with a feature release.feat(managed-profiles): AI provider source and activity feed per profile
feat(admin): pick audit actions by family in the audit log
fix(ocr): read a reply that ends inside its JSON as cut
fix(documents): keep the summary from every summary action
MBombeck commentedon Nov 28, 2026
@ch3funio 1.49.1 is out: https://github.com/MBombeck/HealthLog/releases/tag/v1.49.1
From your chain test, it brings the parts that were fixes: a read that a model cut off keeps the values it already had and says it stopped early, a chain with no provider says so in Settings, AI, and the log lines carry the real duration. Refs #1403