ADR-001-Hybrid-Transport-Layer
ADR 001: Hybrid Transport Layer (API with FS Fallback)
Date: 2026-03-31
Status: Accepted
Context:
The core ethos of pour is killing friction. Relying solely on the Obsidian Local REST API means data entry fails if the Obsidian Electron client is closed. Relying solely on the filesystem means missing out on advanced API features when the vault is open.
Decision:
Implement a dual-pronged Transport dispatcher.
- Attempt an HTTP connection to the Local REST API first using reqwest with a 5-second timeout.
- If the connection is refused, automatically fall back to direct filesystem writes via
std::fs.
Consequences:
- Positive: Maximum resilience. The user never loses a log entry due to application state.
- Negative: Feature asymmetry. The API backend returns raw filenames (for example,
latte.md) while the FS backend returns file stems (latte). This requires normalization in The-3-Tier-Data-Fallback.
Note (2026-10-02): The fallback is wider and narrower than step 2 says. Transport::connect falls back to the filesystem whenever api_port or api_key is unset, the client fails to build, or the connection check fails, not only on a refused connection. Since v1.1.0, a module with its own base_path always writes over the filesystem (Transport::for_module), because the Local REST API can only reach the vault it serves. And in update mode, a backend that cannot serve the frontmatter PATCH returns Unsupported, and write_update retries that write over the filesystem.
See also System-Architecture-Overview, pour-design-spec, and v0.1.0-report (sprint 2).