[PR #7585] [MERGED] port_map: the suggestion provider's budget, newest request and 1000 cap #7692

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

📋 Pull Request Information

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

Base: main ← Head: port-map/suggest-provider-rows


📝 Commits (1)

  • b17870d port_map: the suggestion provider's budget, newest request and 1000 cap

📊 Changes

1 file changed (+3 additions, -3 deletions)

View changed files

📝 tools/port_map/rest-017.tsv (+3 -3)

📄 Description

Three rows in tools/port_map/rest-017.tsv describe ServerCommandSuggestionsProvider
as it stood before the class was ported. Its behaviour landed afterwards, in
crates/horizon-client/src/game/lan_actions.rs, and the ledger still tells a
reader that Horizon has no per-tick budget, no cap and no coalescing.

Vanilla (the bytecode the rows describe)

  • ServerCommandSuggestionsProvider.tick refills the answer budget every tick of
    the player (tickCount % 1) and then calls tryProcessRequest, which answers
    at most one request per tick and clears the budget.
  • limitSuggestionCount returns the list untouched up to 1000 entries and
    otherwise a Suggestions of getList().subList(0, 1000) with the same range.
  • request stores the text in lastRequest and only schedules when the previous
    slot was empty, so a newer request replaces an unanswered one; tryProcessRequest
    bails out when a newer one arrived.

Horizon, as it is now

  • Game::guest_try_suggestions (lan_actions.rs) returns unless
    play.suggestion_budget, and clears it when it answers; the per-guest server
    tick sets play.suggestion_budget = true next to the chat and command
    throttler decay, then calls it — the budget and the one-answer-per-tick rule.
  • Game::guest_suggestions ends with suggestions.truncate(1000) under a
    ServerCommandSuggestionsProvider.limitSuggestionCount comment.
  • play.suggestion is a single Option: the packet arm stores the payload with
    host.play.entry(conn).or_default().suggestion = Some(payload) and the tick
    take()s it, so the newest text wins and a request behind it is dropped.

The rows now say port and name those functions; tick also stops being marked
inline into guest_suggestions, the function that parses and suggests.

Proven: git log -S on the tree: 6893bcff8 "Cap server command suggestions
at 1000" and b9f8ea2f2 "Server: answer one command suggestion request a tick,
the latest (ServerCommandSuggestionsProvider)" both landed in lan_actions.rs
after the rows were written; grep -n 'suggestion_budget\|truncate(1000)' crates/horizon-client/src/game/lan_actions.rs shows the three behaviours the rows
called missing or absent.

Not proven: nothing here changes behaviour, so no test was added; the rows cite
functions that exist in lan_actions.rs (guest_try_suggestions,
guest_suggestions) and map-check cannot run here (no ledger built in the
worktree).


🔄 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/7585 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `port-map/suggest-provider-rows` --- ### 📝 Commits (1) - [`b17870d`](https://github.com/horizon-rust/horizon/commit/b17870dbf59fb65111e4ac85a2b4a9f3e9439ada) port_map: the suggestion provider's budget, newest request and 1000 cap ### 📊 Changes **1 file changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tools/port_map/rest-017.tsv` (+3 -3) </details> ### 📄 Description Three rows in `tools/port_map/rest-017.tsv` describe `ServerCommandSuggestionsProvider` as it stood before the class was ported. Its behaviour landed afterwards, in `crates/horizon-client/src/game/lan_actions.rs`, and the ledger still tells a reader that Horizon has no per-tick budget, no cap and no coalescing. ### Vanilla (the bytecode the rows describe) * `ServerCommandSuggestionsProvider.tick` refills the answer budget every tick of the player (`tickCount % 1`) and then calls `tryProcessRequest`, which answers at most one request per tick and clears the budget. * `limitSuggestionCount` returns the list untouched up to 1000 entries and otherwise a `Suggestions` of `getList().subList(0, 1000)` with the same range. * `request` stores the text in `lastRequest` and only schedules when the previous slot was empty, so a newer request replaces an unanswered one; `tryProcessRequest` bails out when a newer one arrived. ### Horizon, as it is now * `Game::guest_try_suggestions` (`lan_actions.rs`) returns unless `play.suggestion_budget`, and clears it when it answers; the per-guest server tick sets `play.suggestion_budget = true` next to the chat and command throttler decay, then calls it — the budget and the one-answer-per-tick rule. * `Game::guest_suggestions` ends with `suggestions.truncate(1000)` under a `ServerCommandSuggestionsProvider.limitSuggestionCount` comment. * `play.suggestion` is a single `Option`: the packet arm stores the payload with `host.play.entry(conn).or_default().suggestion = Some(payload)` and the tick `take()`s it, so the newest text wins and a request behind it is dropped. The rows now say `port` and name those functions; `tick` also stops being marked `inline` into `guest_suggestions`, the function that parses and suggests. **Proven:** `git log -S` on the tree: `6893bcff8` "Cap server command suggestions at 1000" and `b9f8ea2f2` "Server: answer one command suggestion request a tick, the latest (ServerCommandSuggestionsProvider)" both landed in `lan_actions.rs` after the rows were written; `grep -n 'suggestion_budget\|truncate(1000)' crates/horizon-client/src/game/lan_actions.rs` shows the three behaviours the rows called missing or absent. **Not proven:** nothing here changes behaviour, so no test was added; the rows cite functions that exist in `lan_actions.rs` (`guest_try_suggestions`, `guest_suggestions`) and `map-check` cannot run here (no ledger built in the worktree). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:22:06 +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#7692
No description provided.