Implement TUI search and mutation workflows

This commit is contained in:
Hermes Agent
2026-08-10 10:11:34 +00:00
parent c86ea9eb0e
commit ce3e4a9f79
13 changed files with 1195 additions and 93 deletions

View File

@@ -8,9 +8,10 @@ use ironstorage::{
command::{CopyRequest, MoveRequest, RemoveRequest},
crypto::{KeyInfo, KeyStore, SecretProvider, SecretProviderError},
mutation::{
MutationAction, MutationError, TreeCommit, TreeCommitError, TreeCommitter, TreeMutator,
MutationAction, MutationError, MutationSelection, TreeCommit, TreeCommitError,
TreeCommitter, TreeMutator,
},
repository::{EntryPath, Repository, SecretBytes},
repository::{DirectoryPath, EntryPath, Repository, SecretBytes},
write::OverwriteDecision,
};
use support::compatibility::{FixtureSet, TestResult};
@@ -124,7 +125,7 @@ fn copy_preserves_source_and_reencrypts_for_destination_policy() -> TestResult {
let mut committer = Committer::default();
let mutator = TreeMutator::new(&repository, &keys);
let source = repository.read_entry(&EntryPath::parse("email/personal")?)?;
mutator.copy(
let outcome = mutator.copy(
&CopyRequest {
source: "email/personal".into(),
destination: "team/personal".into(),
@@ -135,6 +136,12 @@ fn copy_preserves_source_and_reencrypts_for_destination_policy() -> TestResult {
&mut provider,
&mut committer,
)?;
assert_eq!(
outcome.selection(),
Some(&MutationSelection::Entry(EntryPath::parse(
"team/personal"
)?))
);
assert_eq!(
repository.read_entry(&EntryPath::parse("email/personal")?)?,
source
@@ -168,7 +175,7 @@ fn existing_and_trailing_slash_destinations_have_directory_semantics() -> TestRe
let mut provider = Secrets::all(&fixture);
let mutator = TreeMutator::new(&repository, &keys);
mutator.copy(
let copied = mutator.copy(
&CopyRequest {
source: "email/personal".into(),
destination: "archive/".into(),
@@ -179,9 +186,15 @@ fn existing_and_trailing_slash_destinations_have_directory_semantics() -> TestRe
&mut provider,
&mut Committer::default(),
)?;
assert_eq!(
copied.selection(),
Some(&MutationSelection::Entry(EntryPath::parse(
"archive/personal"
)?))
);
assert!(store.path().join("archive/personal.gpg").is_file());
mutator.copy(
let copied_directory = mutator.copy(
&CopyRequest {
source: "team/".into(),
destination: "archive/".into(),
@@ -192,6 +205,12 @@ fn existing_and_trailing_slash_destinations_have_directory_semantics() -> TestRe
&mut provider,
&mut Committer::default(),
)?;
assert_eq!(
copied_directory.selection(),
Some(&MutationSelection::Directory(DirectoryPath::parse(
"archive/team"
)?))
);
assert!(store.path().join("archive/team/service.gpg").is_file());
assert!(store.path().join("team/service.gpg").is_file());