CLAUDE.md gains the 'Fix open issues' process (research newest maintained dependencies via Meteor 3 docs/issues/forums, atmosphere/packosphere/npm, add tests+negative+UI tests, commit format). docs/Security/Sandboxes/vscode/README.md documents a version-matched from-scratch toolchain in .tools/ (Node v24.18.0, npm, Meteor 3.5, newest Go for FerretDB) to build the WeKan bundle + FerretDB and run all tests, and notes Docker/podman is unavailable in the Flatpak sandbox. server/00waitForMongo.js keeps the Meteor.startup wait but documents the #6500 finding: accounts-base creates the users index before app hooks, so a top-level await here deadlocks — the reliable fix is the docker-compose healthcheck. Thanks to xet7.
Secure Sandbox: VSCode at Debian 13 amd64
Related files at this repo .vscode at this commit.
1) Install Debian
Install Debian with username wekan, so that WeKan repo here, only directory where VSCode will have access:
/home/wekan/repos/wekan
2) Install Flatpak and VSCode
sudo apt install flatpak
sudo apt install gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
sudo reboot
flatpak install flathub com.visualstudio.code
3) Edit VSCode desktop icon
nano ~/.local/share/applications/wekan-vscode.desktop
Content:
[Desktop Entry]
Name=VS Code - WeKan
Comment=Open the WeKan project with Flatpak
Exec=flatpak run com.visualstudio.code /home/wekan/repos/wekan
Icon=com.visualstudio.code
Terminal=false
Type=Application
Categories=Development;IDE;
StartupWMClass=code
4) Force VS Code to use the internal (isolated) browser
This setting is also added as git commit to VSCode settings.
This is the most important step. If this is "native", it will use the operating system window that sees everything.
- Open VS Code.
- Press
Ctrl + ,(options). - Type in search: Dialogs: Custom
- Change the
Files: Simple Dialogsetting to on (check the box). - Restart VS Code.
5) Set the strictest sandbox possible (in Terminal)
Run these two commands (the first clears everything, the second sets limits):
# Reset previous attempts
sudo flatpak override --reset com.visualstudio.code
# Block EVERYTHING except the display and the wekan folder
sudo flatpak override com.visualstudio.code \
--nofilesystem=home \
--nofilesystem=host \
--nofilesystem=xdg-run/gvfs \
--nofilesystem=xdg-run/gvfsd \
--filesystem=~/repos/wekan:rw \
--device=all \
--socket=wayland \
--socket=x11 \
--share=network
If you have already set wrong Chrome sandbox env earlier, remove it:
sudo flatpak override --unset-env=CHROME_DEVEL_SANDBOX com.visualstudio.code
Why: inside this Flatpak, /usr/sbin/chrome-devel-sandbox does not exist, and Chromium aborts immediately if that env points there.
6) Test "File -> Open Folder"
Now when you go to File -> Open Folder:
- You will no longer see the fancy system file window, but VS Code's own, simple list.
- If you try to go to the parent folder or somewhere else, the list is empty or it only shows
~/repos/wekan.
7) Where existing binaries are (verified)
These were found already present in this sandboxed setup:
- Node.js:
/home/wekan/repos/wekan/.tools/node-v22.13.1-linux-x64/bin/node - npm:
/home/wekan/repos/wekan/.tools/node-v22.13.1-linux-x64/bin/npm - npx:
/home/wekan/repos/wekan/.tools/node-v22.13.1-linux-x64/bin/npx - Meteor CLI symlink:
/home/wekan/.meteor/meteor - Playwright Chromium binary:
/home/wekan/.var/app/com.visualstudio.code/cache/ms-playwright/chromium-1223/chrome-linux64/chrome - Flatpak-provided chrome-sandbox binary (not SUID in this runtime):
/app/extra/vscode/chrome-sandbox
8) Reuse same in-sandbox toolchain (tested)
Open VS Code integrated terminal and run:
cd /home/wekan/repos/wekan
# 1) Use repo-local Node/npm/npx
export PATH="$PWD/.tools/node-v22.13.1-linux-x64/bin:$PATH"
# 2) Use Meteor CLI installed at ~/.meteor (if present)
export PATH="/home/wekan/.meteor:$PATH"
# 3) IMPORTANT: avoid bad host path inherited from old overrides
unset CHROME_DEVEL_SANDBOX
# 4) Keep Playwright browsers in Flatpak-private cache
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.visualstudio.code/cache/ms-playwright"
Quick checks:
node -v
npm -v
npx playwright --version
meteor --version
If meteor is missing first time, bootstrap it from local Node:
cd /home/wekan/repos/wekan
export PATH="$PWD/.tools/node-v22.13.1-linux-x64/bin:$PATH"
npx -y meteor
export PATH="/home/wekan/.meteor:$PATH"
If you keep --nofilesystem=home, allow Meteor directory explicitly:
sudo flatpak override com.visualstudio.code --filesystem=~/.meteor:rw
9) Run tests fully inside sandbox (headless)
Install Playwright deps and run Chromium-only tests:
cd /home/wekan/repos/wekan/tests/playwright
export PATH="/home/wekan/repos/wekan/.tools/node-v22.13.1-linux-x64/bin:$PATH"
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.visualstudio.code/cache/ms-playwright"
npm install
npx playwright test --project=chromium
This runs headless browser tests inside Flatpak sandboxed VS Code terminal (no external/native browser window needed).
Run Firefox/WebKit too
By default this repo runs only the chromium Playwright project.
To enable firefox and webkit projects, set:
export WEKAN_PLAYWRIGHT_ALL=1
Then run for example:
cd /home/wekan/repos/wekan/tests/playwright
export HOME="/home/wekan/repos/wekan/.tools"
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.visualstudio.code/cache/ms-playwright"
export WEKAN_PLAYWRIGHT_ALL=1
/home/wekan/repos/wekan/.tools/.meteor/meteor npm exec playwright test -- --project=firefox
/home/wekan/repos/wekan/.tools/.meteor/meteor npm exec playwright test -- --project=webkit
Without WEKAN_PLAYWRIGHT_ALL=1, Playwright config exposes only chromium, and --project=firefox/--project=webkit will fail with "Project not found".
If playwright install-deps fails because of unrelated apt repo keys
On some hosts, this command can fail even when browser deps are already installed:
sudo npx playwright install-deps
Example failure:
NO_PUBKEY ...The repository ... is not signed
This is usually caused by a third-party apt source (PPA/repo), not by Playwright itself.
Use either of these approaches:
- Install required packages directly (recommended fallback):
sudo apt install -y \
libgtk-4-1 \
libxml2 \
libevent-2.1-7t64 \
libflite1 \
libjpeg-turbo8 \
libmanette-0.2-0 \
libenchant-2-2 \
libwoff1
- Or temporarily disable the broken third-party apt source, run
install-deps, then re-enable it.
In this sandbox workflow, manual apt package install is enough and avoids failures caused by unrelated repositories.
Verified WebKit status in this setup
After applying the sandbox env settings from this document and running with:
cd /home/wekan/repos/wekan/tests/playwright
export HOME="/home/wekan/repos/wekan/.tools"
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.visualstudio.code/cache/ms-playwright"
export WEKAN_PLAYWRIGHT_ALL=1
/home/wekan/repos/wekan/.tools/.meteor/meteor npm exec playwright test -- --project=webkit
validated result:
105 passed(WebKit project)
10) Optional smoke test for headless Chromium in sandbox
cd /home/wekan/repos/wekan/tests/playwright
export PATH="/home/wekan/repos/wekan/.tools/node-v22.13.1-linux-x64/bin:$PATH"
unset CHROME_DEVEL_SANDBOX
node -e "(async()=>{const {chromium}=require('playwright');const b=await chromium.launch({headless:true,args:['--no-sandbox']});const p=await b.newPage();await p.goto('about:blank');console.log('PW_OK');await b.close();})().catch(e=>{console.error(e);process.exit(1);});"
If output is PW_OK, headless Chromium launch is working inside sandbox.
11) Additional findings from real test runs (important)
These were verified while running the full Playwright suite in this exact sandbox setup.
A) Wekan app startup for tests requires WRITABLE_PATH
If WRITABLE_PATH is missing, app startup can fail with:
WRITABLE_PATH environment variable missing and/or unset
Use a local writable test directory before starting app:
cd /home/wekan/repos/wekan
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
Then run app:
/home/wekan/.meteor/meteor --port 3000
B) Playwright seed helpers require mongosh
Playwright fixtures seed test data via tests/playwright/helpers/db.js, which calls mongosh.
If missing, tests fail early with:
Error: spawnSync mongosh ENOENT
Install mongosh as a dependency in Playwright test project:
cd /home/wekan/repos/wekan
/home/wekan/.meteor/meteor npm --prefix tests/playwright install mongosh
The helper now also searches tests/playwright/node_modules/.bin so this works in sandbox without system-wide mongosh.
C) If repo-local .tools/node... does not exist
In some sandboxes the .tools Node path is missing. You can still run commands via Meteor wrapper:
/home/wekan/.meteor/meteor npm -v
/home/wekan/.meteor/meteor npm exec playwright --version
D) Proven working execution order
Terminal 1 (start app):
cd /home/wekan/repos/wekan
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
unset CHROME_DEVEL_SANDBOX
/home/wekan/.meteor/meteor --port 3000
Terminal 2 (run tests):
cd /home/wekan/repos/wekan/tests/playwright
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.visualstudio.code/cache/ms-playwright"
/home/wekan/.meteor/meteor npm exec playwright test -- --project=chromium
Expected result from this validated setup:
105 passed(Chromium project)
12) About meteor test in this sandbox
meteor test --driver-package meteortesting:mocha can start successfully but still report 0 passing in this environment due to test discovery/driver behavior.
For reliable headless validation inside this sandbox, prefer Playwright run described above.
If you get EROFS errors writing to ~/.meteor/packages (read-only home mount), run Meteor from the repo-local copy and point HOME to .tools:
cd /home/wekan/repos/wekan
export HOME="$PWD/.tools"
unset METEOR_WAREHOUSE_DIR
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
unset CHROME_DEVEL_SANDBOX
"$PWD/.tools/.meteor/meteor" test --once --driver-package meteortesting:mocha --full-app --test server/lib/tests/attachmentApi.authContext.tests.js
13) Quick copy-paste: prepare + run Chromium tests
Use this when you want one command block that prepares required paths/dependencies and runs Playwright Chromium tests.
Note: this assumes Wekan app is already running at http://localhost:3000 in another terminal.
cd /home/wekan/repos/wekan
# Ensure test writable directories exist
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
# Sandbox-safe browser env
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.visualstudio.code/cache/ms-playwright"
# Ensure Playwright-side mongosh exists for DB seeding
/home/wekan/.meteor/meteor npm --prefix tests/playwright install mongosh
# Run Chromium tests
cd tests/playwright
/home/wekan/.meteor/meteor npm exec playwright test -- --project=chromium
If you also need to start app in a separate terminal:
cd /home/wekan/repos/wekan
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
unset CHROME_DEVEL_SANDBOX
/home/wekan/.meteor/meteor --port 3000
14) Minimal copy-paste only (no explanations)
Terminal 1:
cd /home/wekan/repos/wekan
export WRITABLE_PATH="$PWD/.test-writable"
mkdir -p "$WRITABLE_PATH/files/attachments" "$WRITABLE_PATH/files/avatars"
unset CHROME_DEVEL_SANDBOX
/home/wekan/.meteor/meteor --port 3000
Terminal 2:
cd /home/wekan/repos/wekan
unset CHROME_DEVEL_SANDBOX
export PLAYWRIGHT_BROWSERS_PATH="/home/wekan/.var/app/com.visualstudio.code/cache/ms-playwright"
/home/wekan/.meteor/meteor npm --prefix tests/playwright install mongosh
/home/wekan/.meteor/meteor npm --prefix tests/playwright exec playwright test -- --project=chromium
15) From-scratch toolchain in .tools/ — VERSION-MATCHED build + test (verified)
When a sandbox has NO pre-installed .tools/ Node and no ~/.meteor (a bare box, any
Linux arch), install everything into the repo-local .tools/ directory yourself. Both
.tools/ and .build* are in .gitignore, so nothing here is ever committed.
IMPORTANT — use the SAME versions WeKan/FerretDB use, not whatever is newest:
- Node.js: the exact
NODE_VERSIONfromDockerfile(currentlyv24.18.0). - npm: the
NPM_VERSIONfromDockerfile(currently11.12.1; the npm bundled with the pinned Node is acceptable if pinning fails). - Meteor: the release in
.meteor/release(currentlyMETEOR@3.5). - Go (for FerretDB ONLY): the NEWEST Go release (
https://go.dev/VERSION?m=text) — this is intentionally newer thanFerretDB/build.sh's pinnedGO_VERSION.
Detect the arch (uname -m → x86_64=x64/amd64, aarch64=arm64) and pick the
matching tarballs.
cd /home/wekan/repos/wekan # your repo path
mkdir -p .tools && cd .tools
A=arm64 # or x64 for Node / amd64 for Go on x86_64
# Node — EXACT Dockerfile NODE_VERSION:
curl -fsSL -o node.tar.xz "https://nodejs.org/dist/v24.18.0/node-v24.18.0-linux-$A.tar.xz"
tar xf node.tar.xz && rm node.tar.xz
# Go — NEWEST release, for building FerretDB:
curl -fsSL -o go.tar.gz "https://go.dev/dl/$(curl -fsSL https://go.dev/VERSION?m=text|head -1).linux-$A.tar.gz"
tar xf go.tar.gz && rm go.tar.gz
cd ..
export PATH="$PWD/.tools/node-v24.18.0-linux-$A/bin:$PWD/.tools/go/bin:$PATH"
node -v && go version
# Meteor — the release from .meteor/release, installed under HOME=.tools so it never
# touches a read-only ~/.meteor:
HOME="$PWD/.tools" sh -c 'curl -fsSL "https://install.meteor.com/?release=3.5" | sh'
export PATH="$PWD/.tools/.meteor:$PATH"
Build FerretDB + run its full unit test suite (verified: all pass)
cd /home/wekan/repos/wekan/FerretDB
export GOROOT="$PWD/../.tools/go" GOPATH="$PWD/../.tools/gopath" \
GOCACHE="$PWD/../.tools/gocache" GOMODCACHE="$PWD/../.tools/gomodcache" \
GOFLAGS=-mod=mod PATH="$PWD/../.tools/go/bin:$PATH"
( cd build/version && go run generate.go ) # stamps the version (or --version panics)
go build -o bin/ferretdb ./cmd/ferretdb # -> FerretDB/bin/ferretdb
go test -short -tags=ferretdb_debug ./internal/... ./cmd/... # all packages: ok
Build the WeKan bundle to .build/bundle (verified)
cd /home/wekan/repos/wekan
export HOME="$PWD/.tools" PATH="$PWD/.tools/node-v24.18.0-linux-arm64/bin:$PWD/.tools/.meteor:$PATH"
export TOOL_NODE_FLAGS="--max-old-space-size=8192" NODE_OPTIONS="--max-old-space-size=8192"
meteor npm install
meteor build .build --directory # -> .build/bundle/main.js
npm install --prefix .build/bundle/programs/server # server deps, needed to RUN the bundle
Run the WeKan unit tests (verified)
cd /home/wekan/repos/wekan
export PATH="$PWD/.tools/node-v24.18.0-linux-arm64/bin:$PATH"
npm run test:unit:node # plain-node .cjs unit + negative tests (no DB/browser)
For the Playwright UI tests, follow sections 9–14 above (they need a running WeKan app +
mongosh for DB seeding).
Run the built bundle against FerretDB (what the Docker image does)
cd /home/wekan/repos/wekan; T="$PWD/.tools"; D="$PWD/.test-writable"
mkdir -p "$D/db" "$D/files/attachments" "$D/files/avatars"
# 1) FerretDB first (SQLite, replica-set so the OpLog exists):
DO_NOT_TRACK=1 ./FerretDB/bin/ferretdb --handler=sqlite --sqlite-url="file:$D/db/" \
--listen-addr=127.0.0.1:27017 --repl-set-name=rs0 --state-dir="$D" \
--telemetry=disable --log-level=error &
# 2) THEN WeKan (starting it before FerretDB is ready crashes on the users index —
# "Topology is closed" — see #6500):
PATH="$T/node-v24.18.0-linux-arm64/bin:$PATH" MONGO_URL="mongodb://127.0.0.1:27017/wekan" \
METEOR_REACTIVITY_ORDER="oplog,polling" \
MONGO_OPLOG_URL="mongodb://127.0.0.1:27017/local?replicaSet=rs0" \
PORT=8080 ROOT_URL="http://localhost:8080" WRITABLE_PATH="$D" \
node .build/bundle/main.js
# -> http://localhost:8080 serves once startup finishes (~10-30s).
Docker is NOT available inside this Flatpak sandbox
docker / docker-compose / podman are not present in the VSCode Flatpak sandbox, so
docker compose up cannot be run here. To reproduce a docker-compose.yml-style setup,
run FerretDB and the bundle manually as shown above (the compose ferretdb service just
downloads and runs the same ferretdb-<arch> binary; the wekan service just runs the
same bundle). The Docker-only startup race in #6500 (WeKan starting before FerretDB is
ready) is fixed in docker-compose.yml with a ferretdb healthcheck + depends_on: condition: service_healthy; when running manually, always start FerretDB first.