fix(apps): DD_EXTRA_INGRESS text format avoids JSON-in-JSON quote bug#136
Merged
Conversation
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>
DD preview readyURL: https://pr-136.devopsdefender.com Browser login: paste CLI / curl: Register endpoint for a local agent: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
🤖 Generated with Claude Code