[PR #6603] [MERGED] Merchant parity cases: the exact restock gaps and the trade price floor #6975

Closed
opened 2026-11-03 06:30:31 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6603
Author: @MSedgeMC
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/merchant-restock-cases


📝 Commits (1)

  • dd84588 Merchant parity cases: the exact restock gaps and the trade price floor

📊 Changes

1 file changed (+14 additions, -0 deletions)

View changed files

📝 tools/test_trading_parity.py (+14 -0)

📄 Description

Vanilla's Villager.shouldRestock allows the second restock of a day only once more than 2400 ticks have passed since the last one, never a third, and starts a new day only after more than 12000 ticks (or when the day counter moves past the one it last checked); and MerchantOffer.getModifiedCostCount clamps a discounted price at one item, so a major-positive reputation with Hero of the Village cannot take the cheapest offers below one.

Horizon matches vanilla on all of these; the random restock and price batches never landed on the 2400 and 12000 tick boundaries themselves, on two restocks today followed by a check before the day turns, or on the cheapest offers under a maximum reputation with Hero of the Village, so those states were unpinned - this adds the five cases.

Proven: on the build VM, cd ~/.wt/trade1 && python3 tools/parity.py trading → PASS trading, 1 passed 0 failed, with the five new cases in the run.

Not proven: the in-game trade screen for those prices (the case drives updateSpecialPrices and shouldRestock/restock directly, as the rest of the harness does).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/6603 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/merchant-restock-cases` --- ### 📝 Commits (1) - [`dd84588`](https://github.com/horizon-rust/horizon/commit/dd84588b5352b3784aa2889738d179856c99a0bc) Merchant parity cases: the exact restock gaps and the trade price floor ### 📊 Changes **1 file changed** (+14 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tools/test_trading_parity.py` (+14 -0) </details> ### 📄 Description Vanilla's `Villager.shouldRestock` allows the second restock of a day only once more than 2400 ticks have passed since the last one, never a third, and starts a new day only after more than 12000 ticks (or when the day counter moves past the one it last checked); and `MerchantOffer.getModifiedCostCount` clamps a discounted price at one item, so a major-positive reputation with Hero of the Village cannot take the cheapest offers below one. Horizon matches vanilla on all of these; the random restock and price batches never landed on the 2400 and 12000 tick boundaries themselves, on two restocks today followed by a check before the day turns, or on the cheapest offers under a maximum reputation with Hero of the Village, so those states were unpinned - this adds the five cases. **Proven:** on the build VM, `cd ~/.wt/trade1 && python3 tools/parity.py trading` → `PASS trading`, 1 passed 0 failed, with the five new cases in the run. **Not proven:** the in-game trade screen for those prices (the case drives `updateSpecialPrices` and `shouldRestock`/`restock` directly, as the rest of the harness does). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:30:31 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6975
No description provided.