Skip to content

Commit 68fe94e

Browse files
committed
fix(gui): say why the bulk loop is serial, where the linter will read it
React Doctor blocked the push on `async-await-in-loop`, suggesting `Promise.all`. Taking that suggestion would corrupt state: the server's single-flight guard is keyed per client, so it does not serialize across different ones, and writeRecord/deleteRecord read-modify-write a shared records.json with no lock. Six concurrent disables interleave those writes and drop an ownership record — the proof that a block is ours — after which the next disable refuses as `unowned-key` and the block is stranded in the user's config with nothing claiming it. Six loopback requests are cheap; a lost ownership record is not. Suppressed with the tool's own inline directive on the single line, with the reasoning in a block comment above it rather than in the config, so the next person who reads this loop learns why before they try to speed it up. Verified narrow: --no-respect-inline-disables still reports exactly this one finding.
1 parent 8bf7c50 commit 68fe94e

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎gui/src/pages/integrations/IntegrationsOverview.tsx‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,22 @@ export default function IntegrationsOverview({
100100
setBulkPending(true);
101101
setBulkResult(null);
102102
const failed: string[] = [];
103+
/*
104+
* Sequential ON PURPOSE — do not convert this to `Promise.all`.
105+
*
106+
* The server's single-flight guard is keyed per client, so it does not
107+
* serialize across different ones, and `writeRecord`/`deleteRecord`
108+
* read-modify-write a SHARED records.json with no lock. Firing six
109+
* disables together interleaves those writes and drops an ownership
110+
* record, which loses the proof that a block is ours — the next disable
111+
* then refuses as `unowned-key` and the block is stranded in the user's
112+
* config with nothing claiming it.
113+
*
114+
* Six loopback requests are cheap; a lost ownership record is not.
115+
*/
103116
for (const client of appliedClients) {
104117
try {
118+
// react-doctor-disable-next-line react-doctor/async-await-in-loop -- serial on purpose; see the block comment above
105119
await toggleIntegration(apiBase, client.clientId, false);
106120
} catch (error) {
107121
// Report which clients survived rather than a single opaque failure:

0 commit comments

Comments
 (0)