Skip to content

fix(deployment): quote ConfigMap values with %q, as the go agents already do - #79

Merged
antoinetoussaint-byte merged 1 commit into
mainfrom
fix/configmap-quote-with-printf
Oct 8, 2026
Merged

antoinetoussaint-byte merged 1 commit into
mainfrom
fix/configmap-quote-with-printf

Conversation

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor

The defect

A rendered ConfigMap value is an arbitrary string — a JSON document, a comma-joined list, a sentence. This template wrapped it in hand-written quotes:

  {{$key}}: "{{$value}}"

so the first " inside a value closed the string early and the remainder became YAML. The render then refused its own output:

configmap.yaml: yaml: line 6: did not find expected key

…and deleted the tree it had just written, leaving nothing to read. That is why this took a template comparison to find rather than a log: the renderer destroys the evidence of its own failure.

Why only here

service-go and service-go-grpc already render {{ printf "%q" $value }}. Only this agent and service-nextjs did not — the same defect is open there and is being fixed separately, so the frontend has it too.

The secret template is deliberately untouched: a Secret's data holds base64, which contains nothing that breaks naive quoting, and the go agents quote it the same way.

The test

It executes the template directly rather than through the agent's deployment path, because the fault is the template's quoting and nothing above it — a test that needed core's deployment wrapper to reach this line would not say where the fault is.

Verified by experiment, not by reading: on the old template it fails with the same not parseable YAML symptom seen in production; on the new one it passes. It asserts the document parses and that each value survives byte for byte, over a value set covering a JSON document, key: value, a trailing backslash, an embedded newline, an embedded quote, a #, and the empty string.

Full suite green.

Where it was found

Rendering platform-obin's staging deployment for the Lane 3 Catalogue. The module that hit it is a python-fastapi service whose configuration carries a JSON value — and core v0.15.0's authority subject fields make such values more common, which is why it surfaced now.

🤖 Generated with Claude Code

…eady do

A rendered ConfigMap value is an arbitrary string — a JSON document, a
comma-joined list, a sentence. This template wrapped it in hand-written
quotes, so the first " inside a value closed the string early and the rest
of it became YAML. The render then refused its own output:

  configmap.yaml: yaml: line 6: did not find expected key

and deleted the tree it had just written, leaving nothing to read, which is
why it took a template comparison rather than a log to find.

service-go and service-go-grpc already render `{{ printf "%q" $value }}`;
only this agent and service-nextjs did not, so the same defect is open there
and is being fixed separately.

The secret template is deliberately untouched: a Secret's `data` holds
base64, which contains nothing that breaks naive quoting, and the go agents
quote it the same way.

The test executes the template directly rather than through the agent's
deployment path, because the fault is the template's quoting and nothing
above it — a test needing core's deployment wrapper to reach this line would
not say where the fault is. It fails on the old template with the same
"not parseable YAML" symptom seen in production, and the assertion is that
the document parses AND each value survives byte for byte.

Found rendering platform-obin's staging deployment for the Lane 3 Catalogue;
the module that hit it is a python-fastapi service whose configuration
carries a JSON value.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@antoinetoussaint-byte
antoinetoussaint-byte merged commit 11bc9eb into main Oct 8, 2026
4 checks passed
antoinetoussaint-byte added a commit to codefly-dev/service-nextjs that referenced this pull request Oct 8, 2026
…eady do (#164)

Same defect as codefly-dev/service-python-fastapi#79, found by comparing all
four agents' templates.

A rendered ConfigMap value is an arbitrary string — a JSON document, a
comma-joined list, a sentence. This template wrapped it in hand-written
quotes, so the first " inside a value closed the string early and the rest
became YAML. The render then refuses its own output

  configmap.yaml: yaml: line 6: did not find expected key

and deletes the tree it just wrote, leaving nothing to read.

service-go and service-go-grpc already render `{{ printf "%q" $value }}`.
This agent and service-python-fastapi did not, which is why a frontend whose
configuration carries a JSON value cannot render.

The test executes the template directly, because the fault is its quoting and
nothing above it. It fails on the old template with the production symptom and
passes on the new one; it asserts the document parses AND that every value
survives byte for byte.

Co-authored-by: Antoine Toussaint <312536060+antoinetoussaint-byte@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@antoinetoussaint-byte
antoinetoussaint-byte deleted the fix/configmap-quote-with-printf branch October 25, 2026 17:04
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