Add extended promotional filter#319
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb58b2045f
ℹ️ 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
- 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 address that feedback".
| export const isExtendedPromotional = (component: { | ||
| basic?: number | boolean | null | ||
| preferred?: number | boolean | null | ||
| }): boolean => Boolean(component.preferred) && !Boolean(component.basic) |
There was a problem hiding this comment.
Compare promo flags explicitly before marking extended promo
is_extended_promotional is defined elsewhere in this commit as preferred = 1 AND basic = 0 (see the new SQL filters), but this helper uses truthiness and will return true for cases like { preferred: 1, basic: null }. That creates inconsistent API output versus filter behavior (items can be labeled extended promotional but never match is_extended_promotional=true). Use explicit equality checks for preferred and basic to keep derived fields and filtering aligned; the same logic is duplicated in cf-proxy/src/is-extended-promotional.ts.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in bca5a8e: both extended-promotional helpers now use preferred === 1 && basic === 0, matching the SQL filters exactly. I also added regression coverage for { preferred: 1, basic: null } and boolean inputs in both the root and cf-proxy helper tests.
Verification:
bun test tests/lib/is-extended-promotional.test.tscd cf-proxy && bun test test/is-extended-promotional.test.ts test/render.test.tsbun run format:checkbunx tsc --noEmitcd cf-proxy && bunx tsc --noEmitgit diff --check
|
Fixed the CI failure in 116ddf5. The test workflow now installs cf-proxy dependencies before running the root Bun test suite, so cf-proxy imports like |
|
Remote CI is green on the latest head |
/claim #92
Summary
is_extended_promotionalfrompreferred = 1andbasic = 0/components/listand/api/searchVerification
bun test tests/lib/is-extended-promotional.test.tsbunx tsc --noEmitbun run format:checkcd cf-proxy && bun test test/is-extended-promotional.test.ts test/render.test.tscd cf-proxy && bunx tsc --noEmitNote: DB-backed route tests are blocked locally by an existing Kysely fixture state issue (
driver has already been destroyed) before assertions run.