# test601 — Hub scheduled tasks
source_commit=8c8d8d653e118d8ca075ed28656cd772eb3a4892
date=2026-08-09T02:28:48+00:00
L0 build + additive schema
Bundled 257 modules in 62ms

  commhub-scheduler.js  1.52 MB  (entry point)

L1-L5 real Hub + SQLite: time, auth, dispatch, recurrence, rename, history
bun test v1.3.14 (0d9b296a)

server/src/scheduled-tasks-http.test.ts:
[commhub] database: /tmp/test601-green.db
[commhub] 🎉 14-day free trial started!
[commhub] node_id backfill: inbox=0, tasks.to=0, tasks.from=0, total=0
(pass) Hub scheduled task API and dispatcher > schedule math supports timezone-aware daily and weekly forms [892.22ms]
(pass) Hub scheduled task API and dispatcher > scheduler startup rejects a backend without real transactions [0.47ms]
(pass) Hub scheduled task API and dispatcher > owner creates; viewer and node token cannot mutate [37.56ms]
(pass) Hub scheduled task API and dispatcher > network scope hides schedules from foreign users and viewers may read [84.69ms]
(pass) Hub scheduled task API and dispatcher > due occurrence creates ordinary inbox/task/run atomically and is idempotent [11.93ms]
[scheduled-tasks] occurrence failed schedule=sched_4bc6ce98-3b16-42a6-a48e-826cac849c37: test601_injected_task_failure
(pass) Hub scheduled task API and dispatcher > dispatch failure rolls back occurrence, inbox, task, and schedule advance as one unit [17.26ms]
(pass) Hub scheduled task API and dispatcher > two real Hub processes claim one occurrence exactly once [165.36ms]
(pass) Hub scheduled task API and dispatcher > non-overlap skips while prior task is open; rename follows stable node_id [16.28ms]
(pass) Hub scheduled task API and dispatcher > optimistic revision, pause/resume, run-now and cancel preserve history [22.30ms]

 9 pass
 0 fail
 58 expect() calls
Ran 9 tests across 1 file. [1.94s]
L6 witnessed-red: node token cannot create persistent schedules
MUTATION_RED: node-token-write-gate rc=1
L7 witnessed-red: cross-process occurrence claim is load-bearing
MUTATION_RED: cross-process-occurrence-claim rc=1
L8 witnessed-red: overlap check is load-bearing
MUTATION_RED: no-overlapping-occurrences rc=1
L9 witnessed-red: optimistic revision rejects stale devices
MUTATION_RED: optimistic-revision rc=1
L10 witnessed-red: DST fall-back duplicate suppression is load-bearing
MUTATION_RED: dst-fallback-single-occurrence rc=1
L11 witnessed-red: non-transactional backend startup gate is load-bearing
MUTATION_RED: non-transactional-backend-gate rc=1
L12 restored green
bun test v1.3.14 (0d9b296a)

server/src/scheduled-tasks-http.test.ts:
[commhub] database: /tmp/test601-restored.db
[commhub] 🎉 14-day free trial started!
[commhub] node_id backfill: inbox=0, tasks.to=0, tasks.from=0, total=0
(pass) Hub scheduled task API and dispatcher > schedule math supports timezone-aware daily and weekly forms [870.90ms]
(pass) Hub scheduled task API and dispatcher > scheduler startup rejects a backend without real transactions [0.62ms]
(pass) Hub scheduled task API and dispatcher > owner creates; viewer and node token cannot mutate [33.92ms]
(pass) Hub scheduled task API and dispatcher > network scope hides schedules from foreign users and viewers may read [98.04ms]
(pass) Hub scheduled task API and dispatcher > due occurrence creates ordinary inbox/task/run atomically and is idempotent [8.98ms]
[scheduled-tasks] occurrence failed schedule=sched_60d8ea83-397b-434e-861f-8141f03edfad: test601_injected_task_failure
(pass) Hub scheduled task API and dispatcher > dispatch failure rolls back occurrence, inbox, task, and schedule advance as one unit [16.82ms]
(pass) Hub scheduled task API and dispatcher > two real Hub processes claim one occurrence exactly once [169.63ms]
(pass) Hub scheduled task API and dispatcher > non-overlap skips while prior task is open; rename follows stable node_id [17.92ms]
(pass) Hub scheduled task API and dispatcher > optimistic revision, pause/resume, run-now and cancel preserve history [25.36ms]

 9 pass
 0 fail
 58 expect() calls
Ran 9 tests across 1 file. [1.93s]
RESULT: PASS

## Dashboard client — Docker production build

source_commit=4bbc4ea4b561392e6a0bd43b703cb9fcafb2063f
command=sg docker -c 'docker build -t anet-scheduler-dashboard:dev --build-arg SOURCE_COMMIT=4bbc4ea4b561392e6a0bd43b703cb9fcafb2063f -f tests/test-scheduled-tasks/Dockerfile . && docker run --rm anet-scheduler-dashboard:dev'

- scheduled-tasks module contract: 12 pass
- TypeScript (`npx tsc --noEmit`): PASS
- Next.js 16 production build: PASS, 53/53 static pages
- generated routes include `/scheduled-tasks` and `/api/hub/scheduled-tasks/[[...path]]`
- selected-network scope is preserved in both `/api/nodes` and the legacy `/api/status` fallback
- image tag removed by exact name after evidence capture

RESULT: PASS

## Official App client — Docker Expo 56 export

source_commit=be52ae8c63e0b490323e205e9009555f0dd4ff4a
command=sg docker -c 'docker build -t anet-scheduler-app:dev --build-arg SOURCE_COMMIT=be52ae8c63e0b490323e205e9009555f0dd4ff4a -f tests/test-scheduled-tasks/Dockerfile . && docker run --rm anet-scheduler-app:dev'

- scheduled-tasks API contract: 11 pass
- auth token remains in Authorization header; network and stable node_id are explicit
- Expo 56 real web export: PASS, 423 modules, `index.html` emitted
- repository-wide standalone `tsc` remains blocked by pre-existing Buffer typings in `src/attach-download.test.ts`; no scheduler file is in that diagnostic set
- image tag removed by exact name after evidence capture

RESULT: PASS
