fix(settings): connect to the decoder URL shown in the field
Connect now used the saved URL even after a new one was typed; typed decoder URLs are now saved first. Adds a browser test for saving a new decoder port and connecting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abed53fb32
commit
cdde070c1c
7 files changed
+76
-4
No files matched your search
@@ -8,6 +8,12 @@ The application version is maintained in `package.json` and displayed in the adm
|
||||
|
||||
No changes recorded yet.
|
||||
|
||||
## 1.39.2 - 2026-10-17
|
||||
|
||||
### Fixed
|
||||
|
||||
- Settings → Connection: **Connect now** connected to the previously *saved* decoder URL, even when the field showed a newly typed one, e.g. port 9443 typed but 9000 still saved. Typed decoder URLs are now saved first and then used.
|
||||
|
||||
## 1.39.1 - 2026-10-13
|
||||
|
||||
### Changed
|
||||
|
||||
+13
@@ -924,6 +924,19 @@ Verified 2026-10-11:
|
||||
- Open Practice shows "23L 0:15.833 -" with the best lap once.
|
||||
- 73 browser scenarios pass.
|
||||
|
||||
## Decoder URL on its own port (2026-10-17)
|
||||
|
||||
Reported by the user: AMMC runs as their own systemd service on port 9443, but RaceCore showed "Decoder offline" and the UI log still said 9000.
|
||||
|
||||
Checked:
|
||||
- The "AMMC WebSocket port 9000" and its log belong to Managed AMMC only (started 17:02, stopped 17:09). The decoder URL had been set to `:9000` by "Use server WS URL".
|
||||
- No code path changes the URL by itself.
|
||||
- A new browser test (`tests/browser_decoder_url.js`) types a new URL, saves and connects, and comes online on that port, so the app flow works. What remains on the user's side is reachability of port 9443 from the browser (firewall/UFW only opened 9000-9003 in the README).
|
||||
|
||||
- [x] Found while checking: "Connect now" used the saved URL even when the field showed a typed one. It now saves typed decoder URLs first. Covered by the same browser test (connects to the typed port without pressing Save).
|
||||
|
||||
Verified: 265 unit and 75 browser scenarios pass.
|
||||
|
||||
## Documentation maintenance
|
||||
|
||||
- [x] Update the architecture's module/dependency inventory as modules change.
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.39.1",
|
||||
"version": "1.39.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "rc-racecore",
|
||||
"version": "1.39.1",
|
||||
"version": "1.39.2",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^12.11.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.39.1",
|
||||
"version": "1.39.2",
|
||||
"private": true,
|
||||
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
||||
"engines": {
|
||||
|
||||
+10
-1
@@ -701,7 +701,16 @@ Erik Eriksson;654321;4WD;Associated;;</code></pre>
|
||||
renderView();
|
||||
});
|
||||
|
||||
document.getElementById("settingsConnect")?.addEventListener("click", connectDecoder);
|
||||
// Connect uses what the fields show: unsaved decoder URLs are saved first (connecting to the
|
||||
// previously saved port while the field said another one was confusing).
|
||||
document.getElementById("settingsConnect")?.addEventListener("click", () => {
|
||||
const formNode = document.getElementById("settingsForm");
|
||||
const typed = formNode ? new FormData(formNode) : null;
|
||||
const changed = typed && ["wsUrl", "splitWsUrl", "pitEntryWsUrl", "pitExitWsUrl"]
|
||||
.some((name) => typed.has(name) && String(typed.get(name) || "").trim() !== String(state.settings[name] || ""));
|
||||
if (changed) formNode.requestSubmit();
|
||||
connectDecoder();
|
||||
});
|
||||
document.getElementById("settingsUseCurrentOrigin")?.addEventListener("click", () => {
|
||||
state.settings.backendUrl = pageOrigin;
|
||||
saveState();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { startFakeDecoder } from "./browser_fake_decoder.js";
|
||||
|
||||
// A user running AMMC themselves on another port: type the new WebSocket URL in Settings ->
|
||||
// Connection, press Save, then Connect now - the decoder must come online on that port.
|
||||
export async function runDecoderUrlSmoke({ evaluate, navigate, savedState, waitFor, base }) {
|
||||
const decoder = await startFakeDecoder();
|
||||
const before = await savedState();
|
||||
try {
|
||||
await navigate("settings", "settingsForm");
|
||||
await evaluate(`document.querySelector('[data-settings-tab="connection"]').click()`);
|
||||
const url = `ws://127.0.0.1:${decoder.port}`;
|
||||
await evaluate(`(() => {
|
||||
const input = document.querySelector('#settingsForm [name="wsUrl"]');
|
||||
input.value = ${JSON.stringify(url)};
|
||||
input.dispatchEvent(new Event("input", { bubbles: true }));
|
||||
input.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
document.querySelector('#settingsForm button[type="submit"]').click();
|
||||
})()`);
|
||||
await waitFor(async () => (await savedState()).settings.wsUrl === url, "the new WebSocket URL is saved");
|
||||
await evaluate(`document.getElementById("settingsConnect").click()`);
|
||||
await waitFor(async () => evaluate('document.getElementById("connectionBadge")?.classList.contains("badge-online")'), "decoder online on the new port");
|
||||
assert.equal(await evaluate(`document.querySelector('#settingsForm [name="wsUrl"]').value`), url, "the field still shows the new URL after the re-render");
|
||||
console.log("PASS typing a new decoder WebSocket URL, Save and Connect now connects on that port");
|
||||
|
||||
// Typing a URL and pressing Connect now without Save: the typed URL is saved and used.
|
||||
const second = await startFakeDecoder();
|
||||
try {
|
||||
const secondUrl = `ws://127.0.0.1:${second.port}`;
|
||||
await evaluate(`(() => { const input = document.querySelector('#settingsForm [name="wsUrl"]'); input.value = ${JSON.stringify(secondUrl)}; document.getElementById("settingsConnect").click(); })()`);
|
||||
await waitFor(async () => (await savedState()).settings.wsUrl === secondUrl, "the typed URL is saved by Connect now");
|
||||
await waitFor(async () => second.totalConnections() > 0, "connected to the typed port");
|
||||
console.log("PASS Connect now uses the URL in the field even without pressing Save");
|
||||
} finally {
|
||||
await second.close();
|
||||
}
|
||||
} finally {
|
||||
const current = await savedState();
|
||||
await fetch(base + "/api/state", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ ...current, settings: { ...current.settings, wsUrl: before.settings.wsUrl, autoReconnect: false } }) });
|
||||
await decoder.close();
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import { runCorrectionsScopeSmoke } from "./browser_corrections_scope.js";
|
||||
import { runDriversPageSmoke } from "./browser_drivers_page.js";
|
||||
import { runSeriesSmoke } from "./browser_series.js";
|
||||
import { runTrainingSourceSmoke } from "./browser_training_source.js";
|
||||
import { runDecoderUrlSmoke } from "./browser_decoder_url.js";
|
||||
import { runObsPopupSmoke } from "./browser_obs_popup.js";
|
||||
import { runDecoderReconnectSmoke } from "./browser_decoder_reconnect.js";
|
||||
import assert from "node:assert/strict";
|
||||
@@ -164,6 +165,7 @@ try {
|
||||
await runDriversPageSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
await runSeriesSmoke({ evaluate, navigate, savedState, waitFor, base, dialogs });
|
||||
await runTrainingSourceSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
await runDecoderUrlSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
await runRaceDaySmoke({ evaluate, navigate, fill, savedState, waitFor, pause, base, dialogs });
|
||||
await runRaceDayStartSequencesSmoke({ evaluate, navigate, waitFor, pause, base, dialogs });
|
||||
await runObsPopupSmoke({ evaluate, navigate, fill, savedState, waitFor, pause, base, debugPort, dialogs, realClick });
|
||||
|
||||
Reference in new issue
Block a user