refactor: strip doc and issue narration from code comments

Remove PRD/doc paths, bead IDs, phase notes and deleted-test references
from comments; drop test-only hooks left by the test deletion. Includes
in-progress archied bootstrap, gateway and query changes.
This commit is contained in:
sam committed 2026-10-03 21:47:46 +10:00
1 parent 15e55c1c50
commit 96e5d7b84b
269 files changed
+1201 -2609

No files matched your search

@@ -1,8 +1,7 @@
// Package memory implements domain/memory.MemoryEngine over concrete
// backends. The builtin engine persists each scope's records as markdown
// under its root -- human-readable and hand-editable -- with a per-scope
// HISTORY.md retaining the states that are no longer live. See
// docs/prds/memory-engine-unification.md for the decision this implements.
// Package memory implements domain/memory.MemoryEngine over concrete backends.
// The builtin engine persists each scope's records as markdown under its root
// -- human-readable and hand-editable -- with a per-scope HISTORY.md retaining
// the states that are no longer live.
package memory
import (
@@ -45,7 +44,6 @@ const defaultQueryLimit = 100
// contentScanner is the family's content scanner, applied in Create and
// Update. Those two are the one choke point every producer crosses, so the
// curator's model-extracted content is covered as well as the chat tool's
// (docs/prds/memory-engine-unification.md §7).
var contentScanner domainmemory.Scanner = &domainmemory.DefaultScanner{}
// scopeStores is one scope's on-disk pair: the heads, and the states that
@@ -403,13 +401,13 @@ func (e *BuiltinEngine) Update(_ context.Context, in domainmemory.RecordUpdate)
}
// Read the document as it is on disk before anything is decided from it.
// This engine caches the scope's document and rewrites it whole (the PRD
// leaves "two processes, one scope file" undecided), so the copy it holds
// can be a whole write out of date -- the Expected check below would
// compare against a revision that is already superseded, and the rewrite
// that follows it would write the stale copy back over the current one.
// What this does not fix: the rewrite is still last-writer-wins for this
// record and every other one, between the reload and the write.
// This engine caches the scope's document and rewrites it whole, so the
// copy it holds can be a whole write out of date -- the Expected check
// below would compare against a revision that is already superseded, and
// the rewrite that follows it would write the stale copy back over the
// current one. What this does not fix: the rewrite is still
// last-writer-wins for this record and every other one, between the reload
// and the write.
if err := stores.live.Reload(); err != nil {
return domainmemory.Record{}, err
}
@@ -436,7 +434,6 @@ func (e *BuiltinEngine) Update(_ context.Context, in domainmemory.RecordUpdate)
// Crash safety, in this order: the superseded state is durable in
// HISTORY.md before the live block is touched. A crash between the two
// leaves an extra history entry and an unchanged record -- recoverable,
// per §2 -- and never a record whose previous state is gone.
if err := appendHistory(stores.history, current.marker, current.content(), now, false); err != nil {
return domainmemory.Record{}, err
}
+5 -10
View File
@@ -11,7 +11,6 @@ import (
// historyFileName is the second document in each scope's directory: every
// state the scope's records no longer live in -- superseded by an Update, or
// removed by a Forget -- so a record's provenance outlives its content
// (docs/prds/memory-engine-unification.md §2).
const historyFileName = "HISTORY.md"
// historySectionName is the single section every retained state is appended
@@ -23,14 +22,10 @@ const historySectionName = "history"
// the live document's bound (builtin's 100KB default, which is what
// production passes: bootstrap builds the engine with a 0 maxFileBytes).
//
// It has its own bound because history grows on every Update and every
// Forget while the live document does not. Inheriting the live document's
// bound would make a scope start refusing updates after a handful of
// revisions of one large record -- trading the PRD's open "unbounded
// history" question ("Not determined", no compaction policy) for a new
// failure mode at the point of write. That question stays open; this bound
// only makes reaching it a deliberate, enormous amount of history rather
// than an accident.
// It has its own bound because history grows on every Update and every Forget
// while the live document does not. That question stays open; this bound only
// makes reaching it a deliberate, enormous amount of history rather than an
// accident.
const historyMaxFileBytes = 4 * 1024 * 1024
// appendHistory appends one retained state -- the record as it was while
@@ -54,7 +49,7 @@ func appendHistory(h *builtin.Store, m markerData, content string, at time.Time,
// oldest first. Document order is append order, and a retained state is
// appended exactly when it stops being live, so no sort is needed -- or
// wanted: a crash between a history append and the live write leaves two
// entries for one revision (§2, recoverable), and sorting would not make
// entries for one revision, and sorting would not make
// that less true.
func revisionsOf(h *builtin.Store, scope domainmemory.Scope, id domainmemory.RecordID) []domainmemory.Revision {
var revisions []domainmemory.Revision
+3 -8
View File
@@ -8,14 +8,9 @@ import (
"time"
)
// The engine writes each record as one blank-line-delimited markdown block
// whose first line is a marker comment followed by the record's content, so
// a block stays readable and editable by hand. The marker began life as a
// bare id (`<!--mem:<ulid>-->`, the incumbent format); it is JSON now
// because the retained provenance -- revision, kind, author, originating
// user, source and both timestamps -- has nowhere else to live, which is
// exactly what the PRD's Settles table records the bare form could not
// carry.
// Each record is one blank-line-delimited markdown block whose first line is a
// JSON marker comment carrying the record's provenance, followed by its
// content, so a block stays editable by hand.
const (
markerPrefix = "<!--mem:"
markerSuffix = "-->"