Skip to content

fix(market-subgraph)!: hold Market.items to the 100-item batch cap and require Market.catalog's category - #30

Merged
Hebilicious merged 1 commit into
audit/throttle-and-budget-errorsfrom
audit/summary-and-catalog-limits
Oct 14, 2026
Merged

Hebilicious merged 1 commit into
audit/throttle-and-budget-errorsfrom
audit/summary-and-catalog-limits

Conversation

@Hebilicious

@Hebilicious Hebilicious commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Closes #10
Closes #11

What changed

  • S3 (Market.items(ids:) bypasses the 100-item summary batch cap #10):
    • MARKET_SUMMARY_BATCH_LIMIT and MarketSummaryBatchLimitError move into requestScopedMarketReader (market-reader.ts). It refuses a summary read over 100 distinct items before it reaches Pearl Abyss.
    • Market.items(ids:) and Item.marketSummary now share one rule and one QUERY_BUDGET_EXCEEDED error.
    • The error wrapper now sits outside the request-scoped reader so it can map that refusal.
  • S4 (Market.catalog without a category can never succeed (180 upstream calls against a 50 budget) #11):
    • Market.catalog(category:) is required in the schema, and its description says what a main category reads.
    • isPearlAbyssMarketCategory (pearl-abyss/protocol/categories.ts) turns an unknown category into a BAD_USER_INPUT error that names it, such as Unknown Central Market category: main 1, sub 99. Before, it was an internal error.
  • The schema artifacts are regenerated.
  • docs/api.md is updated.
  • New market-error-semantics scenarios, plus the two category rows of market-client-input-errors.

How it was reproduced

I ran this layer's market-error-semantics feature against the parent layer (audit/throttle-and-budget-errors):

Scenario On the parent
market-items-summary-batch-limit (101 IDs) fails: AssertionError: the answer has no errors. All 101 IDs went upstream in one batch
market-catalog-needs-category fails: the query is accepted and refused at run time with The query needs more Pearl Abyss requests than this deployment's subrequest limit allows…, not answered 400 as invalid for the schema. This is the 180-pair read against a 50-request budget
market-client-input-errors (category rows) fails: {"message":"The market subgraph could not answer this field.", … "code":"INTERNAL_SERVER_ERROR"} for main: 0, not BAD_USER_INPUT
market-items-summary-batch-at-limit (100 IDs) passes
every earlier scenario passes

Not reproduced

  • market-items-summary-batch-at-limit passes on the parent. It guards that exactly 100 IDs still go in one upstream request.
  • The audit's live observations against the demo were not repeated, because there is no live traffic:
    • 150 IDs answered in one upstream call;
    • catalog without a category answered 503.

Refs #21 (security audit tracking issue). Part of stack #42; review bottom-up, each layer shows only its own diff.

@changeset-bot

changeset-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2e17466

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Hebilicious
Hebilicious added this pull request to stack #37 October 13, 2026 20:10
@Hebilicious
Hebilicious force-pushed the audit/summary-and-catalog-limits branch from 97c5426 to b295480 Compare October 13, 2026 20:12
@Hebilicious
Hebilicious force-pushed the audit/summary-and-catalog-limits branch from b295480 to b41fab3 Compare October 14, 2026 06:04
@Hebilicious
Hebilicious removed this pull request from stack #37 October 14, 2026 06:05
@Hebilicious
Hebilicious added this pull request to stack #42 October 14, 2026 06:05
@Hebilicious Hebilicious changed the title Hold Market.items to the 100-item summary batch cap and require Market.catalog's category fix(market-subgraph)!: hold Market.items to the 100-item batch cap and require Market.catalog's category Oct 14, 2026
@Hebilicious
Hebilicious force-pushed the audit/summary-and-catalog-limits branch from b41fab3 to 5c2aad8 Compare October 14, 2026 06:10
@Hebilicious
Hebilicious force-pushed the audit/summary-and-catalog-limits branch from 5c2aad8 to 7de6340 Compare October 14, 2026 07:09
…d require Market.catalog's category

- S3: the 100-item cap was enforced only for Item.marketSummary, so one
  Market.items(ids:) argument could carry thousands of IDs into a single
  upstream search-list call. The request-scoped reader now refuses a
  summary read over MARKET_SUMMARY_BATCH_LIMIT distinct items before it
  reaches Pearl Abyss, so both fields share one rule and one
  QUERY_BUDGET_EXCEEDED error.
- S4: Market.catalog without a category needed 180 upstream calls against a
  50-call budget and could never succeed. Its category is now required in
  the schema, and isPearlAbyssMarketCategory turns an unknown category into
  BAD_USER_INPUT that names it instead of an internal error. The schema
  artifacts are regenerated.

market-error-semantics proves the cap at 101 and 100 items, the 400 for a
missing category, and the BAD_USER_INPUT for unknown ones; docs/api.md
says so.

Refs #10
Refs #11
@Hebilicious
Hebilicious force-pushed the audit/summary-and-catalog-limits branch from 7de6340 to 2e17466 Compare October 14, 2026 08:50
@Hebilicious
Hebilicious merged commit 5672fee into main Oct 14, 2026
6 checks passed
@Hebilicious
Hebilicious deleted the audit/summary-and-catalog-limits branch October 14, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant