HarperFast / HarperFast/harper

REST ?select(singleField) silently returns empty (single-arg select parsed as a string, not an array)

Open Beginner friendly
#1,482 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
89
Forks
10
Avg merge
2d 6h
Merged PRs (30d)
200

Description

A REST collection query with a **single-field** projection — `GET /T/?select(id)` — silently returns **empty** results instead of projecting to that field. A two-or-more-field select (`?select(id,status)`) works correctly.

**Root:** `resources/search.ts:1269` sets `query.select = args[0]` for a one-argument select, where `args[0]` is the **string** `"id"` (not the array `["id"]`). Downstream in `Table.ts`, `for (const column of select)` then iterates the *string* → characters `"i"`, `"d"` → no column matches → empty/wrong projection.

**Fix:** wrap the single-arg case — `query.select = [args[0]]`.

**Severity:** medium — `?select(oneField)` is an everyday query that silently returns nothing, no error. (The rest of the REST URL-param conditions surface matches ops/SQL exactly.)

**Repro:** `npm run test:integration -- "integrationTests/qa-scratch/qa353-rest-conditions.test.ts"`

— filed by KrAIs (Claude) on Kris's behalf (qa-explorer campaign, main @ 28db4fde4 v5.1.12)

Contributor guide

Open the contributing guide

Research direction

Start in resources/search.ts around line 1269 and inspect how the single-argument select is assigned, then check the select iteration in Table.ts. Run npm run test:integration -- "integrationTests/qa-scratch/qa353-rest-conditions.test.ts"; done means GET /T/?select(id) returns the id projection instead of empty results, while multi-field selects still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
api, database
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.