Projects: shareable, registry-backed, container-mounted; drop ticket board
Nightly Build / build (push) Successful in 6m27s

Rework projects from single-user leftovers into shareable endeavours.

- DB: move `projects` from the owner bucket to the registry (system.db,
  not encrypted); add `owner_user_id` + `slug` (drop free `path`); new
  `project_members(project_id, user_id, can_write)` mirroring
  `shared_folder_members`. Drop `project_tickets` entirely. Only user↔agent
  conversations stay encrypted (per-user DB) — each member keeps a private
  project chat. Registry home dissolves the cross-DB-FK problem.
- Filesystem/container: on disk `{WD}/projects/{owner_userid}/{slug}`,
  agent/container path `projects/{owner_username}/{slug}`. Two-segment routing
  in UserFs (ProjectMount + host_base_and_tail arm) and a second loop in
  build_user_fs; read-only members get a :ro mount. Reuse the shared-folder
  remount machinery (refresh_user_shared_folders -> refresh_user_mounts).
- Remove the ticket system: ProjectTicketManager, UserContext.tickets, its
  wiring, and the project_tickets references in scheduled_jobs/cron.
- API: repoint handlers to the registry pool + membership scoping. Sharing is
  self-service — owner or any write-member may add/remove members and set
  read/write; only the owner deletes; the owner cannot be removed. New
  POST/DELETE /api/projects/{id}/members[/{user_id}]. Seed `@fs_any allow
  projects/*`; build_runtime_run_context sets working_directory to the agent
  path and drops the host-path allow_fs_writes.
- Frontend: create form without the free path field, owner/read-write badges;
  the detail page becomes header + description + sharing panel + Open chat + a
  file-explorer placeholder (the future primary surface). i18n en/it/fr.
This commit is contained in:
2026-07-20 22:21:10 +01:00
parent bd88f02226
commit 2ec394c17c
26 changed files with 963 additions and 1245 deletions
+19 -1
View File
@@ -264,6 +264,7 @@ mod tests {
"skald-test",
PathBuf::from("/root"),
vec![],
vec![],
))
}
@@ -273,14 +274,17 @@ mod tests {
#[cfg(unix)]
#[test]
fn host_path_resolves_and_contains() {
use core_api::user_fs::SharedMount;
use core_api::user_fs::{ProjectMount, SharedMount};
let root = std::env::temp_dir().join(format!("skald-fsroot-{}", std::process::id()));
let home = root.join("homes").join("u1");
let shared = root.join("shared").join("family");
// Project owned by user `owner-id`, agent-visible as `projects/alice/budget`.
let project = root.join("projects").join("owner-id").join("budget");
let _ = std::fs::remove_dir_all(&root);
std::fs::create_dir_all(&home).unwrap();
std::fs::create_dir_all(&shared).unwrap();
std::fs::create_dir_all(&project).unwrap();
let fs = UserFs::new(
"u1",
@@ -293,10 +297,18 @@ mod tests {
container: PathBuf::from("/root/shared/family"),
can_write: true,
}],
vec![ProjectMount {
owner_username: "alice".into(),
slug: "budget".into(),
host: project.clone(),
container: PathBuf::from("/root/projects/alice/budget"),
can_write: false,
}],
);
let home_canon = canonicalize_for_policy(&home.to_string_lossy(), Path::new("/"));
let shared_canon = canonicalize_for_policy(&shared.to_string_lossy(), Path::new("/"));
let project_canon = canonicalize_for_policy(&project.to_string_lossy(), Path::new("/"));
// ~/… → private home (containment holds for a not-yet-existing file).
let p = resolve_host_path(&fs, "~/notes.md").unwrap();
@@ -306,9 +318,15 @@ mod tests {
// shared/{member} → the shared host dir
let s = resolve_host_path(&fs, "shared/family/list.md").unwrap();
assert!(path_under(&s, &shared_canon), "{s:?}");
// projects/{owner}/{slug} → the project host dir (two-segment routing)
let pr = resolve_host_path(&fs, "projects/alice/budget/plan.md").unwrap();
assert!(path_under(&pr, &project_canon), "{pr:?}");
// a shared folder the user is NOT a member of → error
assert!(resolve_host_path(&fs, "shared/secret/x.md").is_err());
// a project the user cannot reach (wrong owner/slug) → error
assert!(resolve_host_path(&fs, "projects/bob/budget/x.md").is_err());
assert!(resolve_host_path(&fs, "projects/alice/secret/x.md").is_err());
// `..` cannot climb out of the home
assert!(resolve_host_path(&fs, "~/../u2/secret.md").is_err());