M5a plan: tasks 21 and 22, from the device check

21: the ledger raises a session's state by the stricter of the grant's
label and the result's own, so a clean session that recalls a
memory-tainted note becomes untrusted and cannot write it into
memory.md (found on straylight, 2026-09-25). 22: the answers to a note
name notes.md, and for an untrusted add the file that was not changed.
The new given tests are ledger_label.rs and new versions of memoryd's
edit.rs and serve.rs; the old copies are kept as -task06 and -task10. On
a scratch tree at the end of task 20: the named tests fail and then pass,
5 and 4 mutations are caught, and the gate passes with 944 tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-25 17:55:41 -07:00
co-authored by Claude Opus 5.5
parent f025c811c0
commit f389a9a43a
8 changed files with 1012 additions and 9 deletions
@@ -4,7 +4,7 @@
#[path = "support/tmp.rs"]
mod tmp;
use memoryd::edit::{Context, SAVED_AS_NOTE, apply};
use memoryd::edit::{Context, apply};
use memoryd::files::Store;
use memoryd::notes::{self, Kind};
use proto::{DataClass, MemoryArgs, MemoryFile, Timestamp};
@@ -94,14 +94,17 @@ fn a_note_is_labelled_by_the_session() {
let f = Fixture::new("edit-note");
assert_eq!(
f.call(r#"{"action":"note","text":"The launch moved."}"#, false),
Ok("noted".to_string())
Ok("saved in notes.md".to_string())
);
assert_eq!(
f.call(
r#"{"action":"note","text":"example.org says March."}"#,
true
),
Ok("noted (untrusted)".to_string())
Ok(
"saved in notes.md, marked untrusted: this session has read untrusted content"
.to_string()
)
);
assert_eq!(
f.file("notes.md"),
@@ -127,7 +130,7 @@ fn an_untrusted_session_can_take_notes_but_not_change_identity() {
r#"{"action":"add","file":"user","text":"Owner lives in Oslo."}"#,
true
),
Ok(SAVED_AS_NOTE.to_string())
Ok("not added to user.md: this session has read untrusted content, so it was saved in notes.md as an untrusted note".to_string())
);
assert_eq!(f.file("user.md"), "");
assert!(