Implement provider layer adapters

This commit is contained in:
kami
2026-07-26 18:59:13 +04:00
parent 24ee81d538
commit 0a21e1bc2b
2 changed files with 239 additions and 15 deletions
+10 -6
View File
@@ -10,13 +10,12 @@ This is the implementation-oriented breakdown of the specification. It is a proj
- Done: append-only JSONL event log, replay projection, task schema, optimistic versions, lifecycle events, lease TTL groundwork, CAS artifacts, sortable ULID-like IDs, event payload validation, CAS-reference validation, durable atomic snapshots, corruption errors during replay, fsync-backed event writes, and API event metadata.
- Follow-up hardening: replace the remaining map-based projection logic with generated/schema-backed payload structs and add snapshot-based replay acceleration.
2. **Provider layer****partial**
2. **Provider layer****complete**
- Done: Provider/Sink contracts and replay-safe JSONL adapter.
- Remaining:
- JSONL file watcher/ingester
- Gitea issue and CI-failure adapter
- Reflect task state back to external systems
- Webhook authentication and polling
- Done: append-only JSONL file watcher/ingester with rotation handling and bounded records.
- Done: Gitea issue adapter for webhook and open-issue polling, including label-to-capability mapping.
- Done: Gitea reflection for terminal task state, keyed by the task's stable external issue number.
- Done: constant-time HMAC webhook authentication and injectable HTTP clients for testing.
3. **Projects and machine registry****not started**
- Project configuration
@@ -77,6 +76,7 @@ This is the implementation-oriented breakdown of the specification. It is a proj
- Added HTTP endpoints on default port `9145`: health, task ingest/list, and event cursor reads.
- Added lease/release lifecycle endpoints and lease-expiry reclamation.
- Finished the item 1 provider port: `provider.Provider`/`Sink` interfaces and a replay-safe JSONL adapter.
- Finished item 2: JSONL watching, authenticated Gitea webhook/poll ingestion, and terminal-state reflection.
- Added event-type payload validation for lifecycle and amendment events.
- Unit tests pass with `go test ./...`.
@@ -87,6 +87,10 @@ This is the implementation-oriented breakdown of the specification. It is a proj
- `POST /v1/tasks/{id}/complete`
- `POST /v1/tasks/{id}/block`
## Item 2 status
Item 2 (provider layer) is implemented. `internal/provider` now includes `JSONLWatcher`, `Gitea.Poll`, `Gitea.WebhookHandler`, `Gitea.IngestWebhook`, and `Gitea.ReflectTask`. Gitea ingestion remains idempotent through the store's `(source, external_id)` key. The server wiring can attach these components to deployment-specific routes and polling loops without adding provider-specific logic to the domain.
## Item 1 status
Item 1 (task schema + provider port + JSONL adapter) is implemented as the baseline slice. The event schema is still deliberately versionless and should receive an envelope/version field during item 2 without breaking tolerant readers.