Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .agents/skills/layerfs-sdk-observe/references/reads.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ Names of the earlier 2.0 surface, removed with no alias: `branch.commits`,

`branch.list(project)`: every Branch, `main` included, as
`{ branch, commit }` (the head); the long form adds `forked_from`, `id`,
`base` and `root`.
`base` and `root`. `main`'s `id` is the Branch the project records for its
main line, the Branch a mount on `main` is scoped to; it is null only when
the project records no such Branch.

`commit.list(project, branch)`: newest first; on `main`, its publications
(with `source_branch`). One long row:
Expand Down
4 changes: 4 additions & 0 deletions .lww
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
%include .gitignore
# The Git index is regenerated by every git command; keep the newer side
# whole instead of conflicting on the binary file.
/.git/index
2 changes: 1 addition & 1 deletion api/crates/layerfs-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub use layerfs_control::machine::running;
/// The worker protocol (`layerfs-machine`) and its server (`layerfs-control`),
/// for the front ends and their tests.
pub mod worker {
pub use layerfs_control::worker_server::{prepare_network, serve};
pub use layerfs_control::worker_server::{prepare_network, serve, serve_with_incarnation};
pub use layerfs_machine::worker::*;
}
pub use layerfs_control::store::close_idle;
Expand Down
4 changes: 2 additions & 2 deletions api/crates/layerfs-api/src/project/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! The `project` family: 7 calls, one file each.
//! The `project` family: 8 calls, one file each.
mod delete;
mod doctor;
mod export;
Expand All @@ -17,9 +17,9 @@ pub(crate) fn calls() -> Calls {
list::CALL,
get::CALL,
stats::CALL,
doctor::CALL,
export::CALL,
delete::CALL,
hide_path::CALL,
doctor::CALL,
]
}
2 changes: 2 additions & 0 deletions api/crates/layerfs-api/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod list;
mod r#move;
mod remove;
mod remove_auth;
mod repair_mount_holders;
mod save_auth;
mod update;

Expand All @@ -36,6 +37,7 @@ pub(crate) fn calls() -> Calls {
r#move::CALL,
remove::CALL,
compact::CALL,
repair_mount_holders::CALL,
doctor::CALL,
]
}
66 changes: 66 additions & 0 deletions api/crates/layerfs-api/src/store/repair_mount_holders.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//! `store.repair_mount_holders`: explicit first-class repair of one Branch's
//! mount admissions, on the machine whose worker holds a SQLite Store and in
//! this process for a PostgreSQL Store. Preview changes no live admission,
//! answers the typed holder view and writes its own retained done row
//! (`action=preview`, no operation); settle/release name one op; `audit` reads
//! the bounded retained done rows of that Branch. Release retains the row as
//! the durable operator audit and records
//! the operator label; every call is also in the home's `trace/calls.jsonl`
//! call log.
use crate::calls::table::{
a, call, opt, Call,
Kind::{Bool, Int, Name, Text},
};
use crate::calls::Context;
use layerfs_bridge::control::SdkValue;
use layerfs_home::names::StoreName;
use layerfs_home::outcome::{refused, Outcome};

pub(crate) const CALL: Call = call(
"store",
"repair_mount_holders",
&[
a("name", Name),
a("project", Name),
a("branch", Name),
a("action", Name),
],
&[
opt("op", Text),
opt("legacy", Bool),
opt("operator", Text),
opt("page", Int),
opt("limit", Int),
],
"list, preview, settle, release or audit mount holders (operator)",
run,
);

fn run(context: &mut Context<'_>, args: &SdkValue) -> Outcome {
let name = StoreName::parse(args.get_text("name").unwrap_or(""))?;
let project = args.get_text("project").unwrap_or("").to_owned();
let branch = args.get_text("branch").unwrap_or("").to_owned();
let action = args.get_text("action").unwrap_or("preview").to_owned();
let op = match args.get_text("op") {
None | Some("") => None,
Some(text) => Some(
layerfs_bridge::sdk_values::unhex(text)
.and_then(|bytes| bytes.try_into().ok())
.ok_or_else(|| refused("InvalidInput", "op must be 16 bytes of hex"))?,
),
};
let legacy = matches!(args.get("legacy"), Some(SdkValue::Bool(true)));
let operator = args.get_text("operator").unwrap_or("");
let page = args
.get_int("page")
.and_then(|page| u32::try_from(page).ok())
.unwrap_or(0);
let limit = args
.get_int("limit")
.and_then(|limit| u32::try_from(limit).ok())
.unwrap_or(100);
let (home, _) = context.parts();
layerfs_control::store::repair(
home, &name, &project, &branch, &action, op, legacy, operator, page, limit,
)
}
2 changes: 1 addition & 1 deletion api/crates/layerfs-api/tests/calls_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,10 +753,10 @@ fn a_migrated_entry_declares_its_forms_and_the_others_declare_none() {
"project.list",
"project.get",
"project.stats",
"project.doctor",
"project.export",
"project.delete",
"project.hide_path",
"project.doctor",
];
let sandbox = [
"sandbox.create",
Expand Down
Loading