Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- **Startup version banner.** The first log line now reports peat-node's own
version plus the resolved versions of the core dependency stack —
`peat-mesh`, `peat-protocol`, `peat-schema` (captured from `Cargo.lock` at
build time). Lets an operator confirm exactly which build + mesh/protocol RC
a container is running from the top of the logs.
- **`--print-config` / `PEAT_NODE_PRINT_CONFIG`.** Opt-in flag that logs the
full resolved configuration at startup (shared key + encryption key redacted)
— for diagnosing env/flag/Compose wiring.

### Changed

- **Attachment transaction logging now describes the file, both sides.**
- Receive side: the inbox sink logs at info with the `filename`, `bytes`,
`blob_hash`, and target path — not just the distribution id — and performs
a **post-write size validation** (the on-disk copy must match the declared
`blob_size` before the tmp→target rename is published). On mismatch it drops
the partial and returns an error so the receive watcher retries, rather than
publishing a short file. (Content integrity is already guaranteed upstream
by iroh's content-addressed fetch; this is the local-write completeness
check.)
- Send side: the outbox watcher's auto-distribute log now includes `bytes`
and the `sha256` alongside the filename and distribution id.

## [0.4.7] - 2026-06-19

### Changed
Expand Down
36 changes: 36 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
use std::fs;

/// Extract a dependency's resolved version from `Cargo.lock` so peat-node can
/// log its dependency stack at startup. Returns "unknown" if not found.
fn locked_version(lock: &str, crate_name: &str) -> String {
let needle = format!("name = \"{crate_name}\"");
if let Some(idx) = lock.find(&needle) {
// Within a `[[package]]` block the `version = "..."` line follows the
// `name = "..."` line, so the first one after the match is ours.
if let Some(line) = lock[idx..]
.lines()
.find(|l| l.trim_start().starts_with("version = "))
{
if let Some(v) = line.split('"').nth(1) {
return v.to_string();
}
}
}
"unknown".to_string()
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
connectrpc_build::Config::new()
.files(&["proto/sidecar.proto"])
.includes(&["proto/"])
.include_file("_connectrpc.rs")
.compile()?;

// Surface the resolved versions of the core dependency stack as
// compile-time env vars so peat-node can print them in its startup banner.
let lock = fs::read_to_string("Cargo.lock").unwrap_or_default();
for (crate_name, env_var) in [
("peat-mesh", "PEAT_MESH_VERSION"),
("peat-protocol", "PEAT_PROTOCOL_VERSION"),
("peat-schema", "PEAT_SCHEMA_VERSION"),
] {
println!(
"cargo:rustc-env={env_var}={}",
locked_version(&lock, crate_name)
);
}

println!("cargo:rerun-if-changed=proto/sidecar.proto");
println!("cargo:rerun-if-changed=Cargo.lock");
Ok(())
}
Loading
Loading