Repository navigation
chore(devops): turn on no-floating-promises for src/server - #6101
Conversation
|
/ready |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe server TypeScript lint configuration now treats floating promises as errors. Several server call sites explicitly discard promises, and ChangesServer promise handling
Priority: ⚪ Not assessed Estimated code review effort: 2 (Simple) | ~10 minutes Change: Other Suggested labels: Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
🤖 Claude Code ReviewVerdict: Looks good — 0 findings (0 high, 0 medium, 0 low). No issues found. Checked for bugs and CLAUDE.md compliance.
|
) ## Description: Follow-up to openfrontio#6101. That one turned on `typescript/no-floating-promises` for src/server only and left the client for later. This finishes it: the rule now covers the whole repo, and the src/server override is gone. Most of the 167 hits were Lit event handlers and other fire-and-forget calls (`putGameConfig()`, the clan `loadX()` calls, `gamePortal.*`, `updateComplete.then(...)`), plus a few `trigger("close")` calls in server tests. Those only get `void`, so runtime behavior stays the same. It's a big diff (51 files), but nearly every line is the same one-word change. I found one real bug. `HomepagePromos.close()` and `InGamePromo.hideAd()` called `window.ramp.destroyUnits()` inside a try/catch without awaiting it. `destroyUnits` returns a promise, so the catch only saw sync throws. A rejection skipped the warning and became an unhandled rejection, and the "successfully destroyed" line was logged before the destroy had finished. Both now use `Promise.all(...).then(log).catch(warn)`, the same pattern `destroyBottomRailUnit` already uses in that file. Heads-up: - `void` is still the quickest way to make the rule go quiet. If a failure matters to the caller, please use `await` or `.catch()` instead. Keep `void` for calls that really are fire-and-forget. - A failed ad destroy now logs a `console.warn` instead of an unhandled rejection, so it might show up a little differently in telemetry. ## Please complete the following: - [ ] I have added screenshots for all UI updates - [ ] I process any text displayed to the user through translateText() and I've added it to the en.json file - [ ] I have added relevant tests to the test directory ## Please put your Discord username so you can be contacted if a bug or regression is found: wraith4081
Description:
Turns on typescript/no-floating-promises for src/server only. The client has 162 hits across 47 files (mostly Lit event handlers) and the engine has none, so this starts where a dropped promise matters most and the count is small: 4 hits.
One of them was a real mistake. GameManager wrapped
game.end()in try/catch, butend()is async, so the catch never ran. A failure there skipped the "error ending game " log and only reached the worker's generic unhandledRejection handler, without the game ID. It now uses.catch().The other three are fire-and-forget on purpose and just get
void:archive(), which handles its own failures (Archive.ts)privilegeRefresher.start()in WorkerHeads-up:
void. In server code, preferawaitor.catch()with a log whenever the caller would want to know about a failure;voidis only for genuine fire-and-forget.Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
wraith4081