Skip to content

Commit e969486

Browse files
CopilotMrAlders0n
andcommitted
Standardize disconnect messages with "Disconnected: " prefix
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
1 parent d280c28 commit e969486

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

STATUS_MESSAGES.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,23 @@ Status messages follow these consistent conventions:
9191
- **Context**: When connecting to device and checking if a wardriving slot is available
9292
- **Minimum Visibility**: 500ms minimum enforced (or until API response received)
9393

94-
#### WarDriving app has reached capacity
95-
- **Message**: `"WarDriving app has reached capacity"`
94+
#### Disconnected: WarDriving app has reached capacity
95+
- **Message**: `"Disconnected: WarDriving app has reached capacity"`
9696
- **Color**: Red (error)
9797
- **Used in**: `checkCapacity()`, `postToMeshMapperAPI()`
98-
- **Source**: `content/wardrive.js:1061`, `content/wardrive.js:1116`
98+
- **Source**: `content/wardrive.js:1063`, `content/wardrive.js:1120`
9999
- **Context**: Capacity check API denies slot on connect (returns allowed=false), or wardriving API returns allowed=false during active session
100100
- **Minimum Visibility**: N/A (error state persists; message is preserved during automatic disconnect)
101-
- **Notes**: Displayed when the API successfully responds but indicates capacity is full. When this error occurs during connection, the automatic disconnect flow preserves this status message instead of showing "Disconnected"
101+
- **Notes**: Displayed when the API successfully responds but indicates capacity is full. When this error occurs during connection, the automatic disconnect flow preserves this status message instead of showing "Disconnected". Message format standardized with "Disconnected: " prefix to clearly indicate disconnect state.
102102

103-
#### WarDriving app is down
104-
- **Message**: `"WarDriving app is down"`
103+
#### Disconnected: WarDriving app is down
104+
- **Message**: `"Disconnected: WarDriving app is down"`
105105
- **Color**: Red (error)
106106
- **Used in**: `checkCapacity()`
107-
- **Source**: `content/wardrive.js:1050`, `content/wardrive.js:1072`
107+
- **Source**: `content/wardrive.js:1050`, `content/wardrive.js:1074`
108108
- **Context**: Capacity check API returns error status or network is unreachable during connect
109109
- **Minimum Visibility**: N/A (error state persists; message is preserved during automatic disconnect)
110-
- **Notes**: Implements fail-closed policy - connection is denied if API fails or is unreachable. When this error occurs, the automatic disconnect flow preserves this status message instead of showing "Disconnected"
110+
- **Notes**: Implements fail-closed policy - connection is denied if API fails or is unreachable. When this error occurs, the automatic disconnect flow preserves this status message instead of showing "Disconnected". Message format standardized with "Disconnected: " prefix to clearly indicate disconnect state.
111111

112112
#### Unable to read device public key; try again
113113
- **Message**: `"Unable to read device public key; try again"`

content/wardrive.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ async function checkCapacity(reason) {
10481048
// Fail closed on network errors for connect
10491049
if (reason === "connect") {
10501050
debugError("Failing closed (denying connection) due to API error");
1051-
setStatus("WarDriving app is down", STATUS_COLORS.error);
1051+
setStatus("Disconnected: WarDriving app is down", STATUS_COLORS.error);
10521052
state.disconnectReason = "app_down"; // Track disconnect reason
10531053
return false;
10541054
}
@@ -1060,7 +1060,7 @@ async function checkCapacity(reason) {
10601060

10611061
// Handle capacity full vs. allowed cases separately
10621062
if (data.allowed === false && reason === "connect") {
1063-
setStatus("WarDriving app has reached capacity", STATUS_COLORS.error);
1063+
setStatus("Disconnected: WarDriving app has reached capacity", STATUS_COLORS.error);
10641064
state.disconnectReason = "capacity_full"; // Track disconnect reason
10651065
}
10661066

@@ -1072,7 +1072,7 @@ async function checkCapacity(reason) {
10721072
// Fail closed on network errors for connect
10731073
if (reason === "connect") {
10741074
debugError("Failing closed (denying connection) due to network error");
1075-
setStatus("WarDriving app is down", STATUS_COLORS.error);
1075+
setStatus("Disconnected: WarDriving app is down", STATUS_COLORS.error);
10761076
state.disconnectReason = "app_down"; // Track disconnect reason
10771077
return false;
10781078
}
@@ -1117,7 +1117,8 @@ async function postToMeshMapperAPI(lat, lon, heardRepeats) {
11171117
const data = await response.json();
11181118
if (data.allowed === false) {
11191119
debugWarn("MeshMapper API returned allowed=false, disconnecting");
1120-
setStatus("WarDriving app has reached capacity", STATUS_COLORS.error);
1120+
setStatus("Disconnected: WarDriving app has reached capacity", STATUS_COLORS.error);
1121+
state.disconnectReason = "capacity_full"; // Track disconnect reason
11211122
// Disconnect after a brief delay to ensure user sees the message
11221123
setTimeout(() => {
11231124
disconnect().catch(err => debugError(`Disconnect after capacity denial failed: ${err.message}`));

0 commit comments

Comments
 (0)