Owner's decision 2026-11-30 after a cost/value review. WebAuthn only works when the UI is opened by host name with a trusted certificate; most homes and small offices use an IP address and the self-signed certificate, where passkeys don't work at all. For that it cost ~800 lines of security-relevant code and 9 of the 11 Go dependencies (go-webauthn and what it pulls in: cbor, go-tpm, jwt, uuid, mapstructure, msgp, …), each a source of update churn. Removed: internal/app/passkeys, the /api/v1/auth/passkey/* and /api/v1/me/passkeys* routes and their API description, auth.LoginVerified / Failed / Blocked (only passkey login used them), the passkey button on the login page, the Passkeys card on "My account", lib/webauthn.ts, the dependencies (go mod tidy: go.mod now needs only pam and x/sys). F-AUT-6 is marked dropped in 02-requirements with the reason. Password login, its backoff and locked-account checks are unchanged. Existing installations keep /var/lib/sharestead/passkeys.json; nothing reads it any more (public keys only, no secret). Effect: .deb 5.4 → 4.1 MB. Checked on CT 151: the passkey routes answer 404; login, wrong password, self-service, own account, CSP and axe e2e tests pass on desktop and phone. Test changed because: these tests covered the removed passkey feature (F-AUT-6, dropped by the owner) and are deleted with it: internal/app/passkeys/passkeys_test.go; TestPasskeysNeedAHostName, TestDeletingAUserForgetsTheirPasskeys, TestMyPasskeys, TestPasskeyLoginIsBlockedDuringBackoff (internal/server); TestPasskeyLoginOfLockedAccountIsRefused and the passkey half of TestLockedAccountCantLogIn (internal/auth; its password half stays); web/src/lib/webauthn.test.ts; the e2e test "passkeys: add one, log in with it, remove it". The requirements they covered for passwords (backoff, locked accounts, own account) keep their own tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6.7 KiB
AGENTS.md — working on Sharestead
For AI coding agents (and humans). Project layout and dev commands: README.md.
Product and design decisions: docs/planning/; the MVP list is in
02-requirements, the binding design system in
04-ux-and-mockups §4b.
Rules
- Standards first. WCAG 2.2 AA (checked with axe-core), WAI-ARIA patterns, OpenAPI 3.1
(linted with Redocly), errors as RFC 9457 problem details. Reuse the components in
web/src/components/instead of building new variants. - Say when something isn't possible or would break a standard, and offer an alternative with its trade-off. Don't silently build a weaker version.
- Facts, not guesses. Reproduce before naming a cause; run it before saying a fix works; label anything you could not verify.
- The config files stay the source of truth (
smb.conf,/etc/exports, …): edits are lossless and touch only their lines; hand edits keep working. - No CDN, strict CSP (
default-src 'self'). Everything ships inside the binary. - Dependencies pinned exactly (
--save-exact). Licence GPL-3.0-only: third-party code must be compatible, keep its licence notice. - Code comments say what the code does, never what it doesn't do or what was removed.
Reasons go into the commit message or
docs/. - Never commit secrets.
Before every commit
Same checks as CI (.gitea/workflows/ci.yml):
# on CT 140, in the repo
export PATH="$HOME/.local/go/bin:$HOME/.local/node/bin:$PATH"
gofmt -l cmd internal # must print nothing
go vet ./... && go test ./...
(cd web && npm run check && npm test && npm run build)
go run ./cmd/sharestead -openapi > dist/openapi.json && (cd web && npm run lint:api) # after API changes
Writing tests
- From the spec, not the code: take the expected result from
docs/planning/02-requirements.md,07-security-and-testing.mdor the API description first. If a test fails, decide from the spec whether the code or the test is wrong; never just change the expectation to what the code does. - API tests use the harness in
internal/server/harness_test.go(newWorld): real store, journal and files in a temp dir, recorded system commands. It also checks every answer against the API description. Check Samba access withcheckAccess(independent smb.conf(5) model). - Fakes behave like the real system (see
fakeSystem); a fake that is too friendly hides bugs. - Tests that need root (
chown) skip as a normal user; run them withunshare -r env PATH=$PATH HOME=$HOME go test ./internal/adapters/osfs. - Coverage may not fall below
.coverage-min(CI). When it rises, raise the number. - Behaviour that depends on the filesystem (ACLs, limits, free space, mounts): add it to
internal/fsmatrixand run the matrix on VM 152 (commands at the top ofscripts/fs-matrix.sh). - UI states (greyed out, warnings): add a scenario to
web/e2e/fixtures/scenarios.jsonand its expected UI toweb/e2e/ui-states.spec.ts;fixtures_test.gochecks the fixture against the API.
When a test fails
- Read the requirement the test refers to (02-requirements, 07, the API description).
- Reproduce it — on the real system where possible (CT 151, VM 152,
smbclient), not only in the fake. A fake that is too friendly or too strict is a bug in the test. - Decide from the spec, not from the code: code wrong → fix the code (the test stays);
test wrong → fix the test and say why in the commit message:
Test changed because: <requirement / what was broken in the test, and why the code is right>. A test that passes only on its retry is a failure too (CI fails on flaky tests). - CI enforces this: the test guard fails a pull request that changes or deletes existing
test lines, deletes a test file or lowers
.coverage-min/.mutation-minwithout that block (adding tests is free). The guard script comes from the target branch, so a PR can't switch it off for itself. Lowering a minimum is weakening a test.
UI changes: check them in a real browser first
Test instance: CT 151 (https://192.168.0.157:8443), test admin ssttest. It's yours to
use: install, restart, create test users. Nothing else in the homelab without the owner's OK.
Storage folders: /mnt/test (POSIX ACLs on) and /mnt/test-noacl (ACLs off). Features that
depend on ACLs must be checked on both.
Second test instance: VM 152 (https://192.168.0.164:8443, ssh debian@192.168.0.164 with the
CT 140 key, test admin ssttest). It covers what a container can't: /srv/xfs and /srv/ext4
belong to the VM (XFS/ext4 with project quota: hard limits possible), /mnt/host is a host folder
via virtiofs (soft limits only, no ACLs). Deploy: scp the .deb, then
ssh debian@192.168.0.164 'sudo apt-get install -y /tmp/sharestead.deb'. Features that depend on
the filesystem owner (limits, ACLs) must be checked on both instances.
- Deploy to CT 151:
✅ Check: the version printed by the build shows up on the System page.
# on CT 140, in the repo ARCHS=amd64 ./scripts/build-packages.sh ssh pve "pct push 151 /dev/stdin /root/sharestead.deb" < "$(ls -t dist/*amd64.deb | head -1)" ssh pve "pct exec 151 -- apt-get install -y /root/sharestead.deb" - Run only the e2e tests you touched, on desktop and phone:
⚠️ Never run the full suite there: it expects the CI fixtures (
# on CT 140, in web/ (set a fresh password first: ssh pve "pct exec 151 -- chpasswd") SST_URL=https://192.168.0.157:8443 SST_USER=ssttest SST_PASS='…' \ npx playwright test --trace off --project=chromium --project=mobile -g "users and groups|accessibility"scripts/e2e-setup.sh,/srv/sst-test) and rewrites CT 151's config. Tests that need those fixtures (e.g. "personal folders", "storage limit") fail on CT 151 by design. - Take screenshots (desktop, phone, light and dark) and look at them critically.
ignoreHTTPSErrors hides certificate errors, so it proves nothing about untrusted certificates.
Git
- Early phase: the AI may commit and push to
maindirectly; CI must stay green. - Ask the owner before tagging a release (first one: 0.1.0).
- Commit messages explain what changed and why; one topic per commit.
- CI runs per push only the fast set (e2e in Chromium + phone); Firefox, WebKit and the wide screen run nightly and on demand (Run workflow). A newer push cancels the older run. Several small commits are fine, but don't push them one by one while CI is busy: push them together.
- Several agents may work at once: put larger changes that touch shared files on a branch (or a separate worktree) and open a pull request.