fix: allow GET requests without primary key#26
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| // For GET requests, if there are no non-special keys (e.g., only PAGINATION), | ||
| // treat it as a multi-row request and leave it unchanged. | ||
| if (requestMethod === C6C.GET) { | ||
| const hasNonSpecialKeys = keys.some(k => !specialKeys.has(k)); | ||
| if (!hasNonSpecialKeys) return request; |
There was a problem hiding this comment.
[P1] Skip path primary keys when request is otherwise empty
The new early return for GET requests that contain only special keys runs before the removedPrimary parameter is applied, so calling normalizeSingularRequest('GET', {}, model, { key: 'actor_id', value: 5 }) now returns {} instead of reconstructing WHERE: { actor_id: 5 }. HttpExecutor routinely strips the primary key from the query and passes it via removedPrimaryKV; under this change, singular GETs whose PK was moved into the URL (with or without pagination) will bypass PK validation and normalization, which can cause the request to be treated as a multi-row fetch and skip cache keying/SQL generation for the intended row.
Useful? React with 👍 / 👎.
Summary
Testing
npm testnpm run lint(fails: Missing script: "lint")npm run format(fails: Missing script: "format")https://chatgpt.com/codex/tasks/task_e_68b9d878ee9883259cd86cbea2cdbfd0