Add persistent shop ignore list and wire it into API and UI - #3
GoodrichDev wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08fbb284ab
ℹ️ 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".
| WHERE seller.rn = 1 | ||
| AND (buyer.price_per_item - seller.price_per_item) >= ? | ||
| ${sellerIgnoreFilter.sql} | ||
| ${buyerIgnoreFilter.sql} |
There was a problem hiding this comment.
Apply owner ignores before trade-route ranking
The ignore predicates are appended in the outer WHERE after seller.rn = 1 / buyer.rn = 1, so if the top-ranked seller or buyer is ignored, the whole item is dropped instead of falling back to the next eligible shop. This makes /api/shops/tradeRoutes return incomplete results whenever ignored owners happen to hold rank 1 offers. Move the ignore filters into best_sellers/best_buyers (or rank after filtering) so row-number selection is based on already-filtered shops.
Useful? React with 👍 / 👎.
| const raw = fs.readFileSync(SHOP_IGNORE_LIST_PATH, 'utf8'); | ||
| const parsed = JSON.parse(raw); |
There was a problem hiding this comment.
Avoid synchronous file I/O in request-path filter parsing
loadStaticShopIgnoreList performs fs.readFileSync and JSON.parse every time a shop endpoint parses ignore filters, which puts blocking disk I/O directly on the Node request path. Because these endpoints are called frequently (and often in parallel from the UI), this can increase latency and reduce throughput under production load. Cache the parsed ignore list (with periodic refresh or mtime-based invalidation) instead of synchronously reading the file per request.
Useful? React with 👍 / 👎.
Motivation
Description
config/shop-ignore-list.jsonthat supportsownerUuidsandownerNamesarrays for persistent ignores.loadStaticShopIgnoreList,normalizeUuid,normalizePlayerName,normalizeStringArray, and merged static ignores with request query filters inparseIgnoreOwnerFilters.buildOwnerIgnoreSqlto produce SQL fragments and parameters and applied the resulting ignore filters to relevant endpoints (popularStacks,stacks,stackProfile,stackListings,stackStats,stackHistory, andtradeRoutes).public/shops.html) to display the persistent file path, provide owner-ignore inputs, and append ignore query params to API calls viaapplyOwnerIgnoreParamsandnormalizedCsvso UI filters and the persistent list are both respected.Testing
node --check api/routes/shops.jsand it succeeded without syntax errors.node --check site.jsand it succeeded without syntax errors.npm run sitewhich launched and served the Shops page and a screenshot was captured, but DB access was not available in this environment so DB-backed API calls failed with a network error; SQL injection of ignore params and code paths were exercised only to the extent possible without a live database.Codex Task