Skip to content

Add persistent shop ignore list and wire it into API and UI - #3

Open
GoodrichDev wants to merge 1 commit into
masterfrom
codex/add-ability-to-ignore-shops-by-uuid-or-player-name
Open

GoodrichDev wants to merge 1 commit into
masterfrom
codex/add-ability-to-ignore-shops-by-uuid-or-player-name

Conversation

@GoodrichDev

Copy link
Copy Markdown
Member

Motivation

  • Provide a persistent, server-side place to list shop owners to ignore so temporary UI/query filters are not the only option.
  • Allow both UUIDs and player names to be used for ignoring owners and apply those ignores consistently across shop-related APIs.
  • Make it obvious to operators where to edit persistent ignores by showing the file path in the Shops UI.

Description

  • Added a new config file config/shop-ignore-list.json that supports ownerUuids and ownerNames arrays for persistent ignores.
  • Implemented server-side loading and normalization with loadStaticShopIgnoreList, normalizeUuid, normalizePlayerName, normalizeStringArray, and merged static ignores with request query filters in parseIgnoreOwnerFilters.
  • Added buildOwnerIgnoreSql to produce SQL fragments and parameters and applied the resulting ignore filters to relevant endpoints (popularStacks, stacks, stackProfile, stackListings, stackStats, stackHistory, and tradeRoutes).
  • Updated the Shops UI (public/shops.html) to display the persistent file path, provide owner-ignore inputs, and append ignore query params to API calls via applyOwnerIgnoreParams and normalizedCsv so UI filters and the persistent list are both respected.

Testing

  • Ran node --check api/routes/shops.js and it succeeded without syntax errors.
  • Ran node --check site.js and it succeeded without syntax errors.
  • Started the site with npm run site which 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

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

Comment thread api/routes/shops.js
Comment on lines 848 to +851
WHERE seller.rn = 1
AND (buyer.price_per_item - seller.price_per_item) >= ?
${sellerIgnoreFilter.sql}
${buyerIgnoreFilter.sql}

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

Comment thread api/routes/shops.js
Comment on lines +39 to +40
const raw = fs.readFileSync(SHOP_IGNORE_LIST_PATH, 'utf8');
const parsed = JSON.parse(raw);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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