Skip to content

Record and expose per-resource history - #9

Merged
prop4n merged 1 commit into
feat/git-commit-statusfrom
feat/resource-history
Aug 30, 2026
Merged

prop4n merged 1 commit into
feat/git-commit-statusfrom
feat/resource-history

Conversation

@prop4n

@prop4n prop4n commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Increment 2 of the observability work: a persistent per-resource history, so you
can see when each resource synced, drifted, was applied or failed, and from which
commit.

Stacked on #8 (Git commit) — base this on that branch; merge #8 first.

What it does

  • Store: a resource_events table in SQLite (kind, name, type, reason, commit_, at) with AppendEvent / EventsFor.
  • Recording:
    • The engine records state transitions (drifted, synced, removed) by
      comparing the previous snapshot, tagged with the pass commit. A resource
      already in sync on boot is not logged (avoids a synced burst).
    • The dispatcher records applied / failed when an action finishes; the
      Action carries the commit set at plan time so events attribute correctly.
    • Recording is optional (EventSink), nil-safe; the plan command records nothing.
  • API: GET /api/v1/resources/{kind}/{name}/events (newest first).
  • UI: a history toggle on each resource card opens an inline timeline
    (event, reason, short commit, relative time), colour-dotted by type.
  • Retention: keep-all for now (documented debt; a later increment caps it).

Tests

  • Store: append + newest-first read, fields persisted.
  • Engine: drift then synced emits the right transition events.
  • Dispatcher: applied + failed recorded with commit/reason.
  • Verified end-to-end on a live cluster: 16 real events landed in the DB
    (drifted with reason/commit/timestamp), read back through the store.

golangci-lint (v2) clean, gofmt clean, Go + vitest suites green.

Next (increment 3)

Daemon logs in the UI via an in-memory ring buffer over SSE.

@prop4n
prop4n merged commit 8f9dd4d into feat/git-commit-status Aug 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant