Skip to content

fix(apps): DD_EXTRA_INGRESS text format avoids JSON-in-JSON quote bug#136

Merged
posix4e merged 1 commit into
mainfrom
fix/extra-ingress-json-escape
Apr 18, 2026
Merged

fix(apps): DD_EXTRA_INGRESS text format avoids JSON-in-JSON quote bug#136
posix4e merged 1 commit into
mainfrom
fix/extra-ingress-json-escape

Conversation

@posix4e
Copy link
Copy Markdown
Member

@posix4e posix4e commented Apr 18, 2026

Summary

Hotfix for the dd-local-prod relaunch failure in main's Release cascade right after #134 merged:

```
jq: parse error: Invalid numeric literal at line 21, column 40
```

Root cause: `apps/_infra/local-agents.sh` was emitting `DD_EXTRA_INGRESS` as a JSON array and the dd-agent workload template substituted it into `"DD_EXTRA_INGRESS=${DD_EXTRA_INGRESS}"`. The first embedded `"` in `[{"hostname_label":"gpu","port":8081}]` closed the outer JSON string early, producing invalid JSON that `jq -c .` couldn't parse.

Fix: switch the env-var wire format to comma-separated `label:port` pairs (`gpu:8081` or `gpu:8081,web:9000`). The HTTP request body from agent → CP `/register` still carries the structured JSON shape; only the env-var pipeline changes.

Adds 7 unit tests covering edge cases (empty, single, multiple, whitespace, bad port, missing colon, empty label).

Test plan

  • `cargo fmt && cargo test` passes locally (10/10)
  • Reproduced the original bake pipeline locally; dd-agent JSON now parses cleanly
  • Next relaunch cascade on main should succeed through "Relaunch dd-local-prod"

🤖 Generated with Claude Code

The prior shape — a JSON array substituted into
`"DD_EXTRA_INGRESS=${DD_EXTRA_INGRESS}"` — closed the outer env
string at the first embedded `"`, producing invalid JSON that broke
`jq -c .`:

  jq: parse error: Invalid numeric literal at line 21, column 40

Seen on the dd-local-prod relaunch pipeline immediately after #134
merged (the failing job was in main's Release cascade).

Switches the wire format to comma-separated `label:port` pairs
(`gpu:8081` or `gpu:8081,web:9000`) and adds unit tests covering the
parser edge cases. HTTP request body from agent → CP /register still
carries the structured JSON shape — only the env-var-to-env-var hop
changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

DD preview ready

URL: https://pr-136.devopsdefender.com

Browser login: paste gh auth token output at https://pr-136.devopsdefender.com/auth/pat

CLI / curl: curl -H "Authorization: Bearer $(gh auth token)" https://pr-136.devopsdefender.com/

Register endpoint for a local agent: wss://pr-136.devopsdefender.com/register

@posix4e posix4e merged commit 077699a into main Apr 18, 2026
4 checks passed
@posix4e posix4e deleted the fix/extra-ingress-json-escape branch April 18, 2026 21:51
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.

1 participant