Feat v0.7.6 code hygiene + test coverage
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / e2e-smoke (pull_request) Has been skipped
CI/CD / test-frontend (pull_request) Successful in 5s
CI/CD / test-sqlite (pull_request) Successful in 2m54s
CI/CD / test-go-pg (pull_request) Successful in 2m56s
CI/CD / build-and-deploy (pull_request) Successful in 1m1s

Clean up channels-era dead code, align migrations, add 92 tests,
and fix backup download + admin storage tab bugs before v0.8.x
kernel expansion.

Critical fixes:
- Remove `channels` from allowedViews in db_module.go
- Fix 5 dead API routes in workflow.html → public workflow API
- Fix RenderWorkflow handler to use route param as entry token

Dead code removal:
- Delete SeedTestChannel(), RunContext.ChannelID, webhook.ChannelID
- Fix stale comments in storage.go, prometheus.go, workflow_module.go

Migration hygiene:
- Add SQLite placeholder 013_cluster_registry.sql, renumber to 014
- Compat rename in migrate.go for existing SQLite databases
- Document missing migration 008 in both 009 files

Test coverage:
- 82 workflow routing tests (all operators, branch rules, stage resolution)
- 10 middleware tests (permissions, admin, rate limiter)

Bug fixes:
- Remove dead Admin Storage tab from System category
- Fix backup download: sw.auth.token() → sw.auth._getToken()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-02 17:31:46 +00:00
parent 5e830c04de
commit 20572ef665
22 changed files with 850 additions and 144 deletions

View File

@@ -1,6 +1,6 @@
# Armature — Roadmap
## Current: v0.7.5Headless E2E + CI Gate
## Current: v0.7.6Code Hygiene + Test Coverage
Self-hosted extensible platform kernel. Auth, identity, packages, Starlark
sandbox, storage, realtime, and ops are kernel primitives. Everything else
@@ -200,33 +200,40 @@ a test coverage gap in the store layer. Fix before v0.8.x kernel expansion.
| Step | Status | Description |
|------|--------|-------------|
| Remove channels from allowedViews | | `db_module.go``ext_view_channels` does not exist. `db.view("channels")` crashes. |
| Fix workflow.html dead routes | | Template calls `/api/v1/channels/{id}/workflow/*` — routes moved to `/api/v1/public/workflows/`. Update template to match. |
| Remove channels from allowedViews | done | `db_module.go``ext_view_channels` does not exist. `db.view("channels")` crashes. |
| Fix workflow.html dead routes | done | Template calls `/api/v1/channels/{id}/workflow/*` — routes moved to `/api/v1/public/workflows/`. Update template to match. Also fixed `RenderWorkflow` handler to use route param as entry token. |
**Dead Code Removal**
| Step | Status | Description |
|------|--------|-------------|
| Delete SeedTestChannel() | | `database/testhelper.go` — inserts into nonexistent channels table. |
| Remove RunContext.ChannelID | | `sandbox/runner.go` — vestigial field, unused by any module. |
| Remove webhook.ChannelID | | `webhook/webhook.go` — vestigial struct field from chat era. |
| Fix stale comments | | `storage.go` key format, `prometheus.go` route pattern — reference dead `/channels` paths. |
| Delete SeedTestChannel() | done | `database/testhelper.go` — inserts into nonexistent channels table. |
| Remove RunContext.ChannelID | done | `sandbox/runner.go` — vestigial field, unused by any module. |
| Remove webhook.ChannelID | done | `webhook/webhook.go` — vestigial struct field from chat era. |
| Fix stale comments | done | `storage.go` key format, `prometheus.go` route pattern, `workflow_module.go` param name — reference dead `/channels` paths. |
**Migration Hygiene**
| Step | Status | Description |
|------|--------|-------------|
| Align SQLite migration numbering | | SQLite 013 = test_runner_type, PG 014 = same. Add placeholder `013_cluster_registry.sql` to SQLite (comment-only, explains PG-only). |
| Document missing 008 | | Add comment in both 009 files explaining the gap (merged/removed). |
| Align SQLite migration numbering | done | SQLite 013 placeholder + renumber test_runner_type to 014. Compat rename in migrate.go. |
| Document missing 008 | done | Comment in both 009 files explaining the gap (merged into 007). |
**Test Gap Closure**
| Step | Status | Description |
|------|--------|-------------|
| store/ unit tests | | Direct tests for PG + SQLite store implementations. Priority: packages, ext_data, workflows. Target: ≥30% SLOC ratio (from 2%). |
| workflow/ engine unit tests | | Direct tests for `engine.go`, `routing.go`, `automated.go`. Currently 0% — tested only through handler integration. |
| middleware/ unit tests | | Auth middleware, rate limit, permissions. Currently 8.9%. |
| InstallPackage decomposition | | 224 cognitive complexity. Split into: validate → create → DDL → permissions → triggers. Each independently testable. |
| store/ unit tests | | Deferred to v0.7.8. Direct tests for PG + SQLite store implementations. Requires live DB. Target: ≥30% SLOC ratio. |
| workflow/ routing unit tests | done | 82 tests: ResolveNextStage, ResolveStageByName, ParseStageConfig, evaluateCondition (all operators). |
| middleware/ unit tests | done | 10 tests: RequirePermission, RequireAdmin, permission caching, RateLimiter (allow/deny/fail-open). |
| InstallPackage decomposition | | Deferred to v0.7.8. 224 cognitive complexity. Split into: validate → create → DDL → permissions → triggers. |
**Bug Fixes**
| Step | Status | Description |
|------|--------|-------------|
| Remove Admin Storage tab | done | Dead weight under System — backend endpoint preserved for future Monitoring use. |
| Fix backup download | done | `sw.auth.token()``sw.auth._getToken()`. Both "Download Backup" and server backup download buttons now work. |
### v0.7.7 — API Tokens + Extension Permissions
@@ -261,6 +268,16 @@ sidecar auth (v0.10.x).
| `gate_permission` manifest field | | Optional. If set, `ext_api.go` checks this permission before calling `on_request`. Extension doesn't execute for unauthorized users. |
| `req["permissions"]` in request dict | | `ext_api.go` resolves user permissions and includes them in the request dict. Extensions can check inline without the module. |
### v0.7.8 — Deferred Test Coverage
Remaining test gap items deferred from v0.7.6.
| Step | Status | Description |
|------|--------|-------------|
| store/ unit tests | | Direct tests for PG + SQLite store implementations. Priority: packages, ext_data, workflows. Target: ≥30% SLOC ratio. |
| InstallPackage decomposition | | 224 cognitive complexity. Split into: validate → create → DDL → permissions → triggers. Each independently testable. |
| workflow/ engine integration tests | | Engine lifecycle tests with mock stores (Start, Advance, Cancel, signoff gate). |
---
## Planned