Skip to content

Evaluate Trader results with bench craft potential - #10164

Open
mcagnion wants to merge 11 commits into
PathOfBuildingCommunity:devfrom
mcagnion:feature/bench-craft-eval-port
Open

Evaluate Trader results with bench craft potential#10164
mcagnion wants to merge 11 commits into
PathOfBuildingCommunity:devfrom
mcagnion:feature/bench-craft-eval-port

Conversation

@mcagnion

@mcagnion mcagnion commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #5437.

Description of the problem being solved:

Trader ranks items as they are listed on the trade site. A rare item with an open prefix or suffix, or an item with a replaceable crafted modifier, can therefore appear below a less promising item even when a simple bench craft would make it the better upgrade.

This adds an opt-in Bench Craft option to Trade Query Options. For generated queries, PoB adds an exactly-one-empty-affix pseudo-stat weighted from the compatible bench craft with the highest estimated query weight for the item type. For each fetched item, it fully evaluates the highest-level craft in each compatible local group and at most one positive highest-estimated compatible non-local craft, then selects the best calculated outcome from that bounded set. It does not exhaustively compare every compatible craft, so modifier interactions and breakpoints can occasionally make another non-local craft better. Pasted queries, or results whose selected weights changed after the search, evaluate all highest-level legal craft candidates. Result evaluation yields between build calculations so that fallback remains responsive.

The selected craft can fill an open prefix or suffix, or replace exactly one existing crafted modifier when the calculated result is an improvement. Items with multiple crafted modifiers are only considered for additions; their existing crafts are never replaced.

The result tooltip shows the selected craft or replacement, and holding Ctrl previews the simulated item with the new lines marked [Craft]. The generated weighted query uses the empty-affix pseudo-stat to influence which listings the Trade API returns; the post-fetch evaluation then reranks those listings. The simulated craft never replaces the original listing text used for import.

Steps taken to verify a working solution:

  • Added focused coverage for affix identity and capacity, item-type restrictions, modifier conflicts, single-crafted-mod replacements, multi-line crafts, Catalyst modifiers, multiple crafted modifier limits, corrupted and mirrored items, immutable query-weight snapshots, bounded candidate selection, exact fallback behavior, preview rolls, tooltip lifecycle, and preservation of the original result string used for import.
  • Ran the full automated test suite.
  • Compared the same fetched listings with Bench Craft disabled and enabled, verified the changed order, tested a crafted-mod replacement, and checked the exact Ctrl preview in the UI.
  • Replayed ten fixed listings on a saved complex build after one warm-up. Across five runs, the exhaustive fallback used 1,230 build calculations and a median of 4.98 s (4.87–5.10 s); the generated-query path used 20 calculations and a median of 0.67 s (0.65–0.69 s). Network time was excluded.

Link to a build that showcases this PR:

No specific build is required. The behavior can be reproduced with an equipment search that returns a rare item with an open affix or one replaceable crafted modifier.

Before screenshot:

Trader results without Bench Craft evaluation

After screenshot — open affix:

Trader results reranked with Bench Craft and Ctrl preview

After screenshot — crafted modifier replacement:

Trader result with a better bench craft replacement and Ctrl comparison

Query Options:

Bench Craft option in Trade Query Options

Notes:

  • The calculation is opt-in and disabled by default.
  • Generated queries fully evaluate the highest-level craft in each compatible local group plus at most one positive highest-estimated non-local craft per item. This bounded selection deliberately trades exhaustive certainty for fewer build calculations.
  • Pasted queries and stale weight snapshots evaluate all highest-level legal craft candidates. This path may take longer, but advances cooperatively without blocking the interface.

@mcagnion
mcagnion marked this pull request as ready for review August 7, 2026 17:08
@mcagnion
mcagnion marked this pull request as draft August 8, 2026 16:05
@mcagnion
mcagnion force-pushed the feature/bench-craft-eval-port branch from 168bce4 to 26ab984 Compare August 12, 2026 22:01
@mcagnion
mcagnion force-pushed the feature/bench-craft-eval-port branch from 26ab984 to 1e8c273 Compare August 21, 2026 23:01
Use Trade affix metadata to track empty prefix and suffix slots separately,
then locally rerank fetched results with the best legal bench craft.

Show the exact simulated item while Ctrl is held without changing the item
imported from the listing.
Make the tooltip explicit that bench craft potential sorts fetched results locally. Align the bench craft tests with the same evaluation vocabulary and the existing flask modifier group name.
Allow a single standard crafted modifier to be removed in the simulation before testing legal replacements. Multicraft items continue to support additions only.
Attach immutable query weights to fetched results and use them to evaluate
only the highest-weight legal bench craft. Keep an exact exhaustive fallback
when weights are absent or stale.
Evaluate fetched items cooperatively across frames and keep fetch identity separate from presentation state. This prevents stale searches, re-sorts, and action tooltips from publishing or reading obsolete results.
Own query-derived weights once per result row, reuse Item magnitude scaling, and evaluate a bounded set of legal candidates. Keep the generated empty-affix filter in the same priority ordering as regular weighted filters.
Reduce duplicated test setup while preserving the full behavior matrix and extending the Trade API fixture through crafted-affix reconstruction and replacement.
Distinguish Trade API records, stripped items, and numeric affix counts from similarly named production shapes.
@mcagnion
mcagnion force-pushed the feature/bench-craft-eval-port branch from 1e8c273 to 6afb95b Compare August 26, 2026 18:12
Describe the user-visible effect without promising a globally optimal craft selection.
@mcagnion
mcagnion marked this pull request as ready for review August 29, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Take into account potential of crafting when searching for better items in Trade

1 participant