~bigbes/lethe

da1827c5192d2784fcecf01578b5f307ea15a8c1 — Eugene Blikh 24 days ago 9094d79
docs: record collector endpoint and outbox checks
1 files changed, 10 insertions(+), 8 deletions(-)

M docs/tasks/lethe-collector-claude-code.md
M docs/tasks/lethe-collector-claude-code.md => docs/tasks/lethe-collector-claude-code.md +10 -8
@@ 289,20 289,21 @@ Positive:
- CK2 — `go build ./cmd/lethe-collector` succeeds.
- CK3 — `lethe-collector status` with a minimal config opens the state DB and reports the configured source.
- CK4 — runner tests cover offset-0 backfill and bounded daemon drain.
- CK5 — sender tests cover trailing-slash `server_url` normalization.

Negative:
- CK5 — `lethe-collector status --config ./tmp/missing.yaml` exits non-zero with `CONFIG_NOT_FOUND` surfaced.
- CK6 — `lethe-collector status --config ./tmp/missing.yaml` exits non-zero with `CONFIG_NOT_FOUND` surfaced.

Invariants / assumptions:
- CK6 (IV7) — `internal/collector` has no `os.Hostname` call; host flows from collector config.
- CK7 (IV9, AS1) — sender posts only `TurnEvent` NDJSON to `/api/v1/ingest`.
- CK8 (UK1) — Tailscale header injection remains unverifiable without the deployed Tailscale path.
- CK7 (IV7) — `internal/collector` has no `os.Hostname` call; host flows from collector config.
- CK8 (IV9, AS1) — sender posts only `TurnEvent` NDJSON to `/api/v1/ingest`.
- CK9 (UK1) — Tailscale header injection remains unverifiable without the deployed Tailscale path.

Interfaces:
- CK9 (IF1) — `config.Load(path string) (*Config, error)` is exercised by CLI and config tests.
- CK10 (IF2) — `state.Store` offset/outbox methods are exercised by runner and state tests.
- CK11 (IF3) — `Sender.PostBatch(ctx, events)` is exercised by sender, outbox, and runner tests.
- CK12 (IF4) — `RunOnce` / `RunDaemon` are exercised by CLI wiring and runner tests.
- CK10 (IF1) — `config.Load(path string) (*Config, error)` is exercised by CLI and config tests.
- CK11 (IF2) — `state.Store` offset/outbox methods are exercised by runner and state tests.
- CK12 (IF3) — `Sender.PostBatch(ctx, events)` is exercised by sender, outbox, and runner tests.
- CK13 (IF4) — `RunOnce` / `RunDaemon` are exercised by CLI wiring and runner tests.

Smoke: `go run ./cmd/lethe-collector --config ./tmp/collector-smoke.yaml status` → prints host, state DB, outbox stats, source list, and `lag_bytes`.



@@ 319,6 320,7 @@ Smoke: `go run ./cmd/lethe-collector --config ./tmp/collector-smoke.yaml status`
- ureview (re-review): added `lag_bytes` per file to `status` output using `parser.SourceFile.Size` from discovery.
- ureview (final): bounded daemon drain uses `http.timeout` — no separate `shutdown_grace` config exists for the collector.
- ureview (final): backfill offset-0 semantics are implemented as `RunBackfillOnce` instead of a mode flag on `RunOnce` — explicit call sites are safer than a boolean parameter that could be misused in daemon loops.
- ureview (final): enforced the outbox size cap before replay and normalized trailing slashes in `server_url` — keeps IV5 and IV9 true for preexisting state and valid-looking URLs.
- ureview (final): normalized sender `serverURL` and enforced outbox cap before every replay to fix IV5/IV9 violations found in review.

### Deferred (needs user input)