Repository navigation
fix(tests): isolate locale and device identity from host environment - #715
Conversation
FormatBytes used locale-sensitive interpolation ($"{val:F1}") which
produced commas instead of dots on systems with a non-English decimal
separator. Use ToString("F1", CultureInfo.InvariantCulture) so the
output is always dot-separated regardless of host locale.
OperatorConnect_FreshBootstrapDevice_StartsWithV2Signature and
OperatorConnect_SharedTokenDevice_StartsWithV3Signature passed null as
identityPath, causing the client to read the real device identity from
%APPDATA%\OpenClawTray on machines where the app is installed and
paired. On those machines _useV2Signature was computed from a live
device token, making the bootstrap assertion fail. Pass a fresh temp
directory so the tests start with no device state.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed June 7, 2026, 8:27 PM ET / 00:27 UTC. Summary Reproducibility: yes. from source inspection: ambient non-English CurrentCulture can change the F1 decimal separator, and a paired appdata identity is read during OpenClawGatewayClient construction before the tests clear the token. I did not execute the failing environments because this review was read-only. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow isolation fix after normal repository validation, keeping gateway credential precedence and device-token behavior unchanged. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: ambient non-English CurrentCulture can change the F1 decimal separator, and a paired appdata identity is read during OpenClawGatewayClient construction before the tests clear the token. I did not execute the failing environments because this review was read-only. Is this the best way to solve the issue? Yes: using invariant formatting matches existing dot-decimal assertions and local invariant-format precedent, and isolating identityPath before construction fixes constructor-time host state leakage. Reusing the existing CreateTempIdentityPath helper would be minor cleanup, not a correctness blocker. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 25c11dd07f09. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
What
Fixes two test isolation bugs that caused failures on machines with non-English locale or with the app installed and paired.
ChatAttachment.FormatBytes— locale-sensitive decimal separator$"{val:F1}"respects the host thread culture. On systems with a non-English decimal separator (e.g., Spanish locale uses comma), the output was"1,5 KB"instead of"1.5 KB". Fixed by usingToString("F1", CultureInfo.InvariantCulture).OpenClawGatewayClientsignature tests — device identity leaking from hostOperatorConnect_FreshBootstrapDevice_StartsWithV2SignatureandOperatorConnect_SharedTokenDevice_StartsWithV3SignaturepassednullasidentityPath, so the client read the real device identity from%APPDATA%\OpenClawTray. On machines where the app is installed and paired,_deviceIdentity.DeviceTokenis non-null during construction, which sets_useV2SignaturetofalsebeforeSetDeviceTokenForTest(null)is ever called. Fixed by passing a fresh temp directory so the tests start with no device state on disk.Testing
Both fixes verified locally. All 3 previously failing tests now pass. Full shared test suite: 2080/2080 passed.
Co-Authored-By: Claude Sonnet 4.6 [email protected]