Skip to content

Fix #982: locale-independent JSON numbers in Vega skill; oql/log read run --local admin port - #983

Merged
ako merged 4 commits into
mainfrom
fix/982-vega-locale-runlocal-hint
Oct 4, 2026
Merged

ako merged 4 commits into
mainfrom
fix/982-vega-locale-runlocal-hint

Conversation

@ako

@ako ako commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Closes #982

Item 1 — Vega charts skill recommended locale-dependent formatDecimal for JSON

  • .claude/skills/packs/mendix-vega-charts/SKILL.md (example + explanation) and specs/README.md now use toString(round(x, 2)) (locale-independent, no exponent, measured on 11.13 per the issue), with formatDecimal(x, '0.00', 'en-US') as the alternative, and explain why: a Dutch user gets 12,50 → "Data is not valid JSON"; 'nl_NL'/'en_US' underscore tags are silently ignored. A repo-wide grep found no other skill/pack/doc building JSON with formatDecimal (the remaining hits are display strings). Pack source edited; cmd/mxcli/skillpacks is the uncommitted embed copy (make sync-skill-packs).
  • Optional lint rule, done: MDL-JSONNUM01 (info) in mxcli check — formatDecimal with fewer than 3 args inside a + concatenation whose string literals contain { or ":. Runs at the shared per-expression hook (checkExprFunctions), so microflows and nanoflows both get it. Documented in docs-site/src/appendixes/error-messages.md.

Item 2 — run --local query hint ignored its own admin port

  • New devLoopAdminOptions (cmd/mxcli/devloop_admin.go): with -p, a live .mxcli/run-local.json supplies the admin port and password for any flag not given (an explicit host means "not this loop"), over loopback HTTP. Precedence: flags > live loop > env > .docker/.env > defaults. A handshake whose pid is gone is ignored.
  • mxcli oql and mxcli log (list/set and its connection hint, which now prints the resolved port) both use it. run --local additionally prints Log levels: mxcli log list -p …. The existing Query data: mxcli oql -p … hint is now correct without a port flag.

Test plan

  • cmd/mxcli/devloop_admin_test.go: an httptest admin API on a random port + fake run-local.json → ExecuteOQL through the resolved options returns the row (the reported symptom end to end); controls: no handshake leaves defaults, stale pid ignored, explicit flags win; logAdminOptions picks up the port from -p and --admin-port overrides it; hint names the resolved port.
  • mdl/executor/validate_json_locale_number_test.go: through the visitor, three positive shapes; controls toString(round), explicit locale, display string, bare call → 0 hits.
  • Revert checks: devLoopAdminOptions returning its input unchanged → TestOQL_UsesRunLocalAdminPort fails with cannot connect to Mendix admin API at localhost:8090 (the reported message), and the log/flags tests fail. Removing the checkLocaleNumberInJSON hook → all three positive JSONNUM cases fail (0 hits, want 1).
  • End to end: ./bin/mxcli check on a script with both spellings → exactly one MDL-JSONNUM01 info on the formatDecimal line, exit 0.
  • Ran: make build, go test ./mdl/executor/ ./cmd/mxcli/docker/, go test ./cmd/mxcli/, make check-conformance, make check-findings, make check-mdl, make check-skill-mdl, make lint — all pass. make sync-skills sync-skill-packs run.
  • Not measured here: a live run --local --admin-port boot (no runtime run in this round); the handshake path is the same one constant set --apply already uses.

🤖 Generated with Claude Code

ako and others added 4 commits October 4, 2026 18:52
formatDecimal(x, '0.00') follows the user's language, so a Dutch user got
12,50 and invalid JSON. Use toString(round(x, 2)), or formatDecimal with a
hyphenated locale; explain the silently-ignored underscore tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…json (#982)

The run --local hint 'mxcli oql -p …' failed on a non-default --admin-port
(cannot connect … localhost:8090), and mxcli log did the same. Both now take
the port and password from a live .mxcli/run-local.json for any flag not given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ilt JSON (#982)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ako
ako merged commit 85734bb into main Oct 4, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vega charts skill recommends locale-dependent formatDecimal for JSON; run --local query hint ignores the admin port

1 participant