fix(vinpin): fail-safe stray-app close — never terminate a row on an unreadable name
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled

Review finding: closeStrayRunningApps classified an unreadable/empty VinPower
running-app row as a stray and closed it (`/VinPower/i.test('')` is false),
needlessly killing+relaunching a healthy VinPower on a transient name-read miss.
Only close rows POSITIVELY identified as non-VinPower (non-empty name that fails
the VinPower match); treat unreadable names as keep.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-15 09:48:48 +03:00
parent 814d11d03e
commit cf36da07af

View File

@@ -1094,8 +1094,14 @@ export class VinpinDriverService implements OnModuleDestroy {
apps.map(async (handle) => ({ handle, name: await this.runningAppName(handle) })),
);
if (named.some((n) => VINPIN_DOM.vinPowerAppName.test(n.name))) sawVinPower = true;
const stray = named.find((n) => !VINPIN_DOM.vinPowerAppName.test(n.name));
if (!stray) break; // only VinPower (or nothing) remains
// Fail-safe: only close a row that is POSITIVELY a non-VinPower app (name
// reads non-empty AND doesn't match VinPower). An unreadable/empty name is
// treated as "keep" — never terminate a row on a transient name-read miss,
// which would otherwise kill a healthy VinPower and force a relaunch.
const stray = named.find(
(n) => n.name.trim() !== "" && !VINPIN_DOM.vinPowerAppName.test(n.name),
);
if (!stray) break; // only VinPower / unreadable / nothing remains
this.logger.log(
`closing stray RDS app "${stray.name || "(unnamed)"}" via the Running panel ✕`,
);