Cleanup pass: one home for duplicated logic, stale comments out
Nothing behavioral except two status codes; mostly removing places where the same rule was written down more than once and could drift. - server/src/private.rs: the owner-only create/write helpers, which config.rs, certs.rs, and the session dirs each had their own copy of (certs.rs even duplicated the explanatory comment). One module owns the modes now, so the "nothing this server writes is readable by anyone else" property is checkable in one place. - server/src/media.rs: the image media-type/extension table, which the four places that have to agree on it each spelled out separately -- storing an upload, serving it back, building a content block, saving a produced image. The differing *defaults* stay at the call sites with the reasoning, since they genuinely differ by direction. - routes.rs: a missing file was a 400 and an unreadable one a 400 with a hand-rolled log line; they are now 404 and Internal respectively. UnknownSession became NotFound, since it was the only 404-with-message. - main.rs: xdg_dir takes the variable's value instead of reading the environment, which drops the unsafe set_var from its test and lets the test actually assert the relative-path rule. - echo.rs had its own 4-byte hex generator beside session::random_hex. - claude.rs: the two impl Translator blocks were one type's methods. - Stale comments: phase-2 markers on shipped work, a permission-mode list that had drifted from the CLI's, "dev-updater" as the leaf certificate's fallback common name, a half-written sentence in build-apk.sh. - App: the JSONArray walk written out in four fetchers, the four near-identical BackHandlers in AppRoot, and SessionScreen's inline fully-qualified names where the file otherwise imports. - server/wg-test.log was committed by accident; *.log is ignored now, and the gitignore comments describe where state actually lives. - PLAN.md's backend layout gains the new modules and drops hosts.rs for the ssh.rs that was built instead. Verified: 35 server tests, clippy clean, app compiles warning-free, and a scratch server driven over curl -- attachment upload/serve round-trip with both a known and an unknown content type, the new 404s, transcript and session-dir deletion, plus a real claude-cli session answering a prompt. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xn8nHw1tw1R6PtiY1eEtw
This commit is contained in:
1 parent
d4a4ee7808
commit
99bcc341c1
18 files changed
+295
-241
No files matched your search
@@ -95,9 +95,24 @@ clap, tracing. Rust edition 2024, warning-clean, clippy in CI habit.
|
||||
- `session/transcript.rs` — append-only JSONL event log per session, with
|
||||
monotonically increasing sequence numbers (the phone's resume cursor).
|
||||
- `llama.rs` — `LlamaServerManager`.
|
||||
- `hosts.rs` — host configs and the ssh command builder.
|
||||
- `ssh.rs` — the ssh command builder (host configs ended up in `config.rs`
|
||||
with the rest of the schema, so this module is only the wrapping; named
|
||||
for what it does rather than `hosts.rs` as first sketched).
|
||||
- `usage.rs` — Anthropic usage polling.
|
||||
- `config.rs` — persisted schema.
|
||||
- `certs.rs` — the TLS certificates, generated in process on first start
|
||||
(added 2026-08-25, replacing a `gen-dev-cert.sh` that shelled out to
|
||||
openssl).
|
||||
- `private.rs` — creating files and directories owner-only. One module
|
||||
owns the modes so "nothing this server writes is readable by anyone
|
||||
else" is checkable in one place instead of re-argued at each `create`
|
||||
(added 2026-08-25; config, certs, and session dirs had three copies).
|
||||
- `media.rs` — the image media-type/extension table, shared by the four
|
||||
places that have to agree on it: storing an upload, serving it back,
|
||||
handing one to a driver's dialect, and saving one a tool produced.
|
||||
|
||||
`session/pi.rs` and `llama.rs` are phase 4 and not built yet; everything
|
||||
else above exists.
|
||||
|
||||
### The common event model
|
||||
|
||||
|
||||
Reference in new issue
Block a user