Remove .md suffix stripping from key lookups

The strip_md_suffix function was removed but its usages remained,
causing lookups like `identity.md` to fail (stripped to `identity`
which didn't exist). Now keys are used as-is.

Renamed 4 nodes that had .md suffixes to canonical form:
- identity.md → identity
- promotion-work-queue.md-* → promotion-work-queue-*
- patterns.md#* → patterns-*
- practices.md#* → practices-*

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-15 02:08:35 -04:00
parent 6c28eebb3f
commit e8462af505
3 changed files with 4 additions and 30 deletions

View file

@ -5,7 +5,6 @@
use anyhow::{bail, Context, Result};
use crate::hippocampus as memory;
use crate::store;
pub async fn cmd_weight_set(key: &str, weight: f32) -> Result<()> {
super::check_dry_run();
@ -48,9 +47,8 @@ pub async fn cmd_render(key: &[String]) -> Result<()> {
bail!("render requires a key");
}
let key = key.join(" ");
let bare = store::strip_md_suffix(&key);
let rendered = memory::memory_render(None, &bare, None).await?;
let rendered = memory::memory_render(None, &key, None).await?;
print!("{}", rendered);
// Mark as seen if we're inside a Claude session (not an agent subprocess —
@ -67,7 +65,7 @@ pub async fn cmd_render(key: &[String]) -> Result<()> {
{
use std::io::Write;
let ts = chrono::Local::now().format("%Y-%m-%dT%H:%M:%S");
let _ = writeln!(f, "{}\t{}", ts, bare);
let _ = writeln!(f, "{}\t{}", ts, key);
}
}

View file

@ -36,17 +36,6 @@ use redb::Database;
use std::sync::atomic::AtomicU64;
use std::sync::Mutex;
/// Strip .md suffix from a key, handling both bare keys and section keys.
/// "identity.md" → "identity", "foo.md#section" → "foo#section", "identity" → "identity"
pub fn strip_md_suffix(key: &str) -> String {
if let Some((file, section)) = key.split_once('#') {
let bare = file.strip_suffix(".md").unwrap_or(file);
format!("{}#{}", bare, section)
} else {
key.strip_suffix(".md").unwrap_or(key).to_string()
}
}
// The full in-memory store with internal locking
pub struct Store {
/// Log sizes at load time — used for staleness detection.
@ -167,11 +156,8 @@ impl Store {
}
pub fn resolve_key(&self, target: &str) -> Result<String> {
// Strip .md suffix if present — keys no longer use it
let bare = strip_md_suffix(target);
if self.contains_key(&bare)? {
return Ok(bare);
if self.contains_key(target)? {
return Ok(target.to_string());
}
let db = self.db.as_ref()

View file

@ -23,16 +23,6 @@ fn normalize_link_key(raw: &str) -> String {
let mut key = key.to_string();
// Strip .md suffix if present
if let Some(stripped) = key.strip_suffix(".md") {
key = stripped.to_string();
} else if key.contains('#') {
let (file, section) = key.split_once('#').unwrap();
if let Some(bare) = file.strip_suffix(".md") {
key = format!("{}-{}", bare, section);
}
}
// weekly/2026-W06 → weekly-2026-W06, etc.
if let Some(pos) = key.find('/') {
let prefix = &key[..pos];