Skip to content

fix: allow GET requests without primary key#26

Open
RichardTMiles wants to merge 1 commit into
mainfrom
codex/update-get-request-handling-for-pagination
Open

fix: allow GET requests without primary key#26
RichardTMiles wants to merge 1 commit into
mainfrom
codex/update-get-request-handling-for-pagination

Conversation

@RichardTMiles

Copy link
Copy Markdown
Contributor

Summary

  • do not force primary keys for GET requests that only include pagination or are empty
  • cover GET pagination and empty scenarios in normalizeSingularRequest tests

Testing

  • npm test
  • npm run lint (fails: Missing script: "lint")
  • npm run format (fails: Missing script: "format")

https://chatgpt.com/codex/tasks/task_e_68b9d878ee9883259cd86cbea2cdbfd0

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Comment on lines +36 to +40
// 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant