A file-based task manager
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove legacy .tsk/ migration and tighten dead-code allows

The pre-rewrite file-based workspace lived under `<repo>/.tsk/`. Its
auto-migration into `<git-dir>/tsk/` has been in place long enough that
no live workspace still needs it; drop the migration block from
Workspace::init and its accompanying test. Update workspace and queue
module docs to describe the current ref-only storage.

Replace the blanket #![allow(dead_code)] on workspace.rs with targeted
field-level allows on Task.id/Task.stable/InboxItem.stable — those are
exposed API even though nothing reads them yet, but the rest of the
file is now warning-clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+7 -38
+1 -1
src/queue.rs
··· 6 6 //! inbox/<src>-<n> → blob: stable id of a task assigned by queue <src> 7 7 //! 8 8 //! Queues are pushed/shared (refspec `refs/tsk/*`). The active queue per-user 9 - //! is selected by the `.tsk/queue` file. 9 + //! is selected by `<git-dir>/tsk/queue`. 10 10 11 11 use crate::errors::{Error, Result}; 12 12 use crate::object::StableId;
+6 -37
src/workspace.rs
··· 1 1 //! High-level workspace API. Orchestrates [`object`], [`namespace`], and 2 2 //! [`queue`] to back the CLI commands. 3 3 //! 4 - //! On disk the workspace is just a `.tsk/` marker directory inside a git 5 - //! repository. `.tsk/namespace` and `.tsk/queue` select the user's active 6 - //! namespace and queue (defaults: `tsk` / `tsk`). 7 - 8 - #![allow(dead_code)] 4 + //! Per-clone state lives under `<git-dir>/tsk/` (not tracked, not pushed). 5 + //! Two files select the active namespace and queue (defaults: `tsk` / `tsk`): 6 + //! `<git-dir>/tsk/namespace` and `<git-dir>/tsk/queue`. 9 7 10 8 use crate::errors::{Error, Result}; 11 9 use crate::object::{self, StableId, Task as TaskObj}; ··· 87 85 /// User-facing task: human id (in active namespace) + content + properties. 88 86 /// Each property holds zero or more text values. 89 87 pub struct Task { 88 + #[allow(dead_code)] // exposed for callers; constructed by workspace 90 89 pub id: Id, 90 + #[allow(dead_code)] // exposed for callers; constructed by workspace 91 91 pub stable: StableId, 92 92 pub title: String, 93 93 pub body: String, ··· 112 112 pub struct InboxItem { 113 113 pub key: String, 114 114 pub source_queue: String, 115 + #[allow(dead_code)] // exposed for callers; constructed by workspace 115 116 pub stable: StableId, 116 117 pub title: String, 117 118 } ··· 133 134 .ok_or_else(|| Error::Parse("tsk requires an enclosing git repository".into()))?; 134 135 let state_dir = git_dir.join(STATE_DIR); 135 136 std::fs::create_dir_all(&state_dir)?; 136 - // Lift any pre-existing selectors out of a legacy `.tsk/` directory 137 - // *before* writing defaults, so the migrated values win. 138 - if let Some(workdir) = git_dir.parent() { 139 - let legacy = workdir.join(".tsk"); 140 - if legacy.is_dir() { 141 - for name in [NAMESPACE_FILE, QUEUE_FILE] { 142 - let src = legacy.join(name); 143 - let dst = state_dir.join(name); 144 - if src.exists() && !dst.exists() { 145 - let _ = std::fs::copy(&src, &dst); 146 - } 147 - } 148 - let _ = std::fs::remove_dir_all(&legacy); 149 - } 150 - } 151 137 let ns = state_dir.join(NAMESPACE_FILE); 152 138 if !ns.exists() { 153 139 std::fs::write(&ns, namespace::DEFAULT_NS.as_bytes())?; ··· 1146 1132 // The state files should live under <git-dir>/tsk/. 1147 1133 assert!(dir.path().join(".git/tsk/namespace").exists()); 1148 1134 assert!(dir.path().join(".git/tsk/queue").exists()); 1149 - } 1150 - 1151 - #[test] 1152 - fn legacy_dot_tsk_directory_is_migrated_and_removed() { 1153 - let dir = tempfile::tempdir().unwrap(); 1154 - run_git_init(dir.path()); 1155 - // Simulate an old workspace with a tracked `.tsk/namespace` already. 1156 - let legacy = dir.path().join(".tsk"); 1157 - std::fs::create_dir(&legacy).unwrap(); 1158 - std::fs::write(legacy.join("namespace"), b"alpha").unwrap(); 1159 - std::fs::write(legacy.join("queue"), b"review").unwrap(); 1160 - 1161 - Workspace::init(dir.path().to_path_buf()).unwrap(); 1162 - let ws = Workspace::from_path(dir.path().to_path_buf()).unwrap(); 1163 - assert_eq!(ws.namespace(), "alpha", "legacy namespace must migrate"); 1164 - assert_eq!(ws.queue(), "review", "legacy queue must migrate"); 1165 - assert!(!legacy.exists(), "legacy .tsk/ must be removed"); 1166 1135 } 1167 1136 1168 1137 #[test]