Skip to content

moonpool-journal: a read-only peek at the caller's metadata that runs no recovery #303

Closed

Description

@PierreZ

Downstream: PierreZ/paros#176, PierreZ/paros#246 (the machine lifecycle simulated as shipped). References: moonpool 9ed1360, paros f2b2502.

Downstream evidence. paros keeps its format marker (the proof that an identity has made promises, PierreZ/paros#147) in the journal's two-copy metadata. Two places need to know whether a store is formatted without booting it:

  • the simulation's provisioning resolution after an interrupted format (crates/paros-sim/src/process.rs:1122-1156, resolve_provisioning);
  • parosd's store opener, which records every created journal whose store carries a marker (crates/parosd/src/stores.rs:106-152, resolve_created).

Both have to run a full boot_scan: Journal::open plus a replay of the whole log, just to read meta(). open is not read-only: it repairs headers and slots, rewrites a stale metadata copy, zeroes past the end, and with AmbiguousTail::Truncate cuts the last batch (crates/moonpool-journal/src/journal.rs:187-293). A probe that was meant to look can change what the real boot finds, and JournalAtlas::scan exists for exactly this reason on the fault-injection side ("without opening it and so without repairing anything", journal_atlas.rs).

Smallest API.

impl<P: StorageProvider> Journal<P> {
    /// The caller's metadata as the newest valid copy holds it, without
    /// opening the journal: no repair, no truncation, no replay.
    pub async fn peek_meta(provider: &P, dir: &str) -> Result<Option<Vec<u8>>, JournalError>;
}

DualFile::load already does the read; the change is a path that skips the repair of the stale twin and reports MetadataCorrupt when both copies are bad, None when neither exists.

Determinism. Read-only, no draws.

Acceptance (crates/moonpool-journal/tests/journal.rs): after save_meta, peek_meta returns the value; with one copy damaged it still does and the damaged copy is unchanged afterwards (the next open reports meta_repaired); with both damaged, MetadataCorrupt; on an empty directory, None, and the directory is still empty.

Activity

  1. added 2 commits that reference this issue on Oct 6, 2026
    05c7c7c
    8b92140
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions