Add recall/promotion tracking fields to Entry schema#45
Merged
Conversation
…rn-28ge.1.1) Adds LastRecalledAt, RecurrenceCount, PromotedBeadID, Kind, and AutoActionable to the Entry struct (internal/cairn/entry.go) and the matching SQLite index columns (internal/cairn/index.go). All five are index-only state excluded from reindex's ON CONFLICT DO UPDATE SET, so future write paths can populate them without a reindex clobbering them back to the body's stale seed value (mirrors the existing hit_count precedent). Reviewer PASS on crn-28ge.1.1 (content-signature verified: this branch's tip carried unrelated already-merged commits due to a known harness rebase-churn bug, crn-6qbb, so this commit reconstructs the exact reviewed 4-file diff fresh off origin/main rather than inheriting that branch's broken ancestry).
…hema (crn-28ge.1.1) Documents PASS on all 7 release-gate criteria for the 5 new Entry fields (LastRecalledAt, RecurrenceCount, PromotedBeadID, Kind, AutoActionable) and matching SQLite schema/migration/reindex changes. Notes the content-signature-verification method used in place of SHA-pinning, per known rebase-churn instability on the source branch (crn-6qbb), and the branch-reconstruction rationale for producing clean ancestry from origin/main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Adds 5 new fields to the
Entrystruct and matching SQLite columns to theindex so entries can track recall/promotion lifecycle state:
Kind— distinguishes a plain note (default, empty) from aremediationentryAutoActionable— reviewer-granted flag for remediation entries that can beacted on automatically; not self-declarable by the entry's own creation path
RecurrenceCount— incremented when a new entry is captured with the sametopic key as an existing one
PromotedBeadID— set once an entry is promoted to a tracked bead, guardingagainst double-promotion
LastRecalledAt(RFC3339) — stamped only by the get/freshness/verify path,not by capture
All 5 fields are additive and zero-value-safe: existing entries with none of
this metadata parse and round-trip unchanged (
omitempty/omitzerotagsthroughout).
Why built this way
The index table gets the same 5 columns via a forward migration
(
addColumnIfMissing), so existing on-disk indexes upgrade in place. Thethree index-only fields (
RecurrenceCount,PromotedBeadID,LastRecalledAt)plus
Kind/AutoActionableare deliberately excluded from reindex'sON CONFLICT(id) DO UPDATE SETclause — the same treatment the existinghit_countcolumn already gets. Reindexing rebuilds the index from eachentry's body file, but these fields are written directly via SQL by other
call sites after an entry already exists; if reindex overwrote them on every
run, it would stamp live index-only state back to the body's stale seed
value. Excluding them from the UPDATE SET means insert-if-absent still works
for new rows, while existing rows keep whatever the index already has.
What to review
internal/cairn/entry.go— the 5 new struct fields and their toml tagsinternal/cairn/index.go— new columns in theCREATE TABLE, themigration column list, and the
reindexTxINSERT/upsert logic (note thebool→int conversion for
AutoActionable, and the intentional gap in theDO UPDATE SETclause)Test plan
TestParseEntryNewFieldsZeroValues/TestParseEntryNewFieldsRoundTrip—parsing with none vs. all of the new fields present
TestEntryMarshalRoundTripsNewFields/TestEntryMarshalOmitsZeroValueNewFields— serialization round-trips and confirms zero values stay omitted
TestReindexPreservesNewIndexOnlyFields— reindex does not clobberindex-only state written outside the body file
TestReindexPopulatesNewFieldColumns— fresh rows get correct valuesTestReindexMigratesLegacyIndexSchemaNewFields— an old on-disk indexwithout these columns migrates forward cleanly
All existing and new tests pass, including
-race.gofmt,go vet, andgolangci-lintare clean.