You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add an append-only, immutable local event ledger (a second small SQLite table, or a separate DB file) recording every significant miner-loop event (discovered_issue, plan_built, plan_step_completed, pr_prepared, etc. — a small fixed event-type enum for this foundation phase; the full discover/analyze/plan/prepare loop's actual event vocabulary grows in later phases) with a monotonic sequence number and timestamp. This is the audit trail the phase brief calls for — append-only means no UPDATE/DELETE statements are ever issued against this table, only INSERT, so a contributor auditing the miner's history later can trust it was not retroactively edited.
Deliverables
An event-ledger module exposing appendEvent(event: { type: string; repoFullName?: string; payload: Record<string, unknown> }): LedgerEntry and readEvents(filter?: { repoFullName?: string; since?: number }).
Schema: id INTEGER PRIMARY KEY AUTOINCREMENT, seq INTEGER NOT NULL, event_type TEXT NOT NULL, repo_full_name TEXT, payload_json TEXT NOT NULL, created_at TEXT NOT NULL — seq is a monotonically increasing counter maintained by the module (not just relying on AUTOINCREMENT's reuse-after-vacuum behavior) so consumers get a stable ordering guarantee.
A test asserting the module NEVER issues an UPDATE or DELETE against the ledger table — e.g. grep the module source in a unit test for those SQL keywords, or (stronger) wrap the DB handle in a test double that throws if either is called.
Unit tests: append-then-read round-trip, sequence monotonicity across multiple appends, filter-by-repoFullName, filter-by-since.
Doc comment stating the immutability invariant explicitly (mirroring src/signals/duplicate-winner.ts's style of stating its own PURE invariant in a header comment) so a future contributor editing this file sees the constraint before touching it.
References
migrations/0010_agent_orchestrator.sql (55 lines) — the existing agent_actions/agent_context_snapshots append-oriented schema shape (created_at defaults, indexed by run/time) to mirror the SPIRIT of, though this is a local SQLite table, not a D1 migration.
src/signals/duplicate-winner.ts (header comment, lines 1-13) — precedent for stating a hard invariant (there: PURE/no-IO; here: append-only) directly in the module's doc comment.
New path: packages/gittensory-miner/lib/event-ledger.js (or co-located with run-state, per the run-state issue's file layout).
Add an append-only, immutable local event ledger (a second small SQLite table, or a separate DB file) recording every significant miner-loop event (
discovered_issue,plan_built,plan_step_completed,pr_prepared, etc. — a small fixed event-type enum for this foundation phase; the full discover/analyze/plan/prepare loop's actual event vocabulary grows in later phases) with a monotonic sequence number and timestamp. This is the audit trail the phase brief calls for — append-only means noUPDATE/DELETEstatements are ever issued against this table, onlyINSERT, so a contributor auditing the miner's history later can trust it was not retroactively edited.Deliverables
event-ledgermodule exposingappendEvent(event: { type: string; repoFullName?: string; payload: Record<string, unknown> }): LedgerEntryandreadEvents(filter?: { repoFullName?: string; since?: number }).id INTEGER PRIMARY KEY AUTOINCREMENT, seq INTEGER NOT NULL, event_type TEXT NOT NULL, repo_full_name TEXT, payload_json TEXT NOT NULL, created_at TEXT NOT NULL—seqis a monotonically increasing counter maintained by the module (not just relying onAUTOINCREMENT's reuse-after-vacuum behavior) so consumers get a stable ordering guarantee.UPDATEorDELETEagainst the ledger table — e.g. grep the module source in a unit test for those SQL keywords, or (stronger) wrap the DB handle in a test double that throws if either is called.repoFullName, filter-by-since.src/signals/duplicate-winner.ts's style of stating its own PURE invariant in a header comment) so a future contributor editing this file sees the constraint before touching it.References
migrations/0010_agent_orchestrator.sql(55 lines) — the existingagent_actions/agent_context_snapshotsappend-oriented schema shape (created_at defaults, indexed by run/time) to mirror the SPIRIT of, though this is a local SQLite table, not a D1 migration.src/signals/duplicate-winner.ts(header comment, lines 1-13) — precedent for stating a hard invariant (there: PURE/no-IO; here: append-only) directly in the module's doc comment.packages/gittensory-miner/lib/event-ledger.js(or co-located withrun-state, per the run-state issue's file layout).