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 — atlas-search(CLI): --k/--pool 0 and negative (=form) counts silently clamp to 0 — standalone returns empty success where the service rejects the same request · Issue #5407 · developing-today/code

atlas-search(CLI): --k/--pool 0 and negative (=form) counts silently clamp to 0 — standalone returns empty success where the service rejects the same request #5407

New issue
Copy link
New issue
Copy link
Closed
#5411
Closed
atlas-search(CLI): --k/--pool 0 and negative (=form) counts silently clamp to 0 — standalone returns empty success where the service rejects the same request#5407
#5411
Copy link
Labels
app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)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/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

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

Summary

The standalone atlas-search CLI silently clamps out-of-range count arguments to 0, so a mistyped search exits 0 with an empty result set instead of an error — while the service path rejects the same request. All count flags (--k, --pool, --expand, --trunc, and get-chunk's --neighbors) are declared as i64 and converted through one helper that maps every negative value to 0; zero itself is also accepted for --k/--pool. The service's own request validation (design section 2) requires pool in 1..=400 and k >= 1, so the two front-ends disagree on what a valid search is: via-service gets a 400, standalone gets a silent empty success.

Evidence (verified this run)

  • pkgs/atlas-search/crates/atlas-search/src/main.rs:556-558 — fn u(v: i64) -> usize { usize::try_from(v).unwrap_or(0) }: every negative count becomes 0, with no error or warning. Used for all counts at lines 470-482 (proto_search_request), 582-595 (cmd_search), and 624 (cmd_get_chunk neighbors).
  • Count flags are signed with no range: main.rs:157 (trunc: i64), :168 (k: i64), :171 (pool: i64), :196 (expand: i64), :213 (neighbors: i64). (A bare --k -1 is caught by clap's argument parsing, but the --k=-1 form reaches u().)
  • The in-repo contract: pkgs/atlas-search/crates/atlas-search/src/server.rs:509-524 — validate_request rejects pool == 0 || pool > 400 ("pool must be between 1 and 400 (design section 2)"), k == 0 ("k must be at least 1"), and page_limit == 0. The standalone path has no equivalent check, and no upper bound on pool at all.
  • pkgs/atlas-search/crates/atlas-core/src/search.rs — with k = 0 the flat path keeps ranked[..0] and the grouped path truncates to 0; with pool = 0 the branch statements bind LIMIT 0. Both render a normal envelope with results: [].

Verified with the real binary, built on the laptop from a probe copy of the tree at fab2f4d1c (~/git/fleet/probe-atlas-negcounts/, lines re-checked on current main 964c4b780), run in hybrid mode against the fixture corpus (fixtures/fixture_corpus.sql, --backend local, ATLAS_SEARCH_QVEC_FILE hook as in tests/cli_parity.rs). The control query how do we back up the database returns 6 results:

  • --k 0 → exit 0, 0 results
  • --k=-1 → exit 0, 0 results
  • --pool 0 → exit 0, 0 results, envelope vector.pool: 0
  • --pool=-5 → exit 0, 0 results
  • --pool 401 and --pool 9999 → exit 0, accepted (service rejects > 400)
  • --group-by-session --k 0 / --k=-3 → exit 0, 0 results
  • --expand=-1 (with --k 1) → exit 0, silently treated as --expand 0
  • --trunc=-1 → exit 0, silently treated as full width (envelope trunc: null)
  • get-chunk 1 --neighbors=-1 → exit 0, no context (the --neighbors=1 control includes it)

Why it matters

An operator or script that mistypes a count — or computes one that goes zero/negative — gets a successful-looking empty search and no signal that the request itself was invalid. That is the worst failure shape for a search front-end: "no results" is a meaningful answer, and this makes it indistinguishable from a malformed request. It also breaks the CLI/service contract the step-4 design established: the same request is a 400 through the service and a silent success standalone, so behaviour depends on whether a service happens to be running (and the via-service fallback path converts the server's rejection into a standalone run that then silently succeeds empty).

Acceptance criteria

  • Standalone search rejects k < 1 and pool outside 1..=400 with a fatal error (exit 2, atlas-search: <msg>), mirroring validate_request's messages in server.rs.
  • Negative expand, trunc, and get-chunk neighbors are rejected the same way instead of clamping to 0; 0 remains valid for those three (0 = off / full width, as documented).
  • Validation happens before any backend/embedder work and before the via-service attempt, so the error is identical whether or not a service is running.
  • Valid values are unchanged: the CLI parity tests (cargo test -p atlas-search on the laptop/CI) still pass, including the --pool 2 --k 2 and grouped/expand cases.
  • New tests pin the rejected shapes (at least: k=0, k=-1 via the = form, pool=0, pool=401, negative expand/trunc/neighbors).

Filed by new-issue-creator-code-a after verification this run. Not a duplicate of #5373 (atlas-embed empty-token-list, a different silent-empty in the embedder) or the #5353/#5354 step issues (the feature builds, closed).

Activity

  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    status/in-progressQueue worker lifecycle state
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    work/self-assignedAn agent grabbed this item directly, outside the queue
    app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)
    on Nov 4, 2026
  2. developing-today commented on Nov 4, 2026

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

    CODE-1312

  3. dezren39 commented on Nov 4, 2026

    @dezren39
    dezren39
    on Nov 4, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-a (new-issue-creator job, lane A)
    • Session / ID: cron new-issue-creator-code-a run 2026-11-04T11:05Z (America/Chicago 05:05)
    • Found via: filed this run
    • Task: Filed after verification with the real binary built on the laptop (probe ~/git/fleet/probe-atlas-negcounts) against the fixture corpus: --k 0 / --k=-1 / --pool 0 / --pool=-5 exit 0 with 0 results on a 6-result control query; --pool 401/9999 accepted standalone while server.rs validate_request rejects >400; negative expand/trunc/neighbors silently clamp to 0 via u() at main.rs:556.
    • Expectation: effort/s — CLI count validation mirroring validate_request (k >= 1, pool 1..=400, expand/trunc/neighbors >= 0), parity tests green.
    • Links: probe ~/git/fleet/probe-atlas-negcounts (laptop)
  4. dezren39 commented on Nov 4, 2026

    @dezren39
    dezren39
    on Nov 4, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: new-issue-creator-code-a (new-issue-creator job, lane A)
    • Session / ID: cron new-issue-creator-code-a run 2026-11-04T11:05Z (America/Chicago 05:05)
    • Found via: self-assigned during new-issue-creator-code-a run (guarded self-solve, lifecycle protocol §4: filed this run, trivial/small-fix, no safety labels)
    • Task: Self-solving: add CLI count validation in atlas-search main.rs mirroring server validate_request, with unit tests; branch creator-a/5407-cli-count-validation, PR to follow.
    • Expectation: effort/s — done = PR merged, issue closed, atlas-search tests green on the laptop.
    • Links: branch creator-a/5407-cli-count-validation (laptop worktree ~/git/fleet/wt-5407)
  5. developing-today
    added
    status:in-review
    on Nov 4, 2026
  6. dezren39
    added a commit that references this issue on Nov 4, 2026

    fix(atlas-search): validate CLI counts instead of clamping to 0 (#5407)…

    57f9ebc
  7. dezren39
    closed this as completedin #5411on Nov 4, 2026
  8. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 4, 2026
  9. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    work/self-assignedAn agent grabbed this item directly, outside the queue
    on Nov 4, 2026
  10. dezren39 commented on Nov 4, 2026

    @dezren39
    dezren39
    on Nov 4, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: new-issue-creator-code-a (new-issue-creator job, lane A)
    • Session / ID: cron new-issue-creator-code-a run 2026-11-04T11:05Z (America/Chicago 05:05)
    • Found via: self-assigned during new-issue-creator-code-a run (guarded self-solve, lifecycle protocol §4)
    • Task: Solved: PR fix(atlas-search): validate CLI counts instead of clamping to 0 (#5407) #5411 squash-merged (57f9ebc) — CLI count validation in atlas-search main.rs mirroring server validate_request (k >= 1, pool 1..=400, expand/trunc/neighbors non-negative), new unit test pinning bounds/messages.
    • Expectation: done — cargo test -p atlas-search green on laptop (16 unit + 4 CLI parity); fixed binary re-checked against the fixture corpus: all previously silent shapes exit 2, control/valid shapes exit 0. Issue closed via Fixes; work/status labels stripped.
    • Links: PR fix(atlas-search): validate CLI counts instead of clamping to 0 (#5407) #5411 (merged, 57f9ebc); probe ~/git/fleet/probe-atlas-negcounts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)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/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    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.