Remove Python dependency, Go-only codebase#12
Conversation
- index.html: change 'v__VERSION__' → '__RUNTIME__ · v__VERSION__' in the top-right GitHub version link so the server runtime is shown inline (e.g. 'Go · v2026.3.8' or 'Python · v2026.3.8') - index.html (JS): strip leading 'OpenClaw ' prefix from currentVersion before building sysOclaw pill text — prevents 'OpenClaw OpenClaw ...' duplication when openclaw status --json already includes the prefix - server.go: inject '__RUNTIME__' → 'Go' in NewServer() alongside __VERSION__ - server.py: inject '__RUNTIME__' → 'Python' in _render_index() alongside __VERSION__ - server_test.go: add TestIndex_RuntimeInjected (Go=Go, no raw placeholder) - tests/test_frontend.py: add TestRuntimeBadge (4 assertions: placeholder present in HTML, separator pattern, rawInst var, prefix-strip regex) - tests/test_server.py: add TestRenderIndex (Python injection + __VERSION__ still replaced) Backward-compatible: if a runtime doesn't replace __RUNTIME__, it appears as literal '__RUNTIME__' (safe, visible signal — not silently broken).
currentVersion may carry a build suffix like '2026.3.8 (3caab92)'. Introduce instNorm by stripping the '(...)' part before comparing against latestVersion, so equal releases are not shown as outdated.
Remove server.py, system_metrics.py, all Python tests, and embedded Python from refresh.sh. Data collection logic ported to Go (refresh.go) with --refresh flag. All docs, scripts, Dockerfile, and GitHub templates updated to reflect Go-only architecture. - Delete: server.py, system_metrics.py, requirements.txt, tests/, .pytest_cache - Add: refresh.go (~1000 lines) — full Go port of data collection - Add: --refresh flag to main.go for standalone data.json generation - Rewrite: refresh.sh (901→40 lines), install.sh, uninstall.sh, Dockerfile - Update: README, TECHNICAL, CONTRIBUTING, ARCHITECTURE, CONFIGURATION, CHANGELOG, TODO, BENCHMARK, GitHub issue/PR templates - Remove stale Python comments from chat.go, system_service.go, version.go - All Go tests pass with -race detector Made-with: Cursor
Bug fixes: - Replace deprecated strings.Title with titleCase() helper - Fix IPv6 rate-limiter IP extraction using net.SplitHostPort - Fix slice mutation in collectTokenUsage (safe pre-allocated copy) Performance: - Cache resolveOpenclawBin() via sync.Once in SystemService - Pass pre-loaded Config to runRefreshCollector (skip re-read) - Stream JSONL files with bufio.Scanner instead of os.ReadFile - Parallelize collectGatewayHealth/collectCrons/collectGitLog Tests (23 new): - modelName, fmtTokens, titleCase, trimLabel - filterByDate, limitSlice, buildAlerts (7 cases) - collectCrons (4 cases), buildCostBreakdown, bucketsToList - buildDailyChart, buildSIDToKeyMap, runRefreshCollector variadic Made-with: Cursor
- Fix data race on RefreshCollectorFunc: replace mutable global var with a refreshFn field on appserver.Server injected at construction. Restructure tests to set mocks before server creation. - Fix Dockerfile: add missing COPY for internal/ and cmd/ directories so the Docker build succeeds with the new package layout. - Pass pre-loaded Config in main.go --refresh CLI path to avoid redundant config re-read from disk. - Fix getLatestVersionCached: only cache timestamp on successful npm lookup so failures don't block retries for the full TTL. - Update go.mod from go 1.23 to go 1.26 to match toolchain. - Remove duplicate .DS_Store entry in .gitignore. Made-with: Cursor
- Fix 15 silent failure issues: proper error handling for UserHomeDir, json.Marshal, config loading, dotenv parsing, session/token caches, gateway timeout (502→504), and sort comparator panic guard - Remove dead code: empty refresh_sessions.go, unused constants (maxBodyBytes, maxQuestionLen, chatRateLimit, maxGatewayResp), unused type aliases and functions in root package - Fix all lint issues: errcheck (defer Close patterns), ineffassign, unreachable strings.Contains after filepath.Clean - Add linting infrastructure: .golangci.yml, Makefile with lint/test/ build targets, golangci-lint CI step in tests.yml - Add 37 new tests across 4 internal packages (appconfig, appserver, appchat, appruntime) + extend appsystem tests — coverage for previously untested packages - Fix all documentation: TECHNICAL.md version/data-flow/theme refs, CONFIGURATION.md missing system config and env vars, README.md stale refresh.sh refs, Dockerfile VERSION file and unused packages, goreleaser port fix, bug report template, package doc comments - Add .claude/ to .gitignore, remove tracked settings.local.json Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request marks a significant architectural shift by fully migrating the dashboard's backend from Python to Go. The core purpose was to eliminate external runtime dependencies, enhance performance, and improve maintainability. The changes involve a complete rewrite of Python components in Go, structured into well-defined internal packages, alongside robust error handling, new linting, and expanded test coverage. This results in a more self-contained, reliable, and efficient dashboard application. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This is an impressive and well-executed pull request. The complete removal of the Python dependency and the migration to a pure Go codebase is a significant undertaking. The changes are thorough, consistent, and of high quality. I'm particularly impressed by:
- The clean refactoring of the Go code into
internalpackages, which greatly improves maintainability. - The comprehensive updates to documentation, CI/CD configuration (
Dockerfile,goreleaser,Makefile), and project templates, ensuring the entire developer and user experience is aligned with the new Go-only architecture. - The numerous robustness improvements, such as the enhanced graceful shutdown, more resilient binary/asset path resolution, and better handling of version strings.
- The addition of a solid testing foundation for the new Go packages.
Overall, this is an excellent contribution that significantly improves the project's architecture, simplifies its dependencies, and sets it up for future success. I have no specific comments on the code changes as they are all well-implemented and consistent with the goals of the PR.
Summary
-raceTest plan
go build ./...passesgo vet ./...passesgo test -race -count=1 ./...— all 121 tests passgolangci-lint run ./...— 0 issues--help,--version,--refresh)/,/api/refresh,/api/system,/api/chat)🤖 Generated with Claude Code