The journal sink every consumer installs, following the service mode ([`crate::service`]): local journals through libatomic's [`DirectJournalSink`] — the same in-process core the transport's own dispatch handler uses; reactor journals over the daemon's ProvenanceService (D4 start-or-retry). When even the chosen backend cannot open, a [`RefusedJournalSink`] makes the failure loud — the orchestrator
(root: &Path)
| 117 | /// orchestrator fails the turn with the reason instead of silently |
| 118 | /// dropping provenance. |
| 119 | pub(crate) fn sink_for(root: &Path) -> Arc<dyn ProvenanceJournalSink> { |
| 120 | // A remote sandbox journals into the repository that serves it, over |
| 121 | // whatever serves the daemon socket, with its grant's token — whatever |
| 122 | // the service mode says, and never by starting a daemon or resolving a |
| 123 | // path the server does not have. |
| 124 | if let Some((_, pointer)) = atomic_repository::find_remote_sandbox(root) { |
| 125 | return match crate::remote_sandbox::reference(&pointer) { |
| 126 | Ok(reference) => { |
| 127 | let _ = SANDBOX_TOKEN.set(pointer.token.into_bytes()); |
| 128 | Arc::new(ProvenanceRpcSink { reference }) |
| 129 | } |
| 130 | Err(reason) => Arc::new(RefusedJournalSink { reason }), |
| 131 | }; |
| 132 | } |
| 133 | match crate::service::mode() { |
| 134 | // The direct service accepts the canonical repository root. A local |
| 135 | // sandbox or linked worktree owns its working-copy directory, but its |
| 136 | // journal remains in the common database. Resolve the caller here; |
| 137 | // do not create a second database or change the service's lock policy. |
| 138 | crate::service::Mode::Local => match (|| { |
| 139 | let dot = atomic_repository::Repository::canonical_dot_dir(root) |
| 140 | .map_err(|error| error.to_string())?; |
| 141 | let canonical = dot |
| 142 | .parent() |
| 143 | .ok_or_else(|| "canonical repository has no parent directory".to_string())?; |
| 144 | DirectJournalSink::open(canonical) |
| 145 | })() { |
| 146 | Ok(sink) => Arc::new(sink), |
| 147 | Err(reason) => Arc::new(RefusedJournalSink::local(reason)), |
| 148 | }, |
| 149 | crate::service::Mode::Reactor => match ProvenanceRpcSink::open(root) { |
| 150 | Some(sink) => Arc::new(sink), |
| 151 | None => Arc::new(RefusedJournalSink::reactor()), |
| 152 | }, |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | /// The no-backend sink: every operation refuses with the reason the chosen |
| 157 | /// backend could not provide a journal. Never silently drops provenance — |