feat(mentor): dismiss & decay Learnings (#27)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Dismissed patterns fade instead of haunting. Dismissing a Learning stamps decay state into its own frontmatter (dismissed date, dismiss_count, dismissed_at_pass — every other line preserved verbatim, hand-editable, git-diffable) and hides it from every pass: query_learnings serves only visible learnings. Resurfacing is an output clock, not a calendar — a per-type counter under <home>/learnings/pass-counts.json, ticked by every completed pass (cancels and refusals never advance, so never tick), returns the Learning after 10 subsequent passes of its content type; each re-dismiss doubles the interval (10→20→40…), and a per-Learning resurface_after frontmatter key overrides the base. Hand-edited decay state reads leniently: garbage means visible, absurd values clamp, a hand-edit can never trap the pane or the rail. The Learnings pane rows dismiss (no confirm — low-stakes, self-healing), dim while hidden with a resurfaces-in-N countdown, and foreign unclocked type dirs neither offer Dismiss nor show a verdict — their clock can never advance. Two review waves (two-axis implement review + three-reviewer finish-audit: security clean) produced five fixes, each pinned or noted in the session log. Closes #27
This commit is contained in:
1 parent
0e5c28ad95
commit
78c8844184
15 files changed
+911
-66
No files matched your search
@@ -14,15 +14,6 @@ import Foundation
|
||||
@testable import Museion
|
||||
import Testing
|
||||
|
||||
/// The store's stamp conventions (en_US_POSIX, per access) — expected
|
||||
/// learning filenames/dates in the #26 promote pins.
|
||||
private func stamped(_ date: Date, _ format: String) -> String {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateFormat = format
|
||||
formatter.locale = Locale(identifier: "en_US_POSIX")
|
||||
return formatter.string(from: date)
|
||||
}
|
||||
|
||||
/// A fully-stamped card for hand-written fixtures (scan tests). Defaults
|
||||
/// match the historical shape; apply tests override anchor/lane, the rank
|
||||
/// pins override submittedAt/rank. Internal — FixCardApplyTests shares it
|
||||
@@ -83,7 +74,7 @@ struct MCPToolsPromoteTests {
|
||||
|
||||
// ONE file, the pinned name shape.
|
||||
let dir = home.appendingPathComponent("learnings/posts", isDirectory: true)
|
||||
let name = "\(stamped(now, "yyyyMMdd"))-hedging.md"
|
||||
let name = "\(FixCardStore.formatted(now, "yyyyMMdd"))-hedging.md"
|
||||
#expect(try FileManager.default.contentsOfDirectory(atPath: dir.path).filter { $0.hasSuffix(".md") } == [name])
|
||||
|
||||
let markdown = try String(contentsOf: dir.appendingPathComponent(name), encoding: .utf8)
|
||||
@@ -95,7 +86,7 @@ struct MCPToolsPromoteTests {
|
||||
#expect(markdown.contains("piece: test-piece\n"))
|
||||
#expect(markdown.contains("pass: 1\n"))
|
||||
#expect(markdown.contains("engine: hermes\n"))
|
||||
#expect(markdown.contains("promoted: \(stamped(now, "yyyy-MM-dd"))\n"))
|
||||
#expect(markdown.contains("promoted: \(FixCardStore.formatted(now, "yyyy-MM-dd"))\n"))
|
||||
#expect(markdown.contains("from_card: \(written[0].card.id.uuidString)\n"))
|
||||
// The Learning teaches, it never re-quotes the instance: a
|
||||
// mechanical fix is a literal replacement string from one piece
|
||||
@@ -106,7 +97,7 @@ struct MCPToolsPromoteTests {
|
||||
#expect(!markdown.contains("Cut the hedge."))
|
||||
#expect(markdown.contains("\n# Hedging\n"))
|
||||
#expect(markdown.contains("**Problem.** The hedge weakens the claim."))
|
||||
#expect(markdown.contains("*Promoted from test-piece · Pass 1 · \(stamped(now, "yyyy-MM-dd")).*"))
|
||||
#expect(markdown.contains("*Promoted from test-piece · Pass 1 · \(FixCardStore.formatted(now, "yyyy-MM-dd")).*"))
|
||||
|
||||
// The returned card carries promotedAt; so does the re-scan.
|
||||
#expect(promoted.promotedAt == now)
|
||||
@@ -168,7 +159,7 @@ struct MCPToolsPromoteTests {
|
||||
_ = try FixCardStore.promote(pieceURL: piece, card: written[1].card, now: now)
|
||||
|
||||
let dir = home.appendingPathComponent("learnings/posts", isDirectory: true)
|
||||
let base = "\(stamped(now, "yyyyMMdd"))-hedging"
|
||||
let base = "\(FixCardStore.formatted(now, "yyyyMMdd"))-hedging"
|
||||
#expect(try FileManager.default.contentsOfDirectory(atPath: dir.path).sorted() == ["\(base)-2.md", "\(base).md"])
|
||||
}
|
||||
|
||||
@@ -203,7 +194,7 @@ struct MCPToolsPromoteTests {
|
||||
#expect(markdown.contains("**Example.** Rewritten as the master would pace it."))
|
||||
#expect(markdown.contains("# Hedging across lines\n"))
|
||||
// No provenance → the footer's piece falls back to "a fix card".
|
||||
#expect(markdown.contains("*Promoted from a fix card · \(stamped(now, "yyyy-MM-dd")).*"))
|
||||
#expect(markdown.contains("*Promoted from a fix card · \(FixCardStore.formatted(now, "yyyy-MM-dd")).*"))
|
||||
}
|
||||
|
||||
/// Pre-#26 card JSON (no promoted_at key) decodes promotedAt nil; a
|
||||
|
||||
Reference in new issue
Block a user