memoryd: the day and the month of a time with get, never a slice

Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
2026-09-25 16:41:44 -07:00
parent 1adce5c9df
commit b98f373ead
5 changed files with 6 additions and 10 deletions
+2 -6
View File
@@ -84,11 +84,7 @@ pub(crate) fn append(store: &Store, mut record: Record, now: Timestamp) -> Resul
// `serde_json::to_string(&record)`, then `store.append(&format!("edits/{month}.jsonl"), // `serde_json::to_string(&record)`, then `store.append(&format!("edits/{month}.jsonl"),
// &format!("{line}\n"))?` where month is the first 7 characters of day. Ok(record.id). // &format!("{line}\n"))?` where month is the first 7 characters of day. Ok(record.id).
let rfc = now.to_rfc3339(); let rfc = now.to_rfc3339();
let day = if rfc.len() >= 10 { let day = rfc.get(..10).unwrap_or("0000-00-00");
&rfc[..10]
} else {
"0000-00-00"
};
let taken = records(store)? let taken = records(store)?
.iter() .iter()
.filter(|r| r.id.starts_with(&format!("{day}-"))) .filter(|r| r.id.starts_with(&format!("{day}-")))
@@ -97,7 +93,7 @@ pub(crate) fn append(store: &Store, mut record: Record, now: Timestamp) -> Resul
let edits_dir = store.path("edits"); let edits_dir = store.path("edits");
std::fs::create_dir_all(&edits_dir).map_err(|e| format!("{}: {e}", edits_dir.display()))?; std::fs::create_dir_all(&edits_dir).map_err(|e| format!("{}: {e}", edits_dir.display()))?;
let line = serde_json::to_string(&record).map_err(|e| e.to_string())?; let line = serde_json::to_string(&record).map_err(|e| e.to_string())?;
let month = &day[..7]; let month = day.get(..7).unwrap_or("0000-00");
store.append(&format!("edits/{month}.jsonl"), &format!("{line}\n"))?; store.append(&format!("edits/{month}.jsonl"), &format!("{line}\n"))?;
Ok(record.id) Ok(record.id)
} }
+1 -2
View File
@@ -34,8 +34,7 @@ pub struct Note {
/// A time as the notes show it: to the minute, in UTC. /// A time as the notes show it: to the minute, in UTC.
pub fn minute(time: Timestamp) -> String { pub fn minute(time: Timestamp) -> String {
let s = time.to_rfc3339(); let s = time.to_rfc3339();
let head = if s.len() >= 16 { &s[..16] } else { &s }; format!("{}Z", s.get(..16).unwrap_or(&s))
format!("{head}Z")
} }
fn class_name(class: DataClass) -> &'static str { fn class_name(class: DataClass) -> &'static str {
+1 -1
View File
@@ -158,7 +158,7 @@ pub fn recall(
Some(fts) => search(index, &fts, args.k)?, Some(fts) => search(index, &fts, args.k)?,
}; };
let rfc = now.to_rfc3339(); let rfc = now.to_rfc3339();
let month = &rfc[..7]; let month = rfc.get(..7).unwrap_or("0000-00");
std::fs::create_dir_all(store.path("recalls")).map_err(|e| format!("recalls: {e}"))?; std::fs::create_dir_all(store.path("recalls")).map_err(|e| format!("recalls: {e}"))?;
let logged = Logged { let logged = Logged {
time: rfc.clone(), time: rfc.clone(),
+1 -1
View File
@@ -100,7 +100,7 @@ pub fn submit(
// accepted")). // accepted")).
args.check()?; args.check()?;
let rfc = ctx.now.to_rfc3339(); let rfc = ctx.now.to_rfc3339();
let day = &rfc[..10]; let day = rfc.get(..10).unwrap_or("0000-00-00");
let taken = waiting(store)? let taken = waiting(store)?
.iter() .iter()
.filter(|line| match line { .filter(|line| match line {
+1
View File
@@ -6,6 +6,7 @@ reviewer adds findings under "Reviews" once per milestone.
| Task | Date | Status | Gate runs | First gate | Deviations | Notes | Model | | Task | Date | Status | Gate runs | First gate | Deviations | Notes | Model |
|---|---|---|---|---|---|---|---| |---|---|---|---|---|---|---|---|
| M5a/17-memoryd-no-slicing | 2026-09-25 | done | 1 | pass | none | The five slice-to-`get` edits exactly as the task gives: `notes.rs` `minute` two lines -> `format!("{}Z", s.get(..16).unwrap_or(&s))`; `journal.rs` `append` the five-line `day` -> `rfc.get(..10).unwrap_or("0000-00-00")` and `&day[..7]` -> `day.get(..7).unwrap_or("0000-00")`; `review.rs` `submit` `&rfc[..10]` -> `rfc.get(..10).unwrap_or("0000-00-00")`; `recall.rs` `recall` `&rfc[..7]` -> `rfc.get(..7).unwrap_or("0000-00")`. Left `&all[all.len().saturating_sub(count)..]` in `log` as instructed. `cargo fmt --all`; the step-2 grep for `\[..[0-9]+\]` prints nothing; `cargo test -p memoryd` every suite passes; `make gate` printed `gate: ok` on the first run, 936 tests unchanged. | Ornith-1.5-35B-A3B |
| M5a/16-macos-gate | 2026-09-25 | done (by the design model) | 1 | pass | none | The session's work was right and left uncommitted: the diff matches the task file line for line, and the copied `shell.rs` is identical to the plan's. The stop was right too: clippy 1.95 (the workspace's `rust-version`) flags `collapsible_match` in `memoryd`'s `index.rs`, which the plan's gate run did not catch. The design model fixed that in its own commit (44bdcbd), outside this task. Then `make gate` printed `gate: ok`, 936 tests. | Ornith-1.5-35B-A3B (the session); design model (the commit) | | M5a/16-macos-gate | 2026-09-25 | done (by the design model) | 1 | pass | none | The session's work was right and left uncommitted: the diff matches the task file line for line, and the copied `shell.rs` is identical to the plan's. The stop was right too: clippy 1.95 (the workspace's `rust-version`) flags `collapsible_match` in `memoryd`'s `index.rs`, which the plan's gate run did not catch. The design model fixed that in its own commit (44bdcbd), outside this task. Then `make gate` printed `gate: ok`, 936 tests. | Ornith-1.5-35B-A3B (the session); design model (the commit) |
| M5a/16-macos-gate | 2026-09-24 | stopped | 1 | fail | none | Created `.cargo/config.toml` (TMPDIR=/tmp for every process Cargo runs, tests included), copied the new `crates/toolkit/tests/shell.rs` from `docs/plans/M5a/files/`, and made the three edits to `read_checked` in `crates/gatewayd/src/secrets.rs`: the comment `"/proc/self"` -> `user_id()`, the three `/proc/self` lines -> `let owner = user_id()?;`, and the `user_id()` function (the uid of a freshly-made pipe) inserted above `value`. `cargo fmt --all`; `cargo test -p gatewayd -p toolkit -p brokerd` every suite passes. `make gate` never reaches the tests: it fails to compile `memoryd` on clippy `collapsible_match` at `crates/memoryd/src/index.rs:224` (the `LogRecord::User { time, content }` arm's nested `if !content.trim().is_empty()` guard), a crate this task does not touch and a file it does not list. Verified pre-existing and unrelated by stashing all my changes and re-running `make gate`: identical `memoryd` failure on the original committed code, so the gate does not compile `memoryd` with or without this task. Did not edit `memoryd` (outside this task's scope, AGENTS.md "do that task and nothing else"); committing only this log row per AGENTS.md point 4. | Ornith-1.5-35B-A3B | | M5a/16-macos-gate | 2026-09-24 | stopped | 1 | fail | none | Created `.cargo/config.toml` (TMPDIR=/tmp for every process Cargo runs, tests included), copied the new `crates/toolkit/tests/shell.rs` from `docs/plans/M5a/files/`, and made the three edits to `read_checked` in `crates/gatewayd/src/secrets.rs`: the comment `"/proc/self"` -> `user_id()`, the three `/proc/self` lines -> `let owner = user_id()?;`, and the `user_id()` function (the uid of a freshly-made pipe) inserted above `value`. `cargo fmt --all`; `cargo test -p gatewayd -p toolkit -p brokerd` every suite passes. `make gate` never reaches the tests: it fails to compile `memoryd` on clippy `collapsible_match` at `crates/memoryd/src/index.rs:224` (the `LogRecord::User { time, content }` arm's nested `if !content.trim().is_empty()` guard), a crate this task does not touch and a file it does not list. Verified pre-existing and unrelated by stashing all my changes and re-running `make gate`: identical `memoryd` failure on the original committed code, so the gate does not compile `memoryd` with or without this task. Did not edit `memoryd` (outside this task's scope, AGENTS.md "do that task and nothing else"); committing only this log row per AGENTS.md point 4. | Ornith-1.5-35B-A3B |
| M5a/15-soul-and-device | 2026-09-24 | done (by the design model) | 1 | pass | none | Finished by the design model from the session's work, which was right and left uncommitted. The stop was not the server: `tools/run-plan.sh` and the device tests both read `BOXMAKER_MODEL`. The run set it to OpenCode's id `straylight/ornith-1.5-35b-a3b`, which the device tests then sent to `llama-server` as the model name, and it answered 400. With it unset, `make verify-device` passed 6 of 6 (72.7 s). The three copied files are identical to the plan's; `make gate` prints `gate: ok`, 936 tests. | Ornith-1.5-35B-A3B (the session); design model (the commit) | | M5a/15-soul-and-device | 2026-09-24 | done (by the design model) | 1 | pass | none | Finished by the design model from the session's work, which was right and left uncommitted. The stop was not the server: `tools/run-plan.sh` and the device tests both read `BOXMAKER_MODEL`. The run set it to OpenCode's id `straylight/ornith-1.5-35b-a3b`, which the device tests then sent to `llama-server` as the model name, and it answered 400. With it unset, `make verify-device` passed 6 of 6 (72.7 s). The three copied files are identical to the plan's; `make gate` prints `gate: ok`, 936 tests. | Ornith-1.5-35B-A3B (the session); design model (the commit) |