GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deploy(deploy.py): duplicate JSON keys in the registry are silently discarded at load — an invalid first definition is never validated · Issue #6384 · developing-today/code

deploy(deploy.py): duplicate JSON keys in the registry are silently discarded at load — an invalid first definition is never validated #6384

New issue
Copy link
New issue
Copy link
Closed
#6385
Closed
deploy(deploy.py): duplicate JSON keys in the registry are silently discarded at load — an invalid first definition is never validated#6384
#6385
Copy link
Assignees
dezren39
Labels
app/deployPackage/app: deploy (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

Description

@dezren39
dezren39
opened on Nov 5, 2026
Issue body actions

deploy(deploy.py): duplicate JSON keys in the registry are silently discarded at load — an invalid first definition is never validated

pkgs/deploy/deploy.py's module docstring states the contract: validation "is the oracle for 'well-formed definition'... Any violation is reported by field and makes list exit non-zero — a registry that cannot be validated must never be enumerated as if it were trustworthy." That oracle never gets the chance to run on a duplicated key: load_registry (deploy.py:149-151) is a bare json.load(fh), and Python's json silently keeps only the last value for a repeated key, at every nesting level. The discarded text is never parsed into the registry, never validated, and never reported.

Verified on the laptop against the real deploy.py (tree @1dae17e457, file unchanged on origin/main @8f2cf5dd62; probe: ~/git/fleet/probe-deploy-dupkeys/probe.py + probe2.py on the laptop):

1. Duplicate service name: an invalid first definition vanishes

Registry text defining svc twice — first with "class": "bogus-class", then with a valid definition:

== dup service key, invalid-first/valid-second: exit=0
stdout: NAME  CLASS  TARGETS | svc  systemd  laptop

deploy list exits 0 and enumerates the service as trustworthy; the invalid definition was discarded before validate() (deploy.py:55) could see it. Control: the same invalid definition on its own is correctly rejected (exit 1, "class must be one of ..."). Reversed order (valid first, invalid second) exits 1 only because the invalid copy happens to be the survivor — the behaviour depends on key order, not on validity.

2. Duplicate field inside a definition: an invalid first value vanishes

A definition carrying "ports": "notalist" first and a valid "ports": [] second:

== dup field ports string-then-valid-list: exit=0

Exit 0 — the malformed value the field check at deploy.py:113-124 exists to catch was dropped at load. (Valid-first/invalid-second exits 1, again only by order luck.)

3. Duplicate key inside environment

"environment": {"A": "1", "A": "2"} → exit 0; one of the two values is silently lost. For environment maps that later slices render into service units, a silently dropped value is a configuration that differs from what the registry author wrote, with no signal.

Why this is its own finding (not #6383 / #6376)

  • deploy(deploy.py): validate() accepts shapes its own rules reject — newline service names, duplicate targets/secrets, host-less healthCheck URLs #6383 covers duplicate list entries that reach validate() (duplicate targets/secrets) — those are visible to the validator. Duplicate object keys never reach it; no change inside validate() can detect them. The fix belongs in load_registry.
  • deploy(deploy.py): arguments after list are silently ignored and a duplicate --registry silently overrides the first — the typo-flag class, in the parser the activation slices will build on #6376 covers the argument parser silently ignoring input. This is the same silent-input-loss class one layer down, in registry loading — the layer every later deploy tool v1: target registry (deployTargets) + systemd generation activation #5766 slice (activation, status, rollback) will load through.
  • The registry is normally rendered by Nix from pkgs/deploy/services.nix, which cannot emit duplicate keys — but --registry PATH / $DEPLOY_REGISTRY is the documented route for hand-written registries and is exactly how the flake checks exercise the malformed-definition path. A hand-authored registry with a duplicated key (a classic merge/edit accident) is precisely the input the oracle is for.

Acceptance criteria

  • Loading a registry whose text contains a duplicate key — at the top (service) level, inside a service definition, or inside a nested object such as environment — fails with a clear error naming the duplicated key (e.g. via object_pairs_hook raising on repeats), and deploy list exits non-zero without enumerating anything.
  • Registries without duplicate keys behave exactly as before: the shipped registry (pkgs/deploy/services.nix via the flake) still validates and lists unchanged; the probe's sane control still exits 0.
  • Regression coverage: the malformed-registry flake check (deploy-list-malformed in lib/default.nix) or an equivalent check exercises at least the duplicate-service-key and duplicate-field cases.
  • Existing load errors keep their shape: unreadable file / malformed JSON still exit 1 with the "cannot load registry" message.

Related: #6383 (validate() gaps — duplicate list entries, newline names, host-less healthCheck), #6376 (argument-parser silent input loss in the same file), #5766 (the deploy-tool epic this registry gates).

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    on Nov 5, 2026
  2. developing-today commented on Nov 5, 2026

    @developing-today
    developing-todayBot
    on Nov 5, 2026 – with developing.today
    Contributor
    More actions

    CODE-1900

  3. dezren39
    added
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued queue task
    app/deployPackage/app: deploy (pkgs/ or apps/ in this repo)
    on Nov 5, 2026
  4. dezren39 commented on Nov 5, 2026

    @dezren39
    dezren39
    on Nov 5, 2026
    MemberAuthor
    More actions

    🤖 Agent note · state: filed

    • Agent: new-issue-creator job (lane A, agent slug new-issue-creator-code-a)
    • Session / ID: cron new-issue-creator-code-a, run 2026-11-05 15:35 CST
    • Found via: filed this run
    • Task: Filed after verifying on the laptop with probes driving the real deploy.py (~/git/fleet/probe-deploy-dupkeys/): duplicate JSON keys at service, field, and environment level are silently last-wins at json.load in load_registry (deploy.py:149-151), so an invalid first definition/value is never seen by validate() and deploy list exits 0. Controls (single invalid definition, valid-first orderings, sane registry) all behaved as expected. Dedup: distinct from deploy(deploy.py): validate() accepts shapes its own rules reject — newline service names, duplicate targets/secrets, host-less healthCheck URLs #6383 (duplicate list entries inside validate()) and deploy(deploy.py): arguments after list are silently ignored and a duplicate --registry silently overrides the first — the typo-flag class, in the parser the activation slices will build on #6376 (argument parser).
    • Expectation: effort/s — reject duplicate keys at load with a key-named error, keep non-duplicate behaviour identical, add flake-check regression coverage for the duplicate-service-key and duplicate-field cases.
    • Links: queue packet to follow in this run (repo-health-code-pilot).
  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 5, 2026
  6. dezren39 commented on Nov 5, 2026

    @dezren39
    dezren39
    on Nov 5, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane code-q
    • Session / ID: task 10782
    • Found via: queue claim
    • Task: Triage of issue deploy(deploy.py): duplicate JSON keys in the registry are silently discarded at load — an invalid first definition is never validated #6384 — verify the duplicate-JSON-key load bug in pkgs/deploy/deploy.py against current main, reproduce, and route the fix.
    • Expectation: effort class s; done = findings posted on issue deploy(deploy.py): duplicate JSON keys in the registry are silently discarded at load — an invalid first definition is never validated #6384, a small_fix follow-up enqueued, task 10782 completed as triaged.
    • Links: issue deploy(deploy.py): duplicate JSON keys in the registry are silently discarded at load — an invalid first definition is never validated #6384; packet in task 10782
  7. 7 remaining items

  8. dezren39
    added 2 commits that reference this issue on Nov 5, 2026

    test(deploy): property-based coverage for the duplicate-key invariant (…

    8873dd1

    fix(deploy): reject duplicate JSON keys at registry load (#6384) (#6385)

    5c56f76
  9. dezren39
    closed this as completedin #6385on Nov 5, 2026
  10. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 5, 2026
  11. dezren39 commented on Nov 5, 2026

    @dezren39
    dezren39
    on Nov 5, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane code-z
    • Session / ID: task 10786
    • Found via: queue claim (direct execution lane)
    • Task: small_fix for issue deploy(deploy.py): duplicate JSON keys in the registry are silently discarded at load — an invalid first definition is never validated #6384 — duplicate JSON keys in the deploy registry are now rejected at load
    • Expectation: done = PR merged + this note + task 10786 completed as fixed_merged

    Result

    • PR fix(deploy): reject duplicate JSON keys at registry load (#6384) #6385 merged (squash, merge commit 5c56f76); issue deploy(deploy.py): duplicate JSON keys in the registry are silently discarded at load — an invalid first definition is never validated #6384 closed by the merge.
    • load_registry parses with an object_pairs_hook that raises on any repeated key at any nesting level; the error keeps the cannot load registry shape, names the duplicated key, exits 1, and enumerates nothing. Malformed-JSON / unreadable-file errors keep their shape (ValueError now caught; JSONDecodeError is a subclass).
    • Regression coverage: deploy-list-malformed extended with duplicate-service-key and duplicate-field raw-text registries; new deploy-dupkeys-property check runs a property test (random registry trees, stdlib json.loads oracle, duplicate injected at a random object node/depth) after a Codex P1 asked for property-based coverage — dispositioned by fixing in-PR (reply on the review thread) and Codex round 2 completed with no findings.
    • Verification (laptop): probes — duplicate service/field/environment keys exit 1 naming the key with empty stdout, sane registry exits 0, single-invalid control unchanged; nix builds of checks deploy-dupkeys-property, deploy-list-malformed, and deploy-list all pass; the property test finds a counterexample against the pre-fix deploy.py.
    • Links: PR fix(deploy): reject duplicate JSON keys at registry load (#6384) #6385, issue deploy(deploy.py): duplicate JSON keys in the registry are silently discarded at load — an invalid first definition is never validated #6384
  12. dezren39
    removed
    queue/queuedHas a queued queue task
    on Nov 5, 2026
  13. developing-today
    added
    status:in-review
    and removed
    status:done
    on Nov 8, 2026
  14. developing-today
    reopened this on Nov 8, 2026
  15. github-actions
    assigned
    dezren39
    on Nov 12, 2026
  16. dezren39
    closed this as completedon Nov 17, 2026
  17. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 17, 2026
  18. dezren39 commented on Nov 17, 2026

    @dezren39
    dezren39
    on Nov 17, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done (triage — already fixed and closed)

    • Agent: queue worker (repo-worker-code), lane any-c
    • Session / ID: task 18485
    • Found via: queue claim (bulk-intake triage packet, 2026-11-16)

    Verdict: already done. Fresh verification this shift (2026-11-17, via gh): issue #6384 is CLOSED with status/done. The fix was worked by task 10786 (lane code-z, 2026-11-05): PR #6385 merged (merge commit 5c56f76) — load_registry in pkgs/deploy/deploy.py now parses with an object_pairs_hook that rejects any repeated key at any nesting level, with regression coverage in deploy-list-malformed and the deploy-dupkeys-property check. Task 18485 completes as already_done on that evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/deployPackage/app: deploy (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.