Skip to content

docs(docs): record eager file hashes in adr 0007 - #221

Merged
Exeloo merged 1 commit into
feat/handle-onlinefrom
docs/adr-eager-file-hashes
Nov 5, 2026
Merged

Exeloo merged 1 commit into
feat/handle-onlinefrom
docs/adr-eager-file-hashes

Conversation

@Exeloo

@Exeloo Exeloo commented Nov 5, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Stacked on #220 (feat/handle-online). No linked issue: it records a decision made in the review of #214 (cache system with OPFS).

Adds docs/adr/0007-eager-file-hashes.md. The server hashes every file when a project is listed (eager), rather than when a file is read (lazy). Opening a project takes one longer load, and after that every cached file opens from OPFS with no request to the server.

The ADR also covers:

  • Alternatives: lazy hashing, where knownHash goes to readMany and the cost is one round trip per first read; and hashing in the background, which needs a push channel.
  • Consequences: the first open reads every byte not yet hashed. That happens again after a ctime or inode change, and on every open past 50 000 files across all of the server's projects (LRU). It is worth revisiting for the hosted editor (phase 14).
  • Open item: FileHashes._load drops the older file-hashes.json format. Only pre-review builds of feat: add cache system with OPFS #214 wrote it, so converting it is optional.

Docs only, no code change.

Merge danger

Low. Docs only, and a two-way door. It merges with the rest of the stack.

Follow-up issues

None filed. Candidate: the comment at packages/server-core/src/fs/file-hashes.ts:120 says older saved files are dropped, but that format never shipped on main. It can be fixed in #214's own review loop.

Quality gate

Lane Result
Docs The change is the doc itself
Correctness reviewer: no blocking findings. 1 important and 1 minor finding, both fixed (framing of the older format, skip list); 1 question fixed (git checkout re-hashes only the files git rewrites)
Performance Not applicable (docs only)
Accessibility Not applicable (docs only)
Security Not applicable (docs only)
Style Commitlint scope and lowercase subject OK; prettier --check passes

How do you test this PR?

Read docs/adr/0007-eager-file-hashes.md, and check its claims against packages/server-core/src/fs/fs-service.ts (list, _readOne), packages/server-core/src/fs/file-hashes.ts, packages/server-core/src/project/project-registry.ts and packages/project/src/fs/project-fs.ts (refresh, _fetch). Checked at the head of feat/handle-online.

pnpm exec prettier --check docs/adr/0007-eager-file-hashes.md

@Exeloo
Exeloo requested a review from Tchips46 as a code owner November 5, 2026 14:09
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 5, 2026
@Exeloo
Exeloo added this pull request to stack #212 November 5, 2026 14:16
Tchips46
Tchips46 previously approved these changes Nov 5, 2026
@Exeloo
Exeloo merged commit 0c909e1 into main Nov 5, 2026
5 checks passed
@Exeloo
Exeloo deleted the docs/adr-eager-file-hashes branch November 5, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants