AUDIT.mdblame
View source
55e95011# Grove Audit — 2026-02-22
55e95012
55e95013Full audit of codebase + production server. Working through items top to bottom.
55e95014
55e95015---
55e95016
55e95017## Critical Infrastructure
55e95018
55e95019- [x] **Disk cleanup** — Pruned 164GB Docker build cache. Server now at 16% (183GB free).
55e950110- [x] **Backups** — Daily backup script at `/opt/grove/backup.sh`, cron at 4am UTC, 7-day retention. Covers SQLite DBs, blobstore, Mononoke config, TLS certs, compose config.
55e950111- [x] **Firewall** — UFW enabled. SSH restricted to admin IP, HTTP/S and Mononoke ports open to all.
55e950112
55e950113## Code Review (Diffs)
55e950114
55e950115- [x] **Test the diff workflow end-to-end** — Found: no "New Diff" button in UI, API queries broken for org-owned repos.
55e950116- [x] **Fix whatever is blocking diff creation** — Added "New Diff" button + `/diffs/new` page with branch picker. Fixed all diffs.ts queries to use `repos_with_owner` view instead of broken `JOIN users o ON r.owner_id` pattern.
55e950117
55e950118## Dead Code & Redundancy
55e950119
59985bb20- [x] **Hub-api tables audit** — No dead tables. `merge_requests` was renamed to `diffs` via migration. All tables actively used.
55e950121- [ ] **Clarify repos ownership** — hub-api has `repos` table (1 row), grove-api has `repos` table (5 rows). Which is canonical? Probably grove-api — clean up hub-api's.
55e950122- [ ] **Consolidate API clients** — Three separate implementations: `web/lib/api.ts`, CLI's client, VS Code extension's `client.ts`. Consider a shared package.
59985bb23- [ ] **Finish Ring** — Planned feature, not dead code. Log ingestion API works, UI exists. Needs integration (Canopy → Ring logging, instance reporting).
55e950124- [ ] **Remove or finish CLI CI stubs** — `ci runs`, `ci status`, `ci logs`, `ci trigger`, `ci cancel` are partially wired.
59985bb25- [x] **api/src/routes/auth.ts** — Does not exist. Auth handled entirely by hub-api. No vestigial code.
55e950126- [ ] **Audit addons/ directory** — ISL, isl-server, shared, components, vscode extension. ~44k files, mostly extracted from Sapling. Decide what's actually used.
55e950127
55e950128## Documentation
55e950129
59985bb30- [x] **Update GROVE.md** — Rewritten to reflect current state: WebAuthn auth, Hub API + Grove API split, Canopy CI/CD, Ring, CLI, production deployment, database schemas.
55e950131
55e950132## Quality & Reliability
55e950133
55e950134- [ ] **Add API tests** — Zero test files in api/, hub-api/, or cli/. At minimum: auth flow, repo CRUD, diff CRUD.
55e950135- [ ] **Standardize error responses** — Inconsistent between hub-api and grove-api (mix of 401/404/500, different shapes).
55e950136- [ ] **Type safety** — Many `any` types in route handlers. Fastify request decorators not fully typed.
55e950137- [ ] **Database migration cleanup** — `api/src/services/database.ts` is 650 lines with complex table-rebuild migration logic and legacy table refs.
55e950138
55e950139## Security
55e950140
55e950141- [ ] **JWT in localStorage** — XSS risk. Should migrate to HttpOnly cookies.
55e950142- [ ] **Docker socket exposure** — grove-api has `/var/run/docker.sock` mounted for Canopy CI. Known risk, needs sandboxing strategy.
55e950143- [ ] **Rate limiting** — No rate limiting on any API endpoint.
55e950144
55e950145## Strategic Decisions (Deferred)
55e950146
55e950147- [ ] **Hub API vs Grove API merge** — With one instance running, the split adds complexity (separate DBs, JWT signing ceremony, user sync). May want to merge.
55e950148- [ ] **ISL integration** — Embedding smartlog in web UI was planned in GROVE.md Phase 6. Addons directory is mostly ISL. Decide if still pursuing.
55e950149- [ ] **VS Code extension** — Significant code in addons/vscode/. Decide priority.
55e950150- [ ] **Code search** — Not started. Eventually needed for a GitHub-like experience.
55e950151- [ ] **Monitoring** — No Prometheus, no health dashboards, no alerting.
55e950152
55e950153---
55e950154
55e950155## Production Server Reference
55e950156
55e950157| Property | Value |
55e950158|----------|-------|
55e950159| IP | 178.156.247.203 |
55e950160| Domains | grove.host, canopy.grove.host, ring.grove.host |
55e950161| OS | Ubuntu, Linux 6.8.0-52-generic |
55e950162| CPU | 8-core AMD EPYC-Milan |
55e950163| RAM | 30GB (2.1GB used) |
59985bb64| Disk | 226GB total, 34GB used (16%) after cleanup |
55e950165| Containers | 8 (Caddy, registry, hub-api, grove-api, grove-web, mononoke-slapi, mononoke-git, grove-bridge) |
55e950166| Data | 2 users, 3 orgs, 5 repos, 191 CI runs |
55e950167| Compose | /opt/grove/docker-compose.yml |
55e950168| Data dir | /data/grove/ |
55e950169| TLS | Let's Encrypt (Caddy) + self-signed CA (Mononoke mTLS) |