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
1 change: 1 addition & 0 deletions pkgs/id/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkgs/id/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ iroh = { version = "1", features = ["test-utils"] }
toml = "1"
# Local mainline DHT testnet for tests/dht_testnet.rs (P7.3). Dev only; already in the lock via the `dht` feature.
n0-mainline = "0.7"
# The lookup under test in tests/dht_testnet.rs (P7.3); the root package
# only names it for that test, so it is a dev-dependency.
iroh-mainline-address-lookup = "0.6"
# XSalsa20-Poly1305 for the Keybase V2 vector's pkey box (P6.1 known-answer test). Dev only; not in the lock before P6.1.
crypto_secretbox = "0.1"
# Reads the vector's msgpack byte strings (P6.1 known-answer test). Dev only; already in the lock.
Expand Down
46 changes: 23 additions & 23 deletions pkgs/id/WEB.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,31 +236,31 @@ Three DaisyUI terminal-inspired themes with `#000000` black backgrounds. Switch

## API Routes

| Route | Method | Description |
| --------------------- | ------ | ----------------------------------- |
| `/` | GET | File browser (main page) |
| `/peers` | GET | Discovered peers (auto-refreshes) |
| `/settings` | GET | Settings page |
| `/edit/{hash}` | GET | Editor/viewer for file by hash |
| `/file/{name}` | GET | Editor/viewer for file by name |
| `/blob/{hash}` | GET | Raw blob content with Content-Type |
| `/api/files` | GET | File list (HTML partial) |
| `/api/save` | POST | Save file content |
| `/api/new` | POST | Create new file |
| `/api/rename` | POST | Rename file (with optional archive) |
| `/api/copy` | POST | Copy file to new name |
| Route | Method | Description |
| --------------------- | ------ | --------------------------------------------------------- |
| `/` | GET | File browser (main page) |
| `/peers` | GET | Discovered peers (auto-refreshes) |
| `/settings` | GET | Settings page |
| `/edit/{hash}` | GET | Editor/viewer for file by hash |
| `/file/{name}` | GET | Editor/viewer for file by name |
| `/blob/{hash}` | GET | Raw blob content with Content-Type |
| `/api/files` | GET | File list (HTML partial) |
| `/api/save` | POST | Save file content |
| `/api/new` | POST | Create new file |
| `/api/rename` | POST | Rename file (with optional archive) |
| `/api/copy` | POST | Copy file to new name |
| `/api/files/send` | POST | Send file to another server (server-side transfer, #5346) |
| `/api/download` | POST | Download file content |
| `/api/delete` | POST | Soft-delete file |
| `/api/download` | POST | Download file content |
| `/api/delete` | POST | Soft-delete file |
| `/api/restore` | POST | Restore deleted file (404 if missing, 409 if not deleted) |
| `/api/hard-delete` | POST | Permanently delete file |
| `/api/tags` | GET | Get tags for a file |
| `/api/tags` | POST | Set a tag |
| `/api/tags` | DELETE | Delete a tag |
| `/api/tags/search` | GET | Search tags |
| `/ws/collab/{doc_id}` | WS | Collaboration WebSocket |
| `/ws/tags` | WS | Tag change broadcast |
| `/assets/*` | GET | Static assets |
| `/api/hard-delete` | POST | Permanently delete file |
| `/api/tags` | GET | Get tags for a file |
| `/api/tags` | POST | Set a tag |
| `/api/tags` | DELETE | Delete a tag |
| `/api/tags/search` | GET | Search tags |
| `/ws/collab/{doc_id}` | WS | Collaboration WebSocket |
| `/ws/tags` | WS | Tag change broadcast |
| `/assets/*` | GET | Static assets |

## Configuration

Expand Down
3 changes: 1 addition & 2 deletions pkgs/id/benches/world_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,8 +915,7 @@ fn write_results_jsonl(cells: &[MatrixCell], quick: bool) -> Result<()> {
let git_sha = std::env::var("ID_BENCH_GIT_SHA")
.or_else(|_| std::env::var("GITHUB_SHA"))
.unwrap_or_else(|_| "unknown".to_owned());
let toolchain =
std::env::var("ID_BENCH_TOOLCHAIN").unwrap_or_else(|_| "unknown".to_owned());
let toolchain = std::env::var("ID_BENCH_TOOLCHAIN").unwrap_or_else(|_| "unknown".to_owned());
let build_profile = if cfg!(debug_assertions) {
"debug"
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/id/crates/id-caps/src/library_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ fn names_of(excess: &[ExcessEntry]) -> String {
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod tests {
use super::*;
use crate::library_manifest::PlatformRequirement;
Expand Down
1 change: 1 addition & 0 deletions pkgs/id/crates/id-caps/src/library_resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ impl Walk<'_> {
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod tests {
use super::*;
use crate::library_manifest::{BuildMode, LibraryKind};
Expand Down
2 changes: 1 addition & 1 deletion pkgs/id/crates/id-caps/tests/roc_import_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! matrix (missing module, wrong signature) are the `roc-cap-demo`
//! tests, already wired through `roc-test.sh`; this suite covers the
//! gate-level rows.
#![allow(clippy::unwrap_used, clippy::expect_used)]
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]

use std::collections::{BTreeSet, HashMap};
use std::path::PathBuf;
Expand Down
1 change: 0 additions & 1 deletion pkgs/id/crates/id-cli/src/commands/put.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ use crate::{
parse_stdin_items, read_input,
};


/// Trim a name typed at the forgiving CLI surface before FileOps sees it.
///
/// FileOps stores names verbatim and refuses padding (#4102 / design #4766
Expand Down
18 changes: 15 additions & 3 deletions pkgs/id/crates/id-core/src/canonical_cbor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,21 +216,33 @@ impl<'a> Reader<'a> {
Ok(value)
}
25 => {
let value = u16::from_be_bytes(self.take(2)?.try_into().unwrap()) as u64;
let value = u16::from_be_bytes(
self.take(2)?
.try_into()
.map_err(|_| CborError::UnexpectedEof)?,
) as u64;
if value <= u8::MAX as u64 {
return Err(CborError::NonShortestForm);
}
Ok(value)
}
26 => {
let value = u32::from_be_bytes(self.take(4)?.try_into().unwrap()) as u64;
let value = u32::from_be_bytes(
self.take(4)?
.try_into()
.map_err(|_| CborError::UnexpectedEof)?,
) as u64;
if value <= u16::MAX as u64 {
return Err(CborError::NonShortestForm);
}
Ok(value)
}
27 => {
let value = u64::from_be_bytes(self.take(8)?.try_into().unwrap());
let value = u64::from_be_bytes(
self.take(8)?
.try_into()
.map_err(|_| CborError::UnexpectedEof)?,
);
if value <= u32::MAX as u64 {
return Err(CborError::NonShortestForm);
}
Expand Down
1 change: 1 addition & 0 deletions pkgs/id/crates/id-core/src/intranet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ impl BreakGlass {
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod tests {
use super::*;
use crate::boundary::{
Expand Down
1 change: 1 addition & 0 deletions pkgs/id/crates/id-core/src/ip_evidence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ pub fn judge(
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod tests {
use super::*;
use std::net::Ipv4Addr;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/id/crates/id-core/src/residency_inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ pub fn admit_work_submission(
}

#[cfg(test)]
#[allow(clippy::panic)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod tests {
use super::*;
use crate::residency::{Jurisdiction, Policy};
Expand Down
2 changes: 2 additions & 0 deletions pkgs/id/crates/id-core/tests/array_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
//! until that lands this test includes the module by path — the same file
//! the export will name.

#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]

#[path = "../src/array_address.rs"]
mod array_address;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/id/crates/id-core/tests/probe_petname_load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use id_core::petname::Petnames;

#[test]
#[allow(clippy::unwrap_used)]
#[allow(clippy::unwrap_used, clippy::expect_used)]
fn probe_open_rejects_names_set_would_refuse() {
let dir = std::env::temp_dir().join(format!("petname-probe-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
Expand Down
23 changes: 18 additions & 5 deletions pkgs/id/crates/id-directory/src/directory_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,22 @@ mod tests {
.is_err()
);
assert!(
auth.check_code("user0@x.co", PurposeKind::SignIn, &resent, now() + CODE_RESEND_MS)
.is_ok()
auth.check_code(
"user0@x.co",
PurposeKind::SignIn,
&resent,
now() + CODE_RESEND_MS
)
.is_ok()
);
assert!(
auth.check_code("user0@x.co", PurposeKind::SignIn, &resent, now() + CODE_RESEND_MS)
.is_err()
auth.check_code(
"user0@x.co",
PurposeKind::SignIn,
&resent,
now() + CODE_RESEND_MS
)
.is_err()
);
}

Expand Down Expand Up @@ -894,7 +904,10 @@ mod tests {
)
.unwrap();
assert_eq!(auth.codes.len(), CODE_PENDING_PER_ACCOUNT + 1);
assert!(auth.check_code("other@x.co", PurposeKind::SignIn, &other, now()).is_ok());
assert!(
auth.check_code("other@x.co", PurposeKind::SignIn, &other, now())
.is_ok()
);
// A resend for one of the account's own pending addresses still
// replaces at the per-account cap. (Checking the other account's
// code above consumed it, so the map is back to the account's own
Expand Down
4 changes: 3 additions & 1 deletion pkgs/id/crates/id-native-shell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ tokio = { version = "1", features = ["full"] }
# id-web tests do: id-worlds with the sandbox feature, plus the
# in-memory blob store the fixture recorder expects. Dev-only: none of
# this reaches the shipped shell or the default `id` build.
id-worlds = { path = "../id-worlds", default-features = false, features = ["sandbox"] }
id-worlds = { path = "../id-worlds", default-features = false, features = [
"sandbox",
] }
iroh-blobs = "0.103"

[lints.rust]
Expand Down
4 changes: 3 additions & 1 deletion pkgs/id/crates/id-sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ p2panda-auth = { git = "https://github.com/p2panda/p2panda", rev = "da80c05b9526
"serde",
] }
# The artifact and envelope network tests use id-core silent lookup helpers.
id-core = { path = "../id-core", default-features = false, features = ["test-utils"] }
id-core = { path = "../id-core", default-features = false, features = [
"test-utils",
] }
proptest = "1.12"
tempfile = "3"
tokio = { version = "1", features = ["test-util"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ impl KeyLineage {
if self.find_key(&new_key).is_some() {
return Err(LifecycleError::DuplicateKey);
}
let outgoing = self.generations.last_mut().expect("checked non-empty");
let outgoing = self
.generations
.last_mut()
.ok_or(LifecycleError::NotEnrolled)?;
outgoing.valid_until = Some(at.saturating_add(overlap));
outgoing.superseded_by = Some(outgoing.generation + 1);
let generation = outgoing.generation + 1;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/id/crates/id-sync/src/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ use iroh::{EndpointAddr, endpoint::Endpoint};
use iroh_base::EndpointId;
use iroh_blobs::{Hash, api::Store};

use crate::protocol::META_ALPN;
use crate::meta_client::push_and_name;
use crate::meta_client::{expect_ok, request_over};
use crate::protocol::META_ALPN;
use crate::protocol::{MetaRequest, MetaResponse};

/// What a completed (or already-completed) transfer did.
Expand Down
2 changes: 2 additions & 0 deletions pkgs/id/crates/id-sync/tests/federation_b01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
//! (slice 9110-02), so this test includes the slice file by path;
//! #9110-09 wires versioned public exports later.

#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]

#[path = "../src/federation/slices/b01_key_lifecycle.rs"]
mod b01_key_lifecycle;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/id/crates/id-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ fn finish_router(
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod tests {
use super::*;

Expand Down
4 changes: 3 additions & 1 deletion pkgs/id/crates/id-web/src/markdown/parse_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,9 @@ fn code_span_closes_within_paragraph(bytes: &[u8], from: usize, n: usize) -> boo
}
b'\n' => {
let mut m = k + 1;
while m < bytes.len() && (bytes[m] == b' ' || bytes[m] == b'\t' || bytes[m] == b'\r') {
while m < bytes.len()
&& (bytes[m] == b' ' || bytes[m] == b'\t' || bytes[m] == b'\r')
{
m += 1;
}
if m >= bytes.len() || bytes[m] == b'\n' {
Expand Down
7 changes: 5 additions & 2 deletions pkgs/id/crates/id-web/src/world_ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ impl RecordsRevisionCache {
return revision;
}
let revision = compute(records);
let mut entries = self.entries.lock().unwrap();
let mut entries = self
.entries
.lock()
.unwrap_or_else(|poisoned| poisoned.into_inner());
if let Some((_, cached)) = entries
.iter()
.find(|(snapshot, _)| Arc::ptr_eq(snapshot, records))
Expand All @@ -165,7 +168,7 @@ impl RecordsRevisionCache {
fn cached(&self, records: &Arc<id_worlds::world::Records>) -> Option<u64> {
self.entries
.lock()
.unwrap()
.unwrap_or_else(|poisoned| poisoned.into_inner())
.iter()
.find(|(snapshot, _)| Arc::ptr_eq(snapshot, records))
.map(|(_, revision)| *revision)
Expand Down
1 change: 1 addition & 0 deletions pkgs/id/crates/id-worlds/src/world/handoff_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ fn ops_entry(active: &ActiveHandoff, now_ms: u64) -> HandoffOpsEntry {
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod tests {
use super::*;
use crate::world::{ExportReceipt, ImportReceipt, ObserveOutcome, TransitStage};
Expand Down
1 change: 1 addition & 0 deletions pkgs/id/crates/id-worlds/src/world_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ pub fn validate_lru_bytes(lru_bytes: u64, max_module_bytes: u64) -> Result<()> {
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod tests {
use super::*;

Expand Down
3 changes: 3 additions & 0 deletions pkgs/id/crates/id-worlds/src/world_dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,7 @@ pub async fn run_dev_fuzz(
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod tests {
use super::*;

Expand Down Expand Up @@ -2220,6 +2221,7 @@ mod tests {
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod fuzz_tests {
use super::*;

Expand Down Expand Up @@ -2679,6 +2681,7 @@ mod fuzz_tests {
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod watch_tests {
use super::*;

Expand Down
1 change: 1 addition & 0 deletions pkgs/id/crates/id-worlds/src/world_session/resume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ impl BaselineCache {
}

#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
mod tests {
use super::*;
use crate::world_presentation::{ScreenCell, ScreenSurface};
Expand Down
Loading