Skip to content

codedb-cli: deps uses wrong JSON field + root mismatch on running daemon #90

@justrach

Description

@justrach

Found by Codex review on PR #88.

Bug 1: deps command uses wrong JSON field

scripts/codedb-cli line 121 does:

_get "/explore/deps?path=$(_urlencode "$1")" | jq -r '.dependents[]'

But the server (src/server.zig) returns the list under imported_by, not dependents. With set -euo pipefail, this makes deps fail on every call.

Fix: Change .dependents[] to .imported_by[]

Bug 2: Root mismatch when daemon already running

_ensure_server returns immediately if /health succeeds, regardless of what [root] was requested. If a daemon is already running for repo A, calling codedb-cli /repo-b tree silently returns repo A's results.

Fix: Check the running daemon's root (via /status or similar) and restart if it doesn't match the requested root.

Origin

Both found by Codex automated review on #88. The core fixes in #88 (stack overflow + codesign) are unaffected — these are CLI wrapper issues only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions