Skip to content

Add extended promotional component filter#342

Open
TUPM96 wants to merge 8 commits into
tscircuit:mainfrom
TUPM96:fix-extended-promotional-filter
Open

Add extended promotional component filter#342
TUPM96 wants to merge 8 commits into
tscircuit:mainfrom
TUPM96:fix-extended-promotional-filter

Conversation

@TUPM96
Copy link
Copy Markdown

@TUPM96 TUPM96 commented May 25, 2026

/claim #92

Summary

  • Derive is_extended_promotional from existing JLC flags as preferred && !basic.
  • Expose the field in origin /api/search and /components/list responses, plus D1 proxy search/list responses.
  • Add is_extended_promotional=true|false filtering in origin and D1 search paths, and wire the HTML filter/column label.
  • Add focused helper/render coverage plus route assertions for the derived field/filter.
  • Keep CI usable on cache miss by updating the 7-Zip setup URL, downloading database cache fragments with bounded parallelism, extending the test timeout for the first uncached 28GB database setup, keeping the preload DB client alive, and installing cf-proxy dependencies before root bun test imports proxy code.
  • Avoid a flaky JSON route timeout by skipping the microphone package-dropdown lookup for JSON responses and giving that route test a route-appropriate timeout.

Validation

  • GitHub CI on 9b176a8: Format Check, Type Check, and Bun Test all pass.
  • npx --yes @biomejs/biome@1.9.4 check routes/components/list.tsx routes/api/search.tsx lib/util/is-extended-promotional.ts tests/lib/is-extended-promotional.test.ts tests/routes/api/search.test.ts tests/routes/components/list.test.ts cf-proxy/src/components.ts cf-proxy/src/index.ts cf-proxy/src/render.ts cf-proxy/src/search.ts cf-proxy/src/is-extended-promotional.ts cf-proxy/test/is-extended-promotional.test.ts cf-proxy/test/render.test.ts
  • npm test in cf-proxy - 127 passed
  • npx --yes bun test tests/lib/is-extended-promotional.test.ts
  • npx --yes bun test cf-proxy/test/worker.test.ts cf-proxy/test/cache-service.test.ts
  • git diff --check

Note: I also tried the origin DB-backed route tests locally with npx --yes bun test tests/routes/api/search.test.ts tests/routes/components/list.test.ts; this Windows workspace does not have the seeded SQLite tables, so those route tests stop at no such table: components/v_components. The full seeded DB route suite passes in GitHub CI.

@TUPM96 TUPM96 force-pushed the fix-extended-promotional-filter branch from a97f67f to d2cda29 Compare May 25, 2026 07:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for an is_extended_promotional component flag (derived as preferred && !basic) across both the origin app and the Cloudflare D1 proxy, including JSON response fields and query filtering.

Changes:

  • Introduces isExtendedPromotional helper and exposes is_extended_promotional in /api/search and /components/list responses (origin + D1 proxy).
  • Adds is_extended_promotional=true|false filtering to origin SQL queries and the D1 proxy search index query builder.
  • Updates HTML rendering (D1 proxy) and adds targeted test coverage for the derived field and filter behavior.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/routes/components/list.test.ts Asserts derived field presence/logic and filter behavior for /components/list.
tests/routes/api/search.test.ts Asserts derived field presence/logic and filter behavior for /api/search.
tests/lib/is-extended-promotional.test.ts Unit tests for the origin isExtendedPromotional helper.
routes/components/list.tsx Adds query param, SQL filter conditions, response field, and HTML checkbox for extended promotional.
routes/api/search.tsx Adds query param, SQL filter conditions, and response field for extended promotional.
lib/util/is-extended-promotional.ts Implements origin-side derived flag helper.
cf-proxy/test/render.test.ts Verifies D1 HTML filter rendering and column labeling for extended promotional.
cf-proxy/test/is-extended-promotional.test.ts Unit tests for the proxy isExtendedPromotional helper.
cf-proxy/src/search.ts Adds is_extended_promotional query param handling and SQL condition generation for D1 search.
cf-proxy/src/render.ts Adds column label and renders the extended promotional checkbox filter in D1 HTML.
cf-proxy/src/is-extended-promotional.ts Implements proxy-side derived flag helper.
cf-proxy/src/index.ts Adds is_extended_promotional to D1 proxy JSON responses for search and components list.
cf-proxy/src/components.ts Forwards is_extended_promotional through the D1 components list query path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TUPM96 TUPM96 force-pushed the fix-extended-promotional-filter branch 2 times, most recently from 8cd3eed to 0fa5787 Compare May 25, 2026 08:08
@TUPM96 TUPM96 force-pushed the fix-extended-promotional-filter branch from 0fa5787 to 46f892b Compare May 25, 2026 08:50
@TUPM96
Copy link
Copy Markdown
Author

TUPM96 commented May 25, 2026

CI follow-up pushed in 48eb01b.

The previous Bun Test run completed setup successfully but then failed all DB-backed route tests with driver has already been destroyed. Root cause: tests/preload.ts called setupDerivedTables() without passing a DB, so it created and destroyed the shared Kysely singleton before the route tests used it. The preload now passes getDbClient() explicitly, so setup does not close the singleton during the suite.

Additional local checks after the patch:

  • npx tsc --noEmit
  • npx --yes bun test tests/lib/is-extended-promotional.test.ts
  • npx --yes bun test cf-proxy/test/is-extended-promotional.test.ts cf-proxy/test/render.test.ts
  • git diff --check

@TUPM96
Copy link
Copy Markdown
Author

TUPM96 commented May 25, 2026

Second CI follow-up pushed in 18056cf.

The rerun got past the DB singleton issue and reached 197 passing tests; the remaining two errors were from root bun test loading cf-proxy tests without cf-proxy dependencies installed (kysely-d1 missing). The test workflow now installs cf-proxy dependencies before the full root test suite.

Rechecked locally after the workflow patch:

  • npx tsc --noEmit
  • npx --yes bun test tests/lib/is-extended-promotional.test.ts
  • npx --yes bun test cf-proxy/test/is-extended-promotional.test.ts cf-proxy/test/render.test.ts
  • git diff --check

@TUPM96
Copy link
Copy Markdown
Author

TUPM96 commented May 25, 2026

Final CI follow-up is green on the latest head (9b176a8).\n\nWhat changed after the last update:\n- removed the duplicate root kysely-d1 dependency; cf-proxy dependencies are installed in the workflow instead\n- skipped the microphone package dropdown query for JSON responses so the API route avoids unnecessary DB work\n- allowed the microphone route test enough time on the full cached CI database\n\nValidation:\n- GitHub ormat-check: pass\n- GitHub ype-check: pass\n- GitHub est: pass\n- local
px --yes bun x tsc --noEmit: pass\n- local targeted Bun tests for the extended promotional filter and cf-proxy render helpers: pass\n- local git diff --check: pass

@zhaog100
Copy link
Copy Markdown

Claiming this bounty. Will add extended promotional component filter.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants