Title: id(publications): Registry::load collapses duplicate JSON keys before validate_persisted — an empty world, non-canonical path, or duplicate placement hidden behind a duplicate key is silently restored at boot · Issue #6504 · developing-today/code · GitHub
Open Graph Title: id(publications): Registry::load collapses duplicate JSON keys before validate_persisted — an empty world, non-canonical path, or duplicate placement hidden behind a duplicate key is silently restored at boot · Issue #6504 · developing-today/code
X Title: id(publications): Registry::load collapses duplicate JSON keys before validate_persisted — an empty world, non-canonical path, or duplicate placement hidden behind a duplicate key is silently restored at boot · Issue #6504 · developing-today/code
Description: Problem Registry::load in pkgs/id/src/publications.rs parses the persisted publications file directly into the Registry struct with serde (publications.rs:372, serde_json::from_str(&text)), and only then runs validate_persisted (publicat...
Open Graph Description: Problem Registry::load in pkgs/id/src/publications.rs parses the persisted publications file directly into the Registry struct with serde (publications.rs:372, serde_json::from_str(&text)), and onl...
X Description: Problem Registry::load in pkgs/id/src/publications.rs parses the persisted publications file directly into the Registry struct with serde (publications.rs:372, serde_json::from_str(&text)), and...
Opengraph URL: https://github.com/developing-today/code/issues/6504
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(publications): Registry::load collapses duplicate JSON keys before validate_persisted — an empty world, non-canonical path, or duplicate placement hidden behind a duplicate key is silently restored at boot","articleBody":"## Problem\n\n`Registry::load` in `pkgs/id/src/publications.rs` parses the persisted publications file directly into the `Registry` struct with serde (publications.rs:372, `serde_json::from_str(&text)`), and only then runs `validate_persisted` (publications.rs:391). Serde's derived decoding collapses duplicate JSON keys — the last value wins — so `validate_persisted` only ever sees the collapsed record. A hand-edited or corrupt file that spells a field twice hides its first, invalid spelling from every load-side invariant the module promises to enforce loudly: empty world name, non-canonical mount path, and duplicate placement (the exact three rules `validate_persisted` exists to re-check, per its doc comment at publications.rs:379–390 and the module's persistence contract: \"a malformed file is an error naming the file — a serve that cannot read its persisted publications must say so loudly rather than silently restore nothing\").\n\nEvidence (`origin/main` fc073b5f11; `pkgs/id/src/publications.rs` is identical between the laptop primary HEAD and `origin/main`):\n\n- `Registry::load`, publications.rs:356; the struct parse is at publications.rs:372–374, followed by `validate_persisted()` at publications.rs:375–377.\n- `validate_persisted`, publications.rs:391: checks world non-empty, mount path stored in canonical form, and no duplicate placement — all on the post-collapse value.\n- In-tree load tests pin the single-spelling cases only: publications.rs:619 (duplicate placement), :640 (empty world), :654 (non-canonical mount path). No test spells a key twice.\n\nVerified this run on the laptop with a probe against the real `id` crate (`~/git/fleet/probe-pub-dup`, integration test driving the public `Registry::load` on temp files; `cargo test` 1 passed):\n\nControls — each invalid record alone is refused by `validate_persisted`, and a valid record alone loads:\n- `{\"publications\":[{world:\"\", placement path_mount \"/empty\"}]}` → Err.\n- `{\"publications\":[{world:\"bad\", placement path_mount \"//bad\"}]}` → Err.\n- `{\"publications\":[valid, valid]}` (duplicate placement) → Err.\n- `{\"publications\":[valid \"/arena\"]}` → Ok.\n\nHidden behind a duplicate key — all load Ok:\n- `{\"publications\":[empty-world record, non-canonical record],\"publications\":[valid record]}` → Ok, 1 publication: the whole invalid first array is never validated.\n- `{\"publications\":[{\"world\":\"\",\"world\":\"arena\", placement path_mount \"/arena\"}]}` → Ok, world is \"arena\": the empty first `world` is hidden.\n- `{\"publications\":[{\"world\":\"bad\", placement {\"kind\":\"path_mount\",\"path\":\"//bad\",\"path\":\"/good\"}}]}` → Ok: the non-canonical first `path` is hidden.\n\n## Why it matters\n\n`publications.json` is restored at boot by `id serve`: the loaded set is what gets published, and `boot_warnings` / shadow handling trust that load validated it. The module's own contract is fail-loud on corrupt persisted records precisely because a silently restored bad set resurrects placements `publish()` refuses. Duplicate keys defeat that contract invisibly — the file on disk and the registry in memory disagree, and no error names the file. This is the same duplicate-key class as #6473 (parse_records), #6474 (world_fixture), #6491 (parse_surface), #6499 (parse_wants) and #6501 (world_session frames), in a persisted-registry loader those fixes did not cover; the sibling persisted loader in deploy.py had the same flaw (#6384, closed).\n\n## Acceptance criteria\n\n- `Registry::load` refuses a publications file containing duplicate JSON keys — at the top level, inside a publication object, and inside a placement object — with an error naming the file, before `validate_persisted` runs on a collapsed value (e.g. parse through a duplicate-rejecting first pass like the #6473-family fixes, or an equivalent strict decode).\n- Raw-string regression tests pin: duplicate `publications` (invalid array first, valid second), duplicate `world` (empty first), and duplicate `path` (non-canonical first) — each refused; the existing single-spelling controls at publications.rs:619/:640/:654 keep passing.\n- Controls unchanged: a valid registry file loads identically, a missing file still yields an empty registry, and an unreadable file still fails loud naming the file.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-11-06T11:04:18Z","url":"https://github.com/developing-today/code/issues/6504"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:93273799-9b58-d9cc-0e54-77968d70d1c0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DCD2:1139E2:B99C3C:F6E0F2:6B06415F |
| html-safe-nonce | fc7a2251d3626a3ca196a1d3b78768de2d52e64da0ea4692f6bc9eed4a3c1356 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQ0QyOjExMzlFMjpCOTlDM0M6RjZFMEYyOjZCMDY0MTVGIiwidmlzaXRvcl9pZCI6IjIyMzQ5MDIwMDUzODkwODI5NzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f6ddc79cbfba9b9cc073c711a624458610b93fb91779a2c4ee51c7ca96039591 |
| hovercard-subject-tag | issue:6241505438 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/6504/issue_layout |
| twitter:image | https://opengraph.githubassets.com/234806aba95b7e33a6cb214f5138f3cd00bb692c6f2f0dabbf5a9e0ad6059030/developing-today/code/issues/6504 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/234806aba95b7e33a6cb214f5138f3cd00bb692c6f2f0dabbf5a9e0ad6059030/developing-today/code/issues/6504 |
| og:image:alt | Problem Registry::load in pkgs/id/src/publications.rs parses the persisted publications file directly into the Registry struct with serde (publications.rs:372, serde_json::from_str(&text)), and onl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width