Repository navigation
Description
id: design: build-time defaults file — embed network defaults from an optional JSON file instead of only hardcoded consts
Source (raw conversation, verbatim)
From Drew's peer-discovery plan review, OpenCode session ses_2ec427b80ffeuCx6dCuANmiN6c ("Peer discovery plan review"), 2026-03-23:
"add no-gossip. can all the defaults be populated from a json file optional at build so the end result is equivalent hardcoded const? hardcoded -> build defaults file (build flag to replace instead of append -> users can add new values on serve launch (flag to skip defaults no-default-<>)"
Follow-up in the same session, same day, confirming the direction:
"yes no-gossip, built time defaults, and mdns. what is the most efficient way to build a static config file to embed? compile time can't parse this into a const on its own it has to be a string?"
Recovered by the WS-F2 raw-conversation mining pass (2026-11-04). The other two items in that confirmed trio landed: --no-gossip exists in the serve/CLI surface, and mDNS address lookup is wired in the peers command (iroh_mdns_address_lookup). The build-time defaults file did not.
Current state (verified 2026-11-04)
- Network defaults are hardcoded Rust constants — e.g. the discovery topic/secret pair
DEFAULT_TOPIC/DEFAULT_TOPIC_SECRETin the discovery module, consumed as a pair byresolve_config(see id(discovery): resolve_config pairs a CLI topic/secret with the public default for the other half under --no-default-topic #4756 for the cascade and its pairing bug). - Runtime overrides exist per-value for some defaults (CLI
--topic/--topic-secret/--no-default-topic), resolved by a documented cascade. - There is no build-time defaults file: grepping the tree finds no defaults-file mechanism, no
build.rsinpkgs/idorid-core, and no issue designs one (the WS-F2 pass searched the full ID issue universe for it).
What to design
- File format + contents. A JSON file, optional at build time, that can populate the network defaults today spread across constants: discovery topic + secret, relay set, DNS/discovery endpoints, gossip on/off default, and any other hardcoded network default the audit finds. Building with the file must produce a binary whose effective defaults are equivalent to building with the corresponding constants — the file is a source for the same values, not a second semantics.
- Replace vs append. Per Drew's sketch: a build flag chooses whether the file's lists (e.g. relays) replace the built-in lists or append to them. The choice is per-build, recorded, and visible (see 5).
- Embedding mechanics. Answer Drew's literal question — "compile time can't parse this into a const on its own it has to be a string?" Options to evaluate:
include_str!+ lazy parse at first use; abuild.rsthat parses the JSON and emits typed Rust constants (codegen);include!of a generated source file; or a const-format parser. Criteria: compile-time validation of the file (a malformed defaults file should fail the build, not the first run), binary size/startup cost, and how the Nix build supplies the file (flake input /--cfg/ env var — note the crate currently has nobuild.rs, so adding one is itself a decision). - Runtime composition. How build-time defaults compose with the existing runtime cascade: serve-launch flags can still add values on top, and a
--no-default-*style flag can skip the built-in defaults entirely (Drew's "flag to skip defaults"). Precedence must be one documented cascade, consistent withresolve_config's existing steps — and the topic/secret pair must keep resolving as a pair (the id(discovery): resolve_config pairs a CLI topic/secret with the public default for the other half under --no-default-topic #4756 lesson). - Provenance. A built binary should be able to report where its defaults came from (pure constants / defaults file + its hash / replaced vs appended), e.g. in a version/about surface — a distributor shipping a private-network build must be able to prove which defaults are inside it.
Why it matters
Distributors and private deployments (an intranet build with private relays/topics — cf. #5683's intranet mode) currently must patch Rust source to change network defaults. A defaults file makes "same code, different network" a build option instead of a fork, which is exactly the property Drew asked for: end result equivalent to the hardcoded consts, chosen at build time.
Open questions
- Which defaults are in scope for v1 — discovery topic/secret only, or the full network set (relays, DNS, gossip)?
- Replace/append granularity: one build flag for all lists, or per-list keys inside the file?
- Should the file format be the same JSON shape as any runtime config, so one file can serve both build-time and serve-time use?
- How does the Nix flake expose it (a package variant per defaults file?) without exploding the build matrix?
Relates: #4756 (the resolve_config pairing bug in today's cascade), #5671 (transport fallback — relays are among the defaults), #5674 (wire/transport adapters), #5683 (residency/intranet mode — a consumer of private-network builds). Found by WS-F2 (raw-conversation mining); epic #2056.
Activity
developing-today commentedon Nov 5, 2026
CODE-1596
dezren39 commentedon Nov 5, 2026
WS-F2 addendum — Drew's own cascade sketch, recovered from the v1 message store. The mining pass initially extracted the v2
session_messagestore; the older v1part/messagetables in the same DB hold at least one user message the v2 store does not, and it is the most design-complete statement of this issue's subject. Same session (ses_2ec427b80ffeuCx6dCuANmiN6c, "Peer discovery plan review", 2026-03-23), verbatim:What this pins down that the issue body left open:
--replace-defaultsis a build-time flag with exact semantics: use ONLY the JSON, skip the hardcoded consts. (Replace-vs-append in the issue body should be reconciled with this: Drew's sketch says the build flag selects JSON-only vs JSON-over-consts.)--no-default-bootstrap,--no-default-topic). Note the skip layer partially landed:--no-default-topicexists in today'sresolve_configcascade (id(discovery): resolve_config pairs a CLI topic/secret with the public default for the other half under --no-default-topic #4756) — it is the build-defaults layer above it that never arrived.The v1/v2 store divergence itself is recorded in the WS-F2 worklog; the v1 store is being diff-mined to make sure no other dictation exists only there.
dezren39 commentedon Nov 5, 2026
agent-note:v1
Triage 2026-11-05 (task 10315): design ticket whose direction is already Drew-confirmed — no decision is owed by Drew and none should be re-asked.
Verified at triage:
kind/designto match sibling tickets. Programme: epic epic: ID platform expansion — apps, comms, currency, hosting, boards (2026-10-28 directive, LIST 6–15) #2056.Scoped design order (from the issue's own sections): (1) audit the full hardcoded network-default set and fix the v1 scope question; (2) embedding mechanics decision — compile-time validation is the stated criterion, which favors build.rs codegen over include_str!+lazy parse (a malformed file must fail the build, not first run), with the no-build.rs-today caveat recorded; (3) replace-vs-append flag semantics + provenance reporting; (4) runtime composition with the resolve_config cascade. Implementation follows as a separate ticket once the decision record lands here.
78 remaining items
dezren39 commentedon Nov 14, 2026
Released to the queue under Drew's 2026-11-13 unblock-all order (main chat, 23:53 CT). Task(s) 15243 moved from blocked/parked to queued in the fleet unblock-all pass (worker
main-unblock-all-2026-11-13). Dependency gates still recorded on a task remain recorded — the dependency checker will re-block it if a gate is genuinely unmet.dezren39 commentedon Nov 14, 2026
Agent note — task 15243 re-triage complete (lane any-b)
defaults.confviainclude_str!,parse_defaults,resolve_config,--replace-defaults/--no-default-*flags) — and the remaining scope is its six open points (JSON-vs-conf + optional-at-build, compile-time validation, per-list replace-vs-append, the v1 defaults audit/scope, provenance, Nix wiring) plus the unwritten decision record. Task 12396 already routed the exact follow-on; task 13012 garbled it.triaged. The fix packet exactly as 12396 routed it (decision record + small code gaps, building on — not rebuilding — the landed mechanism, topic/secret pairing preserved per id(discovery): resolve_config pairs a CLI topic/secret with the public default for the other half under --no-default-topic #4756) is enqueued as this task's revive successor on the canonical fix dedupe key the moment this row is terminal; the new task's id is posted in the next note on this issue.dezren39 commentedon Nov 14, 2026
Follow-on named — task 15243 triage of #5916
The fix packet routed by triage task 12396 and promised in the triage note above is enqueued: task 16801 — "Fix #5916: decision record reconciling the landed defaults.conf mechanism with the build-time defaults requirements + small code gaps" (status queued). Issue #5916 keeps
queue/queuedfor task 16801.dezren39 commentedon Nov 14, 2026
🤖 Agent note · triaged — design pass scoped; the coherent packet for #5916
Fresh revalidation (2026-11-14): #5916 OPEN, unheld; the brief is Drew's own requirement, self-contained and still accurate in substance, with one premise corrected below. The other two items of the confirmed trio (
--no-gossip, mDNS lookup) have landed; the defaults file has not.Verified current state (one correction to the issue's 2026-11-04 snapshot):
DEFAULT_TOPIC/DEFAULT_TOPIC_SECRETarepub constinpkgs/id/crates/id-core/src/discovery.rs(~line 54), consumed as a pair byresolve_config— pair atomicity is a hard constraint on any design (id(discovery): resolve_config pairs a CLI topic/secret with the public default for the other half under --no-default-topic #4756).build.rsDOES now exist atpkgs/id/build.rs, but it serves the rootidpackage's frontend-asset setup only (fix(id): create dummy dist directory in build.rs for rust-embed #7152).id-corestill has no build script and no defaults-file mechanism exists. The design must answer the embedding question against THIS state, not the stale "no build.rs anywhere" premise.The design pass must settle, in a record linked from this issue (the issue's §1–5 + open questions, restated as the packet):
include!vs const-format parsing) against compile-time validation, binary size/startup, Nix supply of the file, and the id-core-vs-root build.rs placement decision.resolve_config(build-time defaults → serve-launch additive flags →--no-default-*skips), pair atomicity preserved.Labels synced (per §9): kind/design already set; priority/normal, effort/l added.
Routing: task 16801 completes as
triaged. The design-pass enqueue under the canonical key dedupes against this task while claimed; the follow-on is enqueued immediately after completion and its task id recorded in an addendum below.Links: queue task 16801 · relates #4756, #5671, #5674, #5683 · epic #2056
dezren39 commentedon Nov 14, 2026
🤖 Agent note · addendum — design-pass follow-on enqueued
The design pass scoped in the triage note above is enqueued as queue task 16881 (revived under the canonical key after task 16801 completed). Its packet carries the full brief, including the corrected build.rs premise.
Merge pull request #10346 from developing-today/queue/16881-5916-design
dezren39 commentedon Nov 14, 2026
state: done (fixed_merged — design pass)
task: 16881 (lane any-d, repo-worker-code)
issue: #5916 — build-time defaults file for id network defaults
Design record merged: PR #10346 (2026-11-14T18:53:06Z) adds doc/2026-11-14T19-05-00Z_design_id_build_defaults, settling all six packet questions: (1) JSON typed format + v1 contents (bootstrap, topic/secret pair, web_bindings, relay, gossip) with the equivalence property as a flag-matrix test; (2) replace/append as one in-file build-time
mode; (3) embedding = include_str! + one serde parse behind LazyLock — answering Drew's question (yes, a string; codegen and const-parsing rejected with reasons), no new build.rs, Nix supplies the file as source; (4) one documented cascade, pair-atomic at every layer; (5) provenance = SHA-256 of the embedded string, reported at startup/version; (6) no shared shape with runtime config in v1 (serde types reusable later).The pass also corrected the record: a defaults mechanism already exists (defaults.conf in id-core, from #3447/#2145) — the design is a migration/hardening of it, and the audit found two live defects the implementation must close: D1 (topic/secret pair can mix sources in the default resolve path — a private topic can pair with the public secret) and D2 (--replace-defaults silently falls back to consts). Implementation follow-on filed as #10345 with the §8 brief and acceptance.