Conversation
There was a problem hiding this comment.
Sorry @Connorbelez, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Pull request overview
Implements ENG-301 by introducing explicit portal listing query contracts (public teaser + lender list/detail) and wiring thin frontend route consumers to those contracts via TanStack Query, with supporting tests and spec documentation.
Changes:
- Added Convex portal-aware listing query endpoints and shared snapshot helpers for consistent pricing/filter behavior.
- Updated
/(portal hosts) and/lender/listings(+ detail) to consume the explicit portal query contracts and render host-scoped empty/unavailable states. - Added/updated frontend and backend tests plus ENG-301 spec/audit artifacts.
Reviewed changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/routes/portal-home-route.test.tsx | Adds portal-home teaser consumer coverage (TanStack Query + explicit portal query options). |
| src/test/routes/lender-listings-route.test.tsx | Adds /lender/listings route coverage for portal-host gating and query-option wiring. |
| src/test/listings/marketplace-listings-page.test.tsx | Extends listings page tests to validate detailRoute link behavior. |
| src/test/lender/listing-detail-page.test.tsx | Refactors lender detail tests to TanStack Query + portal detail query options and host gating states. |
| src/routes/lender.listings.tsx | Implements lender listings index surface with portal-host gating, search parsing, and explicit portal list query usage. |
| src/routes/index.tsx | Replaces portal-host root debug surface with public teaser listings consumer using explicit portal query options. |
| src/routeTree.gen.ts | Regenerates route tree to reflect updated route structure/order. |
| src/components/listings/search.ts | Adds helper to map backend effective filters into route search state. |
| src/components/listings/portal-query-options.ts | Introduces React Query option builders for portal teaser/list/detail Convex endpoints. |
| src/components/listings/marketplace-types.ts | Adds portal snapshot/effective-filter types derived from new Convex endpoints. |
| src/components/listings/MarketplaceListingsPage.tsx | Makes heading/eyebrow/description/detailRoute configurable; routes cards via detailRoute. |
| src/components/lender/listings/LenderListingDetailPage.tsx | Moves lender detail reads to TanStack Query and explicit portal detail contract; adds portal-host required state. |
| specs/ENG-301/tasks.md | Tracks ENG-301 task execution state. |
| specs/ENG-301/summary.md | Documents ENG-301 scope/constraints and linked planning artifacts. |
| specs/ENG-301/status.md | Records execution status and validation notes. |
| specs/ENG-301/execution-checklist.md | Captures requirements/DoD checklist and validation expectations. |
| specs/ENG-301/chunks/manifest.md | Summarizes chunk breakdown and completion status. |
| specs/ENG-301/chunks/chunk-04-tests-validation-and-audit/tasks.md | Records validation/audit tasks for chunk 04. |
| specs/ENG-301/chunks/chunk-04-tests-validation-and-audit/status.md | Records completion/validation results for chunk 04. |
| specs/ENG-301/chunks/chunk-04-tests-validation-and-audit/context.md | Context/plan excerpts for validation/audit chunk. |
| specs/ENG-301/chunks/chunk-03-lender-list-route-and-detail/tasks.md | Records tasks for lender list/detail consumer chunk. |
| specs/ENG-301/chunks/chunk-03-lender-list-route-and-detail/status.md | Records completion/validation notes for chunk 03. |
| specs/ENG-301/chunks/chunk-03-lender-list-route-and-detail/context.md | Context for lender list/detail consumer chunk. |
| specs/ENG-301/chunks/chunk-02-public-portal-teaser/tasks.md | Records tasks for portal teaser consumer chunk. |
| specs/ENG-301/chunks/chunk-02-public-portal-teaser/status.md | Records completion/validation notes for chunk 02. |
| specs/ENG-301/chunks/chunk-02-public-portal-teaser/context.md | Context for portal teaser consumer chunk. |
| specs/ENG-301/chunks/chunk-01-backend-portal-contracts/tasks.md | Records tasks for backend portal contracts chunk. |
| specs/ENG-301/chunks/chunk-01-backend-portal-contracts/status.md | Records completion/validation notes for chunk 01. |
| specs/ENG-301/chunks/chunk-01-backend-portal-contracts/context.md | Context for backend portal contracts chunk. |
| specs/ENG-301/audit.md | Spec compliance audit output and remaining manual-validation gaps. |
| convex/test/moduleMaps.ts | Registers new portalQueries module in Convex test module map. |
| convex/listings/queries.ts | Extracts reusable snapshot helpers and reuses them from existing endpoints. |
| convex/listings/portalQueries.ts | Adds explicit portal public/lender list/detail query contracts with pricing + filter clamping. |
| convex/listings/marketplace.ts | Exposes shared marketplace snapshot helper and filter validator for reuse by portal queries. |
| convex/listings/tests/queries.test.ts | Adds backend test coverage for portal teaser, lender list clamping, and lender detail contract. |
| convex/admin/origination/commit.ts | Removes unused import from origination commit flow. |
| convex/_generated/api.d.ts | Updates generated API types to include new portalQueries module. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!allowed?.length) { | ||
| return requested ? [...requested] : undefined; | ||
| } | ||
|
|
||
| if (!requested?.length) { |
There was a problem hiding this comment.
clampEnumValues returns allowed values directly (and casts them to T[]) when the request omits that filter. Because allowedMortgageTypes / allowedPropertyTypes are stored as string[] in the DB schema, invalid values can propagate into effectiveFilters without validation. Consider sanitizing allowed against the known marketplace enums before returning it.
| const min = Math.max( | ||
| requested?.min ?? allowed?.min ?? Number.NEGATIVE_INFINITY, | ||
| allowed?.min ?? Number.NEGATIVE_INFINITY | ||
| ); | ||
| const max = Math.min( | ||
| requested?.max ?? allowed?.max ?? Number.POSITIVE_INFINITY, | ||
| allowed?.max ?? Number.POSITIVE_INFINITY | ||
| ); | ||
|
|
There was a problem hiding this comment.
With the current min = max(requested.min, allowed.min) / max = min(requested.max, allowed.max) approach, it’s possible to produce an inverted range (min > max) when the requested range falls entirely outside the allowed bounds. Since this value is returned in effectiveFilters, it can break client range UI. Consider clamping each endpoint into the allowed bounds (and/or collapsing to the nearest boundary) so the returned range always satisfies min <= max while still enforcing constraints.
| const min = Math.max( | |
| requested?.min ?? allowed?.min ?? Number.NEGATIVE_INFINITY, | |
| allowed?.min ?? Number.NEGATIVE_INFINITY | |
| ); | |
| const max = Math.min( | |
| requested?.max ?? allowed?.max ?? Number.POSITIVE_INFINITY, | |
| allowed?.max ?? Number.POSITIVE_INFINITY | |
| ); | |
| const allowedMin = allowed?.min ?? Number.NEGATIVE_INFINITY; | |
| const allowedMax = allowed?.max ?? Number.POSITIVE_INFINITY; | |
| let min = requested?.min ?? allowed?.min ?? Number.NEGATIVE_INFINITY; | |
| let max = requested?.max ?? allowed?.max ?? Number.POSITIVE_INFINITY; | |
| min = Math.min(Math.max(min, allowedMin), allowedMax); | |
| max = Math.min(Math.max(max, allowedMin), allowedMax); | |
| if (min > max) { | |
| if (requested?.min !== undefined && requested.min > allowedMax) { | |
| min = allowedMax; | |
| max = allowedMax; | |
| } else if (requested?.max !== undefined && requested.max < allowedMin) { | |
| min = allowedMin; | |
| max = allowedMin; | |
| } else { | |
| max = min; | |
| } | |
| } |
… base. Backend now exposes explicit portal listing contracts in convex/listings/portalQueries.ts, backed by shared pricing-aware snapshot helpers in convex/listings/marketplace.ts and convex/listings/queries.ts. On the frontend, the new surfaces now consume root portalContext instead of reparsing hosts: src/routes/index.tsx renders public teaser listings, src/routes/lender.listings.tsx renders the authenticated lender list, and src/components/lender/listings/LenderListingDetailPage.tsx now reads through TanStack Query via src/components/listings/portal-query-options.ts.
599134d to
e61d4c0
Compare
4a1baab to
5b7cc7a
Compare

No description provided.