fix(ws-bridged): CLI flags + yaml.example schema + parser drift-detection - #5
Merged
Conversation
… to DaemonConfig
`run()` mergte bisher nur `--listen`, `--domain` und `--log-level` aus
den geparsten `CliArgs` in die `DaemonConfig`. Die anderen Flags
(`--topic`, `--auth-token`, `--tls-cert`, `--tls-key`, `--metrics`)
wurden in `cli::parse()` korrekt extrahiert, aber nie auf `cfg`
übertragen. Resultat: ein Start wie
zerodds-ws-bridged --listen 0.0.0.0:8080 --domain 42 \
--topic Card --topic Thread --auth-token shared-secret
loggte `topics=0 auth-mode=none tls=off metrics=off` trotz CLI-Flags.
Spec §2 sagt "CLI überschreibt File-Werte" — galt nur partiell.
Changes:
- apply_cli_overrides(cfg, args) als testbare Funktion extrahiert.
- --topic ist additiv (an cfg.topics angehängt) mit
default_ws_path-Mapping und type_name == name als Default;
direction = "bidir" (Spec-Default §5).
- --auth-token impliziert auth_mode = "bearer".
- --tls-cert / --tls-key impliziert tls_enabled = true.
- --metrics impliziert metrics_enabled = true.
- 8 Unit-Tests im bin-Crate decken jede Flag-Familie ab plus
empty-args-leaves-config-unchanged als Regression-Wächter.
Spec-Bezug: docs/specs/zerodds-ws-bridge-1.0.md §2 (CLI-Surface), §5
(Topic-Mapping), §7.1 (TLS), §7.2 (Auth), §8.2 (Metrics).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…oadback test
Die ausgelieferte packaging/linux/configs/ws-bridged.yaml.example hatte
historisch verschachtelte Top-Level-Keys (participant.domain_id,
websocket.bind, routes:, observability.metrics_bind). Der echte Parser
in daemon/config.rs::load_from_str erwartet aber flache Keys: listen,
domain, log_level, tls, auth, acl, metrics, topics.
Weil unbekannte Keys mit `_ => {}` stillschweigend ignoriert wurden,
fiel die Drift nie auf — die Bridge bootete einfach mit Defaults
(127.0.0.1:8080, domain=0, topics=0) trotz user-konfigurierter Werte.
Changes:
- example-yaml umgeschrieben gegen Parser-Schema + Spec §3.
- Spec-§-Ref von §4 (Wire-Protocol) auf §3 (Config-File-Format)
korrigiert.
- Kommentar dokumentiert auth-Modi, ACL-Pflicht bei non-none-Auth, und
WARN-Verhalten bei unbekannten Keys als Drift-Watchpoint.
- Loadback-Integration-Test (tests/example_yaml_loadback.rs):
include_str!() bindet die ausgelieferte yaml.example zur Compile-Zeit
ein und fährt sie durch DaemonConfig::load_from_str. Schlägt
künftige Doku-Drift sofort als Test-Fail auf, nicht erst im Feld.
Spec-Bezug: docs/specs/zerodds-ws-bridge-1.0.md §3 (Config-File-Format).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DaemonConfig::load_from_str() ignorierte bisher unbekannte Top-Level-Keys
stillschweigend (`_ => {}`). Das war die Wurzel-Ursache dafür, dass die
veraltete ws-bridged.yaml.example (mit participant:/websocket:/routes:/
observability: statt listen:/domain:/tls:/auth:/metrics:/topics:) nie
als Fehlkonfig auffiel — Bridge bootete einfach mit Defaults.
Changes:
- Unbekannte Top-Level-Keys werden weiterhin nicht als ConfigError
abgelehnt (Forward-Compatibility), aber per stderr eine WARN-Zeile
geloggt mit Hinweis auf erwartete Keys und Spec-Ref §3.
- Unit-Test (unknown_top_level_keys_do_not_fail_parse) friert die
Forward-Compat-Semantik ein: falls jemand künftig auf strict-reject
umschwenkt, bricht der Test absichtlich und zwingt zu einer
Migration-Entscheidung.
Beispiel-Output bei Tippfehler oder altem Schema:
[zerodds-ws-bridged config] WARN: unknown top-level key "participant"
ignored (typo or schema drift? expected one of: listen, domain,
log_level, tls, auth, acl, metrics, topics — see
docs/specs/zerodds-ws-bridge-1.0.md §3)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 15, 2026
This was referenced May 15, 2026
SandraK82
added a commit
that referenced
this pull request
May 15, 2026
Workspace-wide version bump from 1.0.0-rc.1 to 1.0.0-rc.2. The workspace uses `version.workspace = true` across all crates, so this single root Cargo.toml change carries to all ~94 crates and the regenerated Cargo.lock. Trigger: two ws-bridge bugs blocked zeroCollab Wave 2b adoption. Both fixes plus two follow-ups landed via PR #5 (squash-merged as 0133110, GitHub issues #1 and #3 closed): - fix(ws-bridged): apply --topic/--auth-token/--tls/--metrics CLI flags to DaemonConfig (was: only --listen/--domain/--log-level took effect) - fix(ws-bridged): rewrite ws-bridged.yaml.example against the flat parser schema (was: nested participant:/websocket:/routes:/ observability: keys silently ignored, bridge booted with defaults) - test: include_str! loadback test catches future yaml-example drift - feat(ws-bridged): WARN-log unknown top-level config keys instead of silently ignoring Preflight on this commit: cargo fmt --all --check clean, cargo clippy --workspace --all-targets --features daemon -- -D warnings clean, cargo test --workspace --features daemon green (~2230 tests including the cross-language ts-binding suite). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #2 and #4 — bundles both bug fixes plus two follow-ups into one branch with a green internal GitLab pipeline (1064, all 13/13 jobs).
Closes #1, closes #3.
Three commits
1.
fix(ws-bridged): apply --topic/--auth-token/--tls/--metrics CLI-Flags to DaemonConfigEquivalent to #2.
run()only merged--listen/--domain/--log-level; all other parsed CLI flags were silently dropped. Extractedapply_cli_overrides(cfg, args)with replace-semantics for scalars and additive semantics for--topic(defaultdirection=bidir,type_name=name,ws_path=default_ws_path(name)). 8 unit tests cover every flag family plus an empty-args regression guard.2.
fix(ws-bridged): align ws-bridged.yaml.example with parser schema + loadback testEquivalent to #4 plus the loadback test follow-up. Old example used nested
participant:/websocket:/routes:/observability:sections that the parser silently ignored — bridge booted with defaults. Rewritten against the flat schema (listen/domain/log_level/tls/auth/acl/metrics/topics). Spec ref corrected from §4 (wire-protocol) to §3 (config-file-format).New:
tests/example_yaml_loadback.rsembeds the shipped yaml.example viainclude_str!and runs it throughDaemonConfig::load_from_str, asserting each key field. Future doc-drift fails the test instead of booting with defaults in production.3.
feat(ws-bridged): WARN-log unknown top-level config keysThe Follow-up announced in #4.
load_from_strno longer silently ignores unknown top-level keys; they pass through (forward-compat) but emit a stderr WARN naming the expected keys and pointing at spec §3. Unit test freezes the forward-compat semantics so any future switch to strict-reject breaks deliberately.Example output on the old broken yaml:
```
[zerodds-ws-bridged config] WARN: unknown top-level key "participant" ignored
(typo or schema drift? expected one of: listen, domain, log_level, tls,
auth, acl, metrics, topics — see docs/specs/zerodds-ws-bridge-1.0.md §3)
```
Test plan
cargo fmt -p zerodds-websocket-bridge --checkcleancargo clippy -p zerodds-websocket-bridge --features daemon --all-targets -- -D warningscleancargo test -p zerodds-websocket-bridge --features daemon— 227 green (200 lib + 8 bin + 6 daemon_e2e + 2 loadback + 4 fuzz_smoke + 6 security_e2e + 1 doc)DCO: Signed-off-by enthalten in allen drei Commits.