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

@ -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()