refactor: remove workflow machinery
This commit is contained in:
@@ -100,7 +100,7 @@ fn push_kind_records(out: &mut String, layout: &WorkspaceLayout, kind: RecordKin
|
||||
let dir = match kind {
|
||||
RecordKind::Decision => layout.decisions_dir(),
|
||||
RecordKind::Request => layout.requests_dir(),
|
||||
RecordKind::Knowledge | RecordKind::Summary | RecordKind::Workflow => return,
|
||||
RecordKind::Knowledge | RecordKind::Summary => return,
|
||||
};
|
||||
let entries = match std::fs::read_dir(&dir) {
|
||||
Ok(it) => it,
|
||||
|
||||
@@ -141,7 +141,7 @@ fn read_kind_records(layout: &WorkspaceLayout, kind: RecordKind) -> BTreeMap<Str
|
||||
RecordKind::Decision => layout.decisions_dir(),
|
||||
RecordKind::Request => layout.requests_dir(),
|
||||
RecordKind::Knowledge => layout.knowledge_dir(),
|
||||
RecordKind::Summary | RecordKind::Workflow => return BTreeMap::new(),
|
||||
RecordKind::Summary => return BTreeMap::new(),
|
||||
};
|
||||
let mut out: BTreeMap<String, String> = BTreeMap::new();
|
||||
let entries = match std::fs::read_dir(&dir) {
|
||||
|
||||
@@ -39,7 +39,6 @@ impl ExistingRecords {
|
||||
RecordKind::Decision => self.decisions.contains_key(slug),
|
||||
RecordKind::Request => self.requests.contains(slug),
|
||||
RecordKind::Knowledge => self.knowledge.contains(slug),
|
||||
RecordKind::Workflow => false,
|
||||
RecordKind::Summary => false,
|
||||
}
|
||||
}
|
||||
@@ -53,7 +52,6 @@ impl ExistingRecords {
|
||||
RecordKind::Decision => self.decisions.keys().collect(),
|
||||
RecordKind::Request => self.requests.iter().collect(),
|
||||
RecordKind::Knowledge => self.knowledge.iter().collect(),
|
||||
RecordKind::Workflow => Vec::new(),
|
||||
RecordKind::Summary => Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,9 +140,6 @@ impl Linter {
|
||||
RecordKind::Summary => {
|
||||
self.check_kind::<SummaryFrontmatter>(content, &classified, &mut report);
|
||||
}
|
||||
RecordKind::Workflow => {
|
||||
unreachable!("workflow paths are not classified by memory linter")
|
||||
}
|
||||
}
|
||||
|
||||
report
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//! enumerate what records exist without knowing what's inside them.
|
||||
//!
|
||||
//! - `MemoryQuery` walks `.yoi/memory/{summary.md,decisions/,
|
||||
//! requests/}`. `.yoi/workflow/`, `.yoi/memory/_staging/`,
|
||||
//! requests/}`. `.yoi/memory/_staging/`,
|
||||
//! `.yoi/memory/_usage/`, and `.yoi/memory/_logs/` are excluded
|
||||
//! by construction.
|
||||
//! - `KnowledgeQuery` walks `.yoi/knowledge/*.md` and supports a
|
||||
@@ -524,7 +524,6 @@ mod tests {
|
||||
std::fs::create_dir_all(dir.path().join(".yoi/memory/decisions")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join(".yoi/memory/requests")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join(".yoi/memory/_staging")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join(".yoi/workflow")).unwrap();
|
||||
std::fs::create_dir_all(dir.path().join(".yoi/knowledge")).unwrap();
|
||||
(dir, layout)
|
||||
}
|
||||
@@ -637,24 +636,6 @@ mod tests {
|
||||
assert_eq!(records[0].kind, "summary");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn memory_query_excludes_workflow_and_staging() {
|
||||
let (dir, layout) = setup();
|
||||
let wf = dir.path().join(".yoi/workflow/wf.md");
|
||||
std::fs::write(&wf, "needle in workflow\n").unwrap();
|
||||
let stg = dir.path().join(".yoi/memory/_staging/abc.json");
|
||||
std::fs::write(&stg, "needle in staging\n").unwrap();
|
||||
|
||||
let (_, tool) = memory_query_tool(layout, QueryConfig::default())();
|
||||
let inp = serde_json::json!({ "query": "needle" });
|
||||
let out = tool
|
||||
.execute(&inp.to_string(), Default::default())
|
||||
.await
|
||||
.unwrap();
|
||||
let records: Vec<OwnedMemoryRecord> = parse_records(&out);
|
||||
assert!(records.is_empty(), "got records: {:?}", out.content);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn query_hits_do_not_log_usage() {
|
||||
let (dir, layout) = setup();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Workspace-local usage event log for memory / knowledge / workflow records.
|
||||
//! Workspace-local usage event log for memory / knowledge records.
|
||||
//!
|
||||
//! The log is append-only JSONL under the workspace's `.yoi/` tree. It is
|
||||
//! intentionally evidence-only: aggregation reports explicit context reads and
|
||||
@@ -26,7 +26,6 @@ pub enum UsageEventKind {
|
||||
pub enum UsageSource {
|
||||
MemoryRead,
|
||||
KnowledgeRef,
|
||||
WorkflowInvoke,
|
||||
ResidentInjection,
|
||||
}
|
||||
|
||||
@@ -35,7 +34,6 @@ impl UsageSource {
|
||||
match self {
|
||||
Self::MemoryRead => "MemoryRead",
|
||||
Self::KnowledgeRef => "KnowledgeRef",
|
||||
Self::WorkflowInvoke => "WorkflowInvoke",
|
||||
Self::ResidentInjection => "ResidentInjection",
|
||||
}
|
||||
}
|
||||
@@ -216,10 +214,6 @@ fn record_path(
|
||||
let slug = crate::Slug::parse(slug.to_string()).map_err(invalid_slug_error)?;
|
||||
Ok(layout.request_path(&slug))
|
||||
}
|
||||
RecordKind::Workflow => {
|
||||
let slug = crate::Slug::parse(slug.to_string()).map_err(invalid_slug_error)?;
|
||||
Ok(layout.workflow_path(&slug))
|
||||
}
|
||||
RecordKind::Knowledge => {
|
||||
let slug = crate::Slug::parse(slug.to_string()).map_err(invalid_slug_error)?;
|
||||
Ok(layout.knowledge_path(&slug))
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
//! `WorkspaceLayout` carries the root used by the memory subsystem.
|
||||
//! All yoi-managed memory content lives under the conventional
|
||||
//! `<root>/.yoi/` subdirectory — alongside workspace project records
|
||||
//! such as workflow and generated durable memory. The trees inside it:
|
||||
//! generated durable memory. The trees inside it:
|
||||
//!
|
||||
//! - `<root>/.yoi/workflow/<slug>.md`
|
||||
//! - `<root>/.yoi/knowledge/<slug>.md`
|
||||
//! - `<root>/.yoi/memory/summary.md`
|
||||
//! - `<root>/.yoi/memory/decisions/<slug>.md`
|
||||
@@ -14,9 +13,6 @@
|
||||
//! - `<root>/.yoi/memory/_logs/current.log` (append-only audit log)
|
||||
//!
|
||||
//! `memory/` is reserved for session-derived / generated state;
|
||||
//! Workflows are human-managed and live one level up under
|
||||
//! `.yoi/workflow/`.
|
||||
//!
|
||||
//! `memory.workspace_root` pins this root explicitly. Without an explicit
|
||||
//! root, resolution searches upward from the Worker pwd for a `.yoi/memory`
|
||||
//! marker; `.yoi` project records alone are not a memory marker.
|
||||
@@ -31,7 +27,6 @@ use lint_common::RecordLintError;
|
||||
const YOI_DIR: &str = ".yoi";
|
||||
const MEMORY_DIR: &str = "memory";
|
||||
const KNOWLEDGE_DIR: &str = "knowledge";
|
||||
const WORKFLOW_DIR: &str = "workflow";
|
||||
const SUMMARY_FILE: &str = "summary.md";
|
||||
const DECISIONS_DIR: &str = "decisions";
|
||||
const REQUESTS_DIR: &str = "requests";
|
||||
@@ -47,7 +42,6 @@ pub enum RecordKind {
|
||||
Summary,
|
||||
Decision,
|
||||
Request,
|
||||
Workflow,
|
||||
Knowledge,
|
||||
}
|
||||
|
||||
@@ -57,7 +51,6 @@ impl RecordKind {
|
||||
Self::Summary => "summary",
|
||||
Self::Decision => "decision",
|
||||
Self::Request => "request",
|
||||
Self::Workflow => "workflow",
|
||||
Self::Knowledge => "knowledge",
|
||||
}
|
||||
}
|
||||
@@ -86,7 +79,7 @@ impl WorkspaceLayout {
|
||||
/// An explicit `memory.workspace_root` is honored exactly. Without an
|
||||
/// explicit root, resolution searches `default_root` and its ancestors for
|
||||
/// the nearest `.yoi/memory` directory. This keeps child worktrees that
|
||||
/// contain `.yoi` project records such as tickets or workflows from
|
||||
/// contain `.yoi` project records such as tickets from
|
||||
/// becoming independent memory roots merely because they contain `.yoi`.
|
||||
///
|
||||
/// If no memory marker exists, this falls back to `default_root` because
|
||||
@@ -133,11 +126,6 @@ impl WorkspaceLayout {
|
||||
self.memory_dir().join(REQUESTS_DIR)
|
||||
}
|
||||
|
||||
/// Workflow directory: `<root>/.yoi/workflow/`.
|
||||
pub fn workflow_dir(&self) -> PathBuf {
|
||||
self.yoi_dir().join(WORKFLOW_DIR)
|
||||
}
|
||||
|
||||
pub fn staging_dir(&self) -> PathBuf {
|
||||
self.memory_dir().join(STAGING_DIR)
|
||||
}
|
||||
@@ -170,10 +158,6 @@ impl WorkspaceLayout {
|
||||
self.requests_dir().join(format!("{slug}.md"))
|
||||
}
|
||||
|
||||
pub fn workflow_path(&self, slug: &Slug) -> PathBuf {
|
||||
self.workflow_dir().join(format!("{slug}.md"))
|
||||
}
|
||||
|
||||
pub fn knowledge_path(&self, slug: &Slug) -> PathBuf {
|
||||
self.knowledge_dir().join(format!("{slug}.md"))
|
||||
}
|
||||
@@ -307,14 +291,6 @@ mod tests {
|
||||
assert_eq!(cp.kind, RecordKind::Knowledge);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn workflow_under_memory_is_invalid_path() {
|
||||
let err = layout()
|
||||
.classify(&PathBuf::from("/ws/.yoi/memory/workflow/wf.md"))
|
||||
.unwrap_err();
|
||||
assert!(matches!(err, LintError::InvalidPath(_)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn staging_returns_none() {
|
||||
assert!(
|
||||
@@ -414,7 +390,6 @@ mod tests {
|
||||
let child = workspace.join(".worktree/child");
|
||||
std::fs::create_dir_all(workspace.join(".yoi/memory")).unwrap();
|
||||
std::fs::create_dir_all(child.join(".yoi/tickets")).unwrap();
|
||||
std::fs::create_dir_all(child.join(".yoi/workflow")).unwrap();
|
||||
|
||||
let cfg = manifest::MemoryConfig::default();
|
||||
let layout = WorkspaceLayout::resolve(&cfg, &child);
|
||||
@@ -427,7 +402,6 @@ mod tests {
|
||||
let workspace = tmp.path().join("workspace");
|
||||
let child = workspace.join("child");
|
||||
std::fs::create_dir_all(workspace.join(".yoi/tickets")).unwrap();
|
||||
std::fs::create_dir_all(workspace.join(".yoi/workflow")).unwrap();
|
||||
std::fs::create_dir_all(&child).unwrap();
|
||||
|
||||
assert_eq!(find_memory_marker_root(&child), None);
|
||||
|
||||
Reference in New Issue
Block a user