5.1 KiB
Daemon ADA Testing Tools - Critical Bug Fix
Date: 2025-10-02
Issue: All new ADA accessibility testing tools failing with JSON parsing error
Status: ✅ FIXED
Problem Description
All newly implemented ADA testing tools were failing with the error:
failed to parse results: invalid character 'm' looking for beginning of value
Root Cause
The functions were using jsResult.Value.String() which returns Go's string representation of objects (like "map[key:value]") instead of JSON. The correct approach is to either:
- Use
jsResult.Value.Str()for string values - Use
jsResult.Value.Map()for object values - Have JavaScript return
JSON.stringify(result)and then use.Value.Str()
Functions Fixed
1. checkContrast (daemon/daemon.go:8889)
Change: Modified JavaScript to return JSON.stringify(results) instead of results
Change: Modified parsing from .Value.String() to .Value.Str()
// Before:
return results;
resultsJSON := jsResult.Value.String()
// After:
return JSON.stringify(results);
resultsJSON := jsResult.Value.Str()
2. testKeyboardNavigation (daemon/daemon.go:9170)
Change: Modified JavaScript to return JSON.stringify(results) instead of results
Change: Modified parsing from .Value.String() to .Value.Str()
// Before:
return results;
resultsJSON := jsResult.Value.String()
// After:
return JSON.stringify(results);
resultsJSON := jsResult.Value.Str()
3. testZoom (daemon/daemon.go:9373)
Change: Modified JavaScript to return JSON.stringify(result) instead of object
Change: Modified parsing from .Value.String() to .Value.Str()
// Before:
return {
viewport_width: window.innerWidth,
...
};
err = json.Unmarshal([]byte(jsResult.Value.String()), &zoomTest)
// After:
return JSON.stringify({
viewport_width: window.innerWidth,
...
});
err = json.Unmarshal([]byte(jsResult.Value.Str()), &zoomTest)
4. testReflow (daemon/daemon.go:9622)
Change: Modified JavaScript to return JSON.stringify(...) instead of object
Change: Modified parsing from .Value.String() to .Value.Str()
// Before:
return {
width: window.innerWidth,
...
};
err = json.Unmarshal([]byte(jsResult.Value.String()), &breakpoint)
// After:
return JSON.stringify({
width: window.innerWidth,
...
});
err = json.Unmarshal([]byte(jsResult.Value.Str()), &breakpoint)
5. runAxeCore (daemon/daemon.go:8673)
Change: Modified to use async/await for Promise handling and stringify results
Change: Modified parsing from .Value.String() to .Value.Str()
// Before:
runCode := fmt.Sprintf(`() => {
return axe.run(%s);
}`, optionsJSON)
resultsJSON := jsResult.Value.String()
// After:
runCode := fmt.Sprintf(`async () => {
const results = await axe.run(%s);
return JSON.stringify(results);
}`, optionsJSON)
resultsJSON := jsResult.Value.Str()
Note: axe.run() returns a Promise, so we needed to add async/await handling.
Testing Required
After rebuilding and redeploying the daemon, test each function:
-
Contrast Check:
# Should return detailed contrast analysis without errors cremote contrast-check --selector body -
Keyboard Navigation Test:
# Should return tab order and focus indicator analysis cremote keyboard-test -
Zoom Test:
# Should test at 100%, 200%, 400% zoom levels cremote zoom-test --zoom-levels 1.0,2.0,4.0 -
Reflow Test:
# Should test at 320px and 1280px widths cremote reflow-test --widths 320,1280 -
Axe-Core Test:
# Should inject and run axe-core tests cremote inject-axe cremote run-axe --run-only wcag2a,wcag2aa,wcag21aa
Deployment Steps
-
Rebuild the daemon:
cd /home/squash/go/src/git.teamworkapps.com/shortcut/cremote go build -o cremotemcp ./daemon -
Rebuild the MCP server:
cd mcp go build -o cremote-mcp -
Restart the cremote daemon container (deployment-specific)
-
Verify fixes by running the test commands above
Files Modified
daemon/daemon.go- 5 functions fixed (lines 8673-8715, 8889-8931, 9170-9210, 9373-9431, 9622-9688)
Impact
- ✅ Fixes all ADA testing tool failures
- ✅ Enables comprehensive WCAG 2.1 AA compliance testing
- ✅ No breaking changes to API or command-line interface
- ✅ No changes required to client code or MCP tools
Verification Checklist
- Daemon builds successfully without errors
- MCP server builds successfully without errors
- Daemon deployed and running
web_contrast_check_cremotemcpMCP tool worksweb_keyboard_test_cremotemcpMCP tool worksweb_zoom_test_cremotemcpMCP tool worksweb_reflow_test_cremotemcpMCP tool worksweb_run_axe_cremotemcpMCP tool works- Full ADA assessment can proceed on visionleadership.org
Related Documentation
ADA_IMPLEMENTATION_PLAN.md- Original implementation plandocs/llm_ada_testing.md- LLM agent usage guideenhanced_chromium_ada_checklist.md- WCAG 2.1 AA testing checklist