Repository navigation
Description
Part of #649. It also takes the test coverage line from #656, which closed.
Benchmark
| Field | Value |
|---|---|
| Metric | (1) Exact: literal ~ folders under apps/hocuspocus.server, and their size in KiB, after the Step 2 probe. (2) bun test wall time in apps/hocuspocus.server, in seconds, coverage on vs off. (3) Exact: bunfig.toml line count. |
| Before | (1) 1 folder, 156,644 KiB (du -sk 'apps/hocuspocus.server/~', maintainer laptop, read 2026-11-11). The Step 2 probe creates ./~. (2) Not measured yet (agent in the repo, Step 4). (3) 39 lines (wc -l, HEAD 0b302b222, 2026-11-11). Offline image probe: not measured yet (agent in the repo, before Step 5). |
| After | From the 2026-11-12 Measured comment, 45edac16a: (1) the probe creates 0 folders. The old laptop folder is still there, because Step 1 is the maintainer's. (2) 16.21 s with coverage off, against 16.93 s, median of 5, 1209 pass and 0 fail both sides. (3) 11 lines. dist/ sha256 list identical. Offline image probe passes. |
| Condition | Named laptop (model, cores, RAM, OS), Bun 1.4.4, HEAD SHA, warm runs, no other load. Backend image built from the same commit. |
| How to run | (1) du -sk 'apps/hocuspocus.server/~', then the Step 2 probe and find . -maxdepth 1 -name '~'. (2) From apps/hocuspocus.server, bun test 5 times; median and min–max, pass and fail counts. (3) wc -l apps/hocuspocus.server/bunfig.toml. Image: docker run --rm --network none --entrypoint sh <image> -c 'cd /app/apps/hocuspocus.server && bunx [email protected] --version'. |
| Pass rule | 0 folders, 0 B, and the probe creates none. bun test: same pass count, 0 fails. Offline image probe passes. dist/ sha256 list identical. Stop rule: any Guard item fails, then revert the one commit and redeploy the backend. |
| Guard | 🩺 Verify Deployment passes on the (build): back deploy, and the migrate step logs no download. |
| Owner | Agent in the repo: Step 0 and Steps 2 to 7, the image and build checks, the Measured comment. Maintainer: Step 1 on the laptop that holds the folder, and the deploy. |
| Claim | Internal, not marketing: "Turning off default coverage cut the backend unit suite from s to s (median of 5, )." |
Problems
Verified 2026-10-31.
[install.cache] dir = "~/.bun/install/cache"makes a literal~folder. The runtime (bun <file>) reads this file and auto-installs a bare import. WithHOMEunset, Bun keeps~literal and writes./~/.bun/install/cache. Any machine that ran the backend withHOMEunset may hold this folder. It is gitignored (.gitignore:177), holds no tracked files, and took writes up to 2026-10-21. Step 1 removes it. The size goes only in Measured.- The
[install]and[install.cache]keys never apply to installs. In a workspace,bun installandbun addread only the rootbunfig.toml, even when run from this folder. Measured: a memberexact = trueleftbun addwriting^3.0.1; a rootexact = truewrote1.0.0. - The
[run] bun = truecomment is wrong. It says "Automatically install missing dependencies when running". The option puts anodelink tobunfirst onPATH. Keep the setting, because the Prisma CLI has anodeshebang and the entrypoint runs it. Write the comment as: "Puts a node link to bun first on PATH, so the Prisma CLI in the entrypoint runs on Bun." [test] coverage = true(:21) makes everybun testpay for coverage. No CI job reads it:backend-ci.yml:41-42uses only the exit code.test:coveragealready exists.- Lines that restate defaults: the top comment,
[run] silent = false, the six image[loader]lines (28-33), the "Optimize runtime performance" comment, and the empty[macros]and[alias]sections. Keep.node = "napi", because thebuildscript runsbun build, where.nodedefaults tofile. The build check in Verification proves the[loader]lines are defaults.
This file ships in the production image
The backend Dockerfile (apps/hocuspocus.server/docker/Dockerfile.bun:31) copies apps/hocuspocus.server into the image. The entrypoint runs an offline bunx [email protected] migrate deploy from that folder, from a cache warmed at build time (Dockerfile.bun:113). rest-api, hocuspocus-server and the worker read this file. So a removed [install.cache] dir, [run] or [loader] line can break boot or the save path. The image check and the production-safety checks below cover that.
Steps
- 0. Before. Record
du -sk 'apps/hocuspocus.server/~'andwc -l apps/hocuspocus.server/bunfig.toml. Build the backend image and run the offline image probe from Benchmark. It must pass. Runbun run buildinapps/hocuspocus.server, thenshasum -a 256 dist/*, and save the list. - 1. Remove the old folder first. If
apps/hocuspocus.server/~exists, remove it. If not, skip and say so. From the repo root, check thatgit ls-files 'apps/hocuspocus.server/~'prints nothing. Then runrm -rf -- 'apps/hocuspocus.server/~'. Always quote the tilde. An unquoted~expands to your home folder, andrm -rf ~deletes it. - 2. Probe before the change. From
apps/hocuspocus.server, runT=$(mktemp -d). Write$T/x.tswith an import of a package that is not in the repo, such asis-odd. Runenv -u HOME bun "$T/x.ts". It creates./~. - 3. Remove that probe folder the same way, with the path in quotes.
- 4. From
apps/hocuspocus.server, runbun test5 times. Record median and min–max wall time, and pass and fail counts. - 5. Delete the
[install]and[install.cache]blocks, thecoverage = trueline, and the lines in Problem 5. Fix the[run]comment. - 6. Probe after the change. Run the step 2 command again. Then
find . -maxdepth 1 -name '~'must print nothing. - 7. From
apps/hocuspocus.server, runbun test5 times again. Record median and min–max wall time, and pass and fail counts. Expect the same pass count and 0 fails. Post both sets on this issue.
Verification
-
cd apps/hocuspocus.server && bun testpasses; it reads this file's[test]preload. The step 6 probe leaves no~folder. - Build check:
bun run build, thenshasum -a 256 dist/*. The list matches the Step 0 list. If it differs, restore the[loader]lines. - Image check: rebuild the backend image from the change. The offline image probe passes.
Production safety, on the (build): back deploy
-
🩺 Verify Deploymentpasses, and the migrate step logs no download. Met on06f61ee44((build): front back, run 43876524495, 2026-11-16), which holds45edac16a. The migrate log shows "No pending migrations to apply." and no download.
Status 2026-11-16: one step is left. The maintainer does Step 1 on the laptop, with the tilde in quotes. Then close.
Rollback
Run #554 SP1, then git revert the commit. Push a (build): back commit. Then re-run the Guard and the offline image probe.
Activity
HMarzban commentedon Nov 12, 2026
Measured, 2026-11-12
Condition: MacBook Mac17,6, 18 cores, 48 GiB RAM, macOS 27.0.1 (26A434). Bun 1.4.4. Docker 29.8.2. HEAD
cfac48d87plus the change now committed in45edac16a(not pushed yet). Date 2026-11-12. Other agent tracks ran on the same laptop, so load average was 6 to 14 during the test runs; each run line records it.~folders the Step 2 probe creates./~, 48 KiB, in a scratch folder holding only the HEAD bunfig). In the real folder it wrote 6 entries into the old./~.node_modules/.bun-cacheinstead.apps/hocuspocus.server/~folderdu -sk)bun testwall time, median of 5 (min to max)bun test --coverageon the new filewc -l apps/hocuspocus.server/bunfig.tomldist/sha256 list, same build args--network none,bunx [email protected] --version)bunx [email protected] migrate deploy, fake DB URLP1001, no downloadP1001, no downloadHow to run:
env -u HOME bun "$T/x.ts"fromapps/hocuspocus.server, where$T/x.tsimportsis-odd. Thenfind . -maxdepth 1 -name '~'./usr/bin/time -p bun testinapps/hocuspocus.server, after one warm-up run, 5 times. The control adds--coverage.bun build src/index.ts src/hocuspocus.server.ts src/hocuspocus.worker.ts --outdir=<empty scratch dir> --target=bun, thenshasum -a 256 *. These are thebuildscript's arguments. A clean outdir avoids stale files indist/.docker build -f apps/hocuspocus.server/docker/Dockerfile.bun -t <tag> ., thendocker run --rm --network none --entrypoint sh <tag> -c 'cd /app/apps/hocuspocus.server && bunx [email protected] --version'.Reading:
.node = "napi"line is still needed. A build with--loader .node:filechangedindex.js./app/apps/hocuspocus.server/~folder, in both the before and the after image. Root.dockerignoredrops its.buncontents but not the folder. A CI checkout has no such folder. Step 1 on the laptop removes it from laptop builds.Claim: "Turning off default coverage cut the backend unit suite from 16.93 s to 16.21 s (median of 5, Mac17,6, Bun 1.4.4)." A same-session control puts the coverage cost at 0.46 s.
Not measured: Step 1 (maintainer). Production guard:
🩺 Verify Deployment, the migrate log, #554 SP6 with a fast tab close, store gauges at +1 h and +24 h, and thedocker execcheck for~in each backend container (maintainer).Evidence:
Notes/local-docs/2026-11-11-v236-evidence/batch-a/t7-653-657/657-*.build(hocuspocus): drop bunfig keys that never applied
fix(hocuspocus): state what [run] bun = true does in bunfig.toml
HMarzban commentedon Nov 14, 2026
Moved to v2.3.7 at the v2.3.6 release audit. Before and after are posted. Step 1 and the production guard checks are not done yet.
HMarzban commentedon Nov 16, 2026
Review, 2026-11-16 (maintainer approved).
06f61ee44(run 43876524495) holds45edac16aand passed🩺 Verify Deployment. The migrate log shows no download. That box is ticked.dist/hashes.docker execcheck for~is cut. A CI checkout never has that folder, so the check cannot fail.HMarzban commentedon Nov 24, 2026
Measured, 2026-11-24: Step 1 completed
Question: Does the stray literal
~folder remain inapps/hocuspocus.server?Verdict: Removed and verified clean; closing #657.
git ls-files 'apps/hocuspocus.server/~'printed nothing.du -sk 'apps/hocuspocus.server/~'measured156,644KiB before removal.apps/hocuspocus.server/~(rm -rf -- 'apps/hocuspocus.server/~');test ! -e 'apps/hocuspocus.server/~'passes.Measuredchecks and 2026-11-1606f61ee44deploy (🩺 Verify Deploymentpass), all acceptance items are complete (156,644 -> 0KiB,100 %removed).