watcher: archive copy reads the whole note into memory (io.ReadAll), with no size cap #198

Open
opened 2026-10-05 21:47:40 +00:00 by mathias · 0 comments
Owner

Source: PR #195 review round 2 (non-blocking), 2026-10-05.

copyFromRoot in ingestion/internal/watcher/watcher.go now reads the source note with io.ReadAll and writes it with brainfs.PutFile, so the write goes through real directories (#158).

  • For .md and .txt this doubles peak memory, since TextIn already reads the whole file.
  • For .pdf it is a new full in-memory copy, and there is no upstream size cap.
  • A big drop into raw/ can therefore push the ingestion pod towards its memory limit.

Fix options:

  • Stream through a CreateRegular-style writer (an open handle checked like PutRegular, then io.Copy).
  • Or cap the size with ReadRegularMax and refuse oversize notes into raw/failed with a clear reason.

Created via git-mcp on behalf of @mathias

**Source:** PR #195 review round 2 (non-blocking), 2026-10-05. `copyFromRoot` in `ingestion/internal/watcher/watcher.go` now reads the source note with `io.ReadAll` and writes it with `brainfs.PutFile`, so the write goes through real directories (#158). - For `.md` and `.txt` this doubles peak memory, since TextIn already reads the whole file. - For `.pdf` it is a new full in-memory copy, and there is no upstream size cap. - A big drop into `raw/` can therefore push the ingestion pod towards its memory limit. **Fix options:** - Stream through a `CreateRegular`-style writer (an open handle checked like PutRegular, then `io.Copy`). - Or cap the size with `ReadRegularMax` and refuse oversize notes into `raw/failed` with a clear reason. --- _Created via git-mcp on behalf of @mathias_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/hyperguild#198