Files
browser/openspec/changes/harden-log-artifact-channel-isolation/tasks.md
T
2026-07-11 14:56:10 +08:00

6.3 KiB

1. Run-Side Channel Isolation

  • 1.1 Add deterministic run tests that simulate slow or retrying artifact/file transfer work while control heartbeat and job ack/progress/result calls continue through bounded client calls.
  • 1.2 Add run tests proving log spool selection, upload acknowledgement, and retry cleanup continue while artifact/file chunks are queued, slow, or retrying.
  • 1.3 Add run tests proving artifact/file retry listing, chunk acknowledgement, and cleanup continue while log batches are queued, slow, or retrying.
  • 1.4 Update run scheduling, retry queue, or worker orchestration code only where needed to make the tests pass without exposing host paths, raw credentials, direct sockets, or large inline payloads through lightweight channels.
  • 1.5 Run cd run && GOCACHE=/private/tmp/browser-go-build-cache go test ./... -count=1 and record evidence.

2. Platform Interleaving and Validation

  • 2.1 Add platform service/API tests that interleave valid heartbeat, job ack/result, log batch ingest, and artifact transfer requests for one registered run endpoint.
  • 2.2 Prove each interleaved platform route mutates only its own state and preserves existing idempotency semantics.
  • 2.3 Add negative platform tests proving control, job, and log routes reject artifact chunks, file bodies, host paths, raw credentials, direct sockets, and channel-owned transport payloads from other routes.
  • 2.4 Update platform validators, DTOs, service logic, or route documentation only where needed to enforce the isolation contract.
  • 2.5 Run cd platform && GOCACHE=/private/tmp/browser-go-build-cache go test ./... -count=1 and record evidence.

3. Protocol Documentation

  • 3.1 Update run/protocol/*.md, run/spool/README.md, run/artifact/README.md, platform/protocol/run-contracts.md, or platform/api/routes.md as needed to document channel priority and payload boundaries.
  • 3.2 Confirm docs state that control/job calls remain lightweight, log ingest is durable and independently retried, artifact/file transfer is chunked and lower priority, and lightweight routes never accept heavy transfer payloads.

4. Verification and Stream Handoff

  • 4.1 Record implementation evidence in this tasks file only after each command has actually run.
  • 4.2 Run scripts/check-structure.sh and record evidence.
  • 4.3 Run openspec validate harden-log-artifact-channel-isolation --strict and record evidence.
  • 4.4 Update openspec/changes/architecture-delivery-stream/delivery-plan.md to mark harden-log-artifact-channel-isolation complete only after evidence exists and move the next queue item to active.
  • 4.5 Update openspec/changes/architecture-delivery-stream/NEXT_CHANGE.md with the next implementation/generator handoff after this change closes.

Evidence

  • Run-side channel isolation:

    • Added run/api/channel_isolation_test.go, proving heartbeat, terminal job result, and log ingest complete while an artifact chunk upload is deliberately blocked.
    • Added run/spool/channel_isolation_test.go, proving log acknowledgement cleanup remains independent from artifact backlog and artifact acknowledgement cleanup remains independent from log backlog.
    • No run scheduling or queue production code changes were required; existing separate client calls and separate logs / artifacts spool areas satisfied the new regression tests.
    • Initial sandbox run of cd run && GOCACHE=/private/tmp/browser-go-build-cache go test ./api ./spool -count=1 was blocked by httptest loopback bind permissions after run/spool passed.
    • Escalated rerun of cd run && GOCACHE=/private/tmp/browser-go-build-cache go test ./api ./spool -count=1 passed for browser.local/run/api and browser.local/run/spool.
    • Full sandbox run of cd run && GOCACHE=/private/tmp/browser-go-build-cache go test ./... -count=1 was blocked by httptest loopback bind permissions in run/api and run/runtime; non-listener packages passed.
    • Escalated rerun of cd run && GOCACHE=/private/tmp/browser-go-build-cache go test ./... -count=1 passed for api, config, protocol, runtime, and spool.
  • Platform interleaving and validation:

    • Added platform/api/channel_isolation_handlers_test.go, proving interleaved heartbeat, job ack/result, log batch ingest, and artifact transfer requests mutate only their own channel state.
    • Added negative API coverage proving lightweight control/job/log routes reject artifact chunks, inline log arrays, host paths, raw credential fragments, direct socket strings, and heavy transfer payload fields through strict JSON decoding.
    • Added rejection-state coverage proving a rejected heavy heartbeat payload does not mutate endpoint capacity or store heavy payload text.
    • Focused command cd platform && GOCACHE=/private/tmp/browser-go-build-cache go test ./api -run 'TestRunChannelAPI|TestLightweightRunRoutes' -count=1 passed.
    • Full command cd platform && GOCACHE=/private/tmp/browser-go-build-cache go test ./... -count=1 passed for api, config, domain, dto, model, repo, service, and validator.
  • Protocol documentation:

    • Updated run/spool/README.md, run/artifact/README.md, run/protocol/artifact.md, run/protocol/log-ingest.md, and run/protocol/job.md with channel priority, independent retry, and heavy-payload boundary rules.
    • Updated platform/protocol/run-contracts.md and platform/api/routes.md to state that control/job calls remain lightweight, log ingest is durable and independently retried, artifact/file transfer is lower priority and chunked, and lightweight routes reject heavy transfer payloads.
  • Final gates and stream handoff:

    • scripts/check-structure.sh passed with structure check passed.
    • openspec validate harden-log-artifact-channel-isolation --strict passed with Change 'harden-log-artifact-channel-isolation' is valid; the process exited 0. PostHog telemetry flush reported ENOTFOUND edge.openspec.dev, which did not affect validation.
    • openspec/changes/architecture-delivery-stream/delivery-plan.md now marks harden-log-artifact-channel-isolation complete and implement-local-debug-workspace active.
    • openspec/changes/architecture-delivery-stream/NEXT_CHANGE.md now points the next generator chat at creating implement-local-debug-workspace, because that OpenSpec directory does not exist yet.