test(cli): move tests/ out of tools/, separate marmot vs dm
`tools/` is for libraries (arti-build); shell-based interop harnesses
that drive the `amy` binary belong with the CLI module. New layout:
cli/tests/
├── lib.sh # shared logging + result tracking
├── headless/helpers.sh # shared amy_a / amy_json / assertions
├── marmot/ # MLS group-messaging interop (vs whitenoise-rs)
│ ├── marmot-interop.sh
│ ├── marmot-interop-headless.sh
│ ├── setup.sh
│ ├── tests-create.sh
│ ├── tests-manage.sh
│ ├── tests-extras.sh
│ └── patches/
└── dm/ # NIP-17 DM interop (amy ↔ amy)
├── dm-interop-headless.sh
├── setup.sh
└── tests-dm.sh
Per-suite changes:
- Each suite owns its own setup.sh; previously the Marmot setup was at
headless/setup.sh and the DM setup at headless/setup-dm.sh, which
implied shared infra they don't actually share.
- `cli/tests/lib.sh` and `cli/tests/headless/helpers.sh` are the only
shared bits across suites.
- The DM harness still reuses Marmot's `start_local_relay` /
`stop_local_relay` (sourced via `../marmot/setup.sh`) — same relay
binary, no duplication.
- All sourcing paths updated; REPO_ROOT now climbs three levels (was
two when the harness lived under `tools/`); patches/ is now a sibling
of marmot/setup.sh rather than under marmot/headless/.
- `.gitignore` updated to cover both suites' state dirs.
cli/ROADMAP.md and cli/tests/README.md updated to point at the new paths.
No behavioural change — every test runs the same code; only the file
layout and source paths moved.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
--- a/src/whitenoise/relays.rs
|
||||
+++ b/src/whitenoise/relays.rs
|
||||
@@ -98,6 +98,21 @@
|
||||
}
|
||||
|
||||
pub(crate) fn defaults() -> Vec<Relay> {
|
||||
+ // marmot-interop-headless patch: honour $WHITENOISE_DISCOVERY_RELAYS
|
||||
+ // (comma-separated list) when present so newly created accounts only
|
||||
+ // ever get our loopback relay baked into their NIP-65 / inbox /
|
||||
+ // key-package lists. Without this override, `create-identity` stamps
|
||||
+ // the hard-coded public set into the account's relay lists, and every
|
||||
+ // later activate / publish burns connection budget on unreachable
|
||||
+ // sockets — enough to break inbox-plane activation and drop kind:1059.
|
||||
+ if let Ok(from_env) = std::env::var("WHITENOISE_DISCOVERY_RELAYS") {
|
||||
+ let parsed: Vec<Relay> = from_env
|
||||
+ .split(',').map(str::trim).filter(|s| !s.is_empty())
|
||||
+ .filter_map(|u| RelayUrl::parse(u).ok())
|
||||
+ .map(|url| Relay::new(&url))
|
||||
+ .collect();
|
||||
+ if !parsed.is_empty() { return parsed; }
|
||||
+ }
|
||||
let urls: &[&str] = if cfg!(debug_assertions) {
|
||||
&["ws://localhost:8080", "ws://localhost:7777"]
|
||||
} else {
|
||||
@@ -0,0 +1,23 @@
|
||||
--- a/src/relay_control/discovery.rs
|
||||
+++ b/src/relay_control/discovery.rs
|
||||
@@ -87,6 +87,20 @@
|
||||
|
||||
/// Initial curated relay set from the planning doc.
|
||||
pub(crate) fn curated_default_relays() -> Vec<RelayUrl> {
|
||||
+ // marmot-interop-headless patch: honour $WHITENOISE_DISCOVERY_RELAYS
|
||||
+ // (comma-separated list) when present, so the harness can force wnd
|
||||
+ // to use a loopback relay instead of the baked-in public set.
|
||||
+ if let Ok(from_env) = std::env::var("WHITENOISE_DISCOVERY_RELAYS") {
|
||||
+ let parsed: Vec<RelayUrl> = from_env
|
||||
+ .split(',')
|
||||
+ .map(str::trim)
|
||||
+ .filter(|s| !s.is_empty())
|
||||
+ .filter_map(|u| RelayUrl::parse(u).ok())
|
||||
+ .collect();
|
||||
+ if !parsed.is_empty() {
|
||||
+ return parsed;
|
||||
+ }
|
||||
+ }
|
||||
[
|
||||
"wss://index.hzrd149.com",
|
||||
"wss://indexer.coracle.social",
|
||||
@@ -0,0 +1,18 @@
|
||||
--- a/src/bin/wnd.rs
|
||||
+++ b/src/bin/wnd.rs
|
||||
@@ -22,6 +22,15 @@
|
||||
let args = Args::parse();
|
||||
let config = Config::resolve(args.data_dir.as_ref(), args.logs_dir.as_ref());
|
||||
|
||||
+ // marmot-interop-headless patch: allow sandboxes/CI without a real
|
||||
+ // kernel keyring to fall back to the integration-tests mock keyring
|
||||
+ // by setting $WHITENOISE_MOCK_KEYRING=1. Requires the daemon to be
|
||||
+ // built with --features cli,integration-tests. No effect otherwise.
|
||||
+ #[cfg(feature = "integration-tests")]
|
||||
+ if std::env::var("WHITENOISE_MOCK_KEYRING").is_ok() {
|
||||
+ Whitenoise::initialize_mock_keyring_store();
|
||||
+ }
|
||||
+
|
||||
let wn_config = WhitenoiseConfig::new(&config.data_dir, &config.logs_dir, KEYRING_SERVICE_ID);
|
||||
Whitenoise::initialize_whitenoise(wn_config).await?;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
--- a/src/whitenoise/event_processor/account_event_processor.rs
|
||||
+++ b/src/whitenoise/event_processor/account_event_processor.rs
|
||||
@@ -178,7 +178,22 @@
|
||||
}
|
||||
Err(e) => {
|
||||
// Handle retry logic for actual processing errors
|
||||
- if retry_info.should_retry() {
|
||||
+ // marmot-interop-headless patch: MLS errors that come from
|
||||
+ // mdk are ALREADY terminal — mdk doesn't retry internally, so
|
||||
+ // any Err it returns (Unprocessable, PreviouslyFailed, decrypt
|
||||
+ // failure, group-not-found, etc.) is provably permanent.
|
||||
+ // Retrying those 10 times with exponential backoff (total
|
||||
+ // ~17 min) just blocks later decryptable commits behind a
|
||||
+ // queue of doomed retries, so every later join / rename /
|
||||
+ // leave propagation races the test timeout. Treat them all
|
||||
+ // as one-shot: log once, move on.
|
||||
+ let is_terminal = matches!(
|
||||
+ e,
|
||||
+ WhitenoiseError::MlsMessageUnprocessable(_)
|
||||
+ | WhitenoiseError::MlsMessagePreviouslyFailed
|
||||
+ | WhitenoiseError::MdkCoreError(_),
|
||||
+ );
|
||||
+ if !is_terminal && retry_info.should_retry() {
|
||||
self.schedule_retry(event, source, retry_info, e);
|
||||
} else {
|
||||
tracing::error!(
|
||||
Reference in New Issue
Block a user