EVERY Coa submission is refused on logo: the client labels the logo part application/octet-stream (mw.CreateFormFile) and Coa validates the part's Content-Type, not the bytes — a PNG kit fails exactly like the JPEG one; fix the part header, then … #1806

Closed
opened 2026-09-24 02:31:15 +00:00 by ben · 4 comments
Owner

Proven (cold manual founding #2 of whakatohea-demo, 2026-09-23/24, build ff4a5263)

The community-app record on the gateway after two Try-again clicks (/srv/idss/config/idss/community-app.json):

{"chosen":"now","state":"failed","slug":"","submitted_at":"",
 "reason":"Coa could not validate the submission: logo",
 "design":{"features":{"notices":true,"events":true,"chat":true,"projects":false,"proposals":false},"contact_email":"…"}}

The gateway's brand kit (/srv/idss/config/idss/brand-kit.json): "Logo": {"Source": "brand/whakatohea-logo.jpeg", "Bytes": "/9j/4AAQSkZJRg…"} — a JPEG (that base64 prefix is the JFIF magic). Ben uploaded a .jpeg at the founding brand-kit step and the app took it.

Coa: packages/schema/src/submission.ts:7 LOGO_MIME = ['image/svg+xml', 'image/png']; server/src/multipart.ts:21 → issue {path:'logo', message:'logo must be SVG or PNG'} → POST /api/submit answers 400 validation. The IDSS client forwards the logo as-is (internal/coaclient/client.go:131-137, CreateFormFile("logo", "logo."+logoExt(sub.Logo.ImageType))) and maps the 400 to a CoaRefusal whose reason the card shows verbatim: "Coa could not validate the submission: logo".

Ordering matters: submit.ts parses the form (line 26) before the slug check (line 36), so this 400 fires regardless of anything else — it is what the founding-time tail hit at ~17:40 too, not the slug-taken 409 I first attributed it to in #1805 (that residue was real and is corrected there; it was simply never reached).

Control-plane log, both clicks: msg="community-app re-submitted" slug="" state=failed resumed_design=true — the re-design act re-read the same JPEG from the brand kit and was refused the same way. From the operator's chair Try again "does nothing": the card re-renders the identical failed state.

Nothing in app/src constrains the logo file type at the brand-kit step (grep -rn 'accept=' app/src/components/founding finds no logo accept list), and no ticket covers it (tracker searched: logo png / logo jpeg / logo coa).

Fix

  1. Brand-kit step (founding S-brand and Settings → Brand kit, #1506): accept image/png, image/svg+xml only, OR accept anything raster and convert to PNG in the app (the kit already decodes the image to derive the palette; re-encoding a square PNG is a few lines with the same canvas). Converting is the kinder answer — an operator with a JPEG logo should not be turned away for a format they have never heard of. Keep the SVG as-is when given.
  2. Belt and braces at the submit seam: coaSubmissionFor (founding tail) and the gateway's design act both convert a non-PNG/SVG kit logo to PNG before building the multipart, so a kit written by an older app still submits.
  3. Say what the app card cannot fix: if Coa still refuses on logo, the card's reason should name the rule ("Coa needs a PNG or SVG logo — change it in Settings → Brand kit") and point at the brand-kit page, not just echo "logo".
  4. Test: a unit test that a JPEG brand kit produces a PNG logo part at the Coa seam (magic bytes \x89PNG), and a founding-journey leg with a JPEG fixture.

WithCommunityAppResubmit picks the branch by rec.SubmittedAt == "". The founding tail's refusal path saves the record without SubmittedAt (communityapptail.go — Record{Chosen, State: failed, Slug, Reason}), so after ANY Coa refusal at founding, Try again takes the re-design branch (designer.Design with rec.Design), never the re-submit branch. Here that happened to be harmless (both read the same kit), but it means the resubmit branch is unreachable for founding-time refusals — the seam the ApplyResubmit slug-taken handling was written for.

Relates to: #1805 (corrected), #1774, #1677, #1742, #1506, #1495, DDR 0228.

## Proven (cold manual founding #2 of `whakatohea-demo`, 2026-09-23/24, build `ff4a5263`) The community-app record on the gateway after two Try-again clicks (`/srv/idss/config/idss/community-app.json`): ```json {"chosen":"now","state":"failed","slug":"","submitted_at":"", "reason":"Coa could not validate the submission: logo", "design":{"features":{"notices":true,"events":true,"chat":true,"projects":false,"proposals":false},"contact_email":"…"}} ``` The gateway's brand kit (`/srv/idss/config/idss/brand-kit.json`): `"Logo": {"Source": "brand/whakatohea-logo.jpeg", "Bytes": "/9j/4AAQSkZJRg…"}` — a **JPEG** (that base64 prefix is the JFIF magic). Ben uploaded a `.jpeg` at the founding brand-kit step and the app took it. Coa: `packages/schema/src/submission.ts:7` `LOGO_MIME = ['image/svg+xml', 'image/png']`; `server/src/multipart.ts:21` → issue `{path:'logo', message:'logo must be SVG or PNG'}` → `POST /api/submit` answers **400 validation**. The IDSS client forwards the logo as-is (`internal/coaclient/client.go:131-137`, `CreateFormFile("logo", "logo."+logoExt(sub.Logo.ImageType))`) and maps the 400 to a `CoaRefusal` whose reason the card shows verbatim: "Coa could not validate the submission: logo". Ordering matters: `submit.ts` parses the form (line 26) **before** the slug check (line 36), so this 400 fires regardless of anything else — it is what the founding-time tail hit at ~17:40 too, not the `slug-taken` 409 I first attributed it to in #1805 (that residue was real and is corrected there; it was simply never reached). Control-plane log, both clicks: `msg="community-app re-submitted" slug="" state=failed resumed_design=true` — the re-design act re-read the same JPEG from the brand kit and was refused the same way. From the operator's chair Try again "does nothing": the card re-renders the identical failed state. Nothing in `app/src` constrains the logo file type at the brand-kit step (`grep -rn 'accept=' app/src/components/founding` finds no logo accept list), and no ticket covers it (tracker searched: logo png / logo jpeg / logo coa). ## Fix 1. **Brand-kit step (founding S-brand and Settings → Brand kit, #1506):** accept `image/png, image/svg+xml` only, OR accept anything raster and **convert to PNG** in the app (the kit already decodes the image to derive the palette; re-encoding a square PNG is a few lines with the same canvas). Converting is the kinder answer — an operator with a JPEG logo should not be turned away for a format they have never heard of. Keep the SVG as-is when given. 2. **Belt and braces at the submit seam:** `coaSubmissionFor` (founding tail) and the gateway's design act both convert a non-PNG/SVG kit logo to PNG before building the multipart, so a kit written by an older app still submits. 3. **Say what the app card cannot fix:** if Coa still refuses on `logo`, the card's reason should name the rule ("Coa needs a PNG or SVG logo — change it in Settings → Brand kit") and point at the brand-kit page, not just echo "logo". 4. **Test:** a unit test that a JPEG brand kit produces a PNG logo part at the Coa seam (magic bytes `\x89PNG`), and a founding-journey leg with a JPEG fixture. ## Related weakness surfaced by the same click (separate ticket if you want it split) `WithCommunityAppResubmit` picks the branch by `rec.SubmittedAt == ""`. The founding tail's **refusal** path saves the record without `SubmittedAt` (`communityapptail.go` — `Record{Chosen, State: failed, Slug, Reason}`), so after ANY Coa refusal at founding, Try again takes the **re-design** branch (`designer.Design` with `rec.Design`), never the **re-submit** branch. Here that happened to be harmless (both read the same kit), but it means the resubmit branch is unreachable for founding-time refusals — the seam the `ApplyResubmit` slug-taken handling was written for. Relates to: #1805 (corrected), #1774, #1677, #1742, #1506, #1495, DDR 0228.
ben changed title from Founding accepts a JPEG brand logo but Coa takes only SVG/PNG — every submission from such a community is refused 400 logo, at founding and on every Try again; the app must convert (or refuse) at the brand-kit step to EVERY Coa submission is refused on logo: the client labels the logo part application/octet-stream (mw.CreateFormFile) and Coa validates the part's Content-Type, not the bytes — a PNG kit fails exactly like the JPEG one; fix the part header, then … 2026-09-24 02:41:07 +00:00
Author
Owner

Root cause corrected — proven live 2026-09-24 02:39 UTC

Ben replaced the kit logo with a 512×512 PNG from Settings → Brand kit (applied to all 12 surfaces at 02:36:23, Nextcloud oneshot re-ran 02:36:56 success, /brand/logo serves image/png). Try again at 02:39:34 → community-app re-submitted slug="" state=failed resumed_design=true, record reason unchanged: "Coa could not validate the submission: logo".

internal/coaclient/client.go:132 builds the part with mw.CreateFormFile("logo", "logo."+logoExt(...)). Go's multipart.Writer.CreateFormFile hard-codes Content-Type: application/octet-stream on the part. Coa's multipart.ts:21 checks logo.type (the part's Content-Type header) against LOGO_MIME = [image/svg+xml, image/png] — never the bytes.

Direct probe against the live Coa with the SAME PNG file (a submission-less form, so a harmless 400 either way):

curl -F "logo=@whakatohea-logo.png;type=application/octet-stream" https://coa.matou.nz/api/submit
→ {"issues":[{"path":"submission","message":"missing submission field"},{"path":"logo","message":"logo must be SVG or PNG"}]}

curl -F "logo=@whakatohea-logo.png;type=image/png" https://coa.matou.nz/api/submit
→ {"issues":[{"path":"submission","message":"missing submission field"}]}          ← logo accepted

So no IDSS-originated submission has ever passed Coa's parser, PNG kits included. The drives are green because cmd/rehearsal-coa does not check the part's content type — the very gap #1522/#1531 flag ("real Coa" never exercised end to end). The JPEG (original body of this ticket) is real but secondary: with the header fixed a JPEG would still be refused, so the brand-kit conversion/refusal stays in scope.

Fix, in order

  1. coaclient.Submit: build the logo part with mw.CreatePart(textproto.MIMEHeader{"Content-Disposition": {form-data; name="logo"; filename="logo.png"}, "Content-Type": {"image/png"}}) (or image/svg+xml for SVG). Same for any other file part.
  2. Convert non-PNG/SVG kit logos to PNG at the seam (both the founding tail and the gateway design act share the client, so one place), and at the brand-kit step per the original body.
  3. cmd/rehearsal-coa: refuse a logo part whose Content-Type is not in LOGO_MIME, exactly as Coa does — the fake must fail the way the real thing fails, or the journey stays green on a broken wire. Add a seam test that asserts the part header.
  4. The card reason should carry Coa's message verbatim ("logo must be SVG or PNG"), not the path alone.

The Try-again branch note (SubmittedAt empty → re-design only) in the original body still stands.

## Root cause corrected — proven live 2026-09-24 02:39 UTC Ben replaced the kit logo with a 512×512 PNG from Settings → Brand kit (applied to all 12 surfaces at 02:36:23, Nextcloud oneshot re-ran 02:36:56 success, `/brand/logo` serves `image/png`). Try again at 02:39:34 → `community-app re-submitted slug="" state=failed resumed_design=true`, record reason unchanged: **"Coa could not validate the submission: logo"**. `internal/coaclient/client.go:132` builds the part with `mw.CreateFormFile("logo", "logo."+logoExt(...))`. Go's `multipart.Writer.CreateFormFile` hard-codes `Content-Type: application/octet-stream` on the part. Coa's `multipart.ts:21` checks `logo.type` (the part's Content-Type header) against `LOGO_MIME = [image/svg+xml, image/png]` — never the bytes. Direct probe against the live Coa with the SAME PNG file (a `submission`-less form, so a harmless 400 either way): ``` curl -F "logo=@whakatohea-logo.png;type=application/octet-stream" https://coa.matou.nz/api/submit → {"issues":[{"path":"submission","message":"missing submission field"},{"path":"logo","message":"logo must be SVG or PNG"}]} curl -F "logo=@whakatohea-logo.png;type=image/png" https://coa.matou.nz/api/submit → {"issues":[{"path":"submission","message":"missing submission field"}]} ← logo accepted ``` So **no IDSS-originated submission has ever passed Coa's parser**, PNG kits included. The drives are green because `cmd/rehearsal-coa` does not check the part's content type — the very gap #1522/#1531 flag ("real Coa" never exercised end to end). The JPEG (original body of this ticket) is real but secondary: with the header fixed a JPEG would still be refused, so the brand-kit conversion/refusal stays in scope. ## Fix, in order 1. `coaclient.Submit`: build the logo part with `mw.CreatePart(textproto.MIMEHeader{"Content-Disposition": {`form-data; name="logo"; filename="logo.png"`}, "Content-Type": {"image/png"}})` (or `image/svg+xml` for SVG). Same for any other file part. 2. Convert non-PNG/SVG kit logos to PNG at the seam (both the founding tail and the gateway design act share the client, so one place), and at the brand-kit step per the original body. 3. `cmd/rehearsal-coa`: refuse a logo part whose Content-Type is not in `LOGO_MIME`, exactly as Coa does — the fake must fail the way the real thing fails, or the journey stays green on a broken wire. Add a seam test that asserts the part header. 4. The card reason should carry Coa's message verbatim ("logo must be SVG or PNG"), not the path alone. The Try-again branch note (SubmittedAt empty → re-design only) in the original body still stands.

swarm-claim host=bens-mac-04 run=31471
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=31471 (automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=31489
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=31489 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1806 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1806,
  "status": "success",
  "commits": [
    "f7d209fb74734af5b24e7fcbab73dac585f7f03e"
  ],
  "changed_files": [
    "STATUS.md",
    "cmd/rehearsal-coa/coa.go",
    "cmd/rehearsal-coa/coa_test.go",
    "docs/GOTCHAS.md",
    "internal/coaclient/client.go",
    "internal/coaclient/client_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/coaclient/ ./cmd/rehearsal-coa/",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/communityapp/... ./internal/controlapi/...",
      "exit_code": 0
    },
    {
      "command": "cd control-plane && go test ./cmd/control-plane/",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/coaclient/ ./cmd/rehearsal-coa/ && go build ./...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Logo part carries a real image Content-Type header, not application/octet-stream (root cause)": "internal/coaclient/client.go logoPart + mw.CreatePart; test TestSubmit_LogoPartCarriesImageContentType asserts image/png for png & converted jpeg, image/svg+xml for svg",
    "A non-PNG/SVG kit logo (JPEG/GIF) is converted to PNG at the one Coa seam shared by the founding tail and the gateway design act": "logoPart re-encodes via image.Decode+png.Encode; TestSubmit_LogoPartCarriesImageContentType 'jpeg converts to png' checks \\x89PNG magic; TestFakeCoa_AcceptsConvertedJPEGLogo drives it end to end through the real client",
    "The card reason names Coa's rule verbatim and points at the brand-kit page when the logo is refused": "coaReason validation branch carries iss.Message + ' — change the logo in Settings → Brand kit'; TestSubmit_LogoValidationNamesTheRuleAndBrandKit",
    "cmd/rehearsal-coa fails the way real Coa fails: a logo part outside LOGO_MIME is refused": "cmd/rehearsal-coa/coa.go logoMIMEAllowed check → 400 validation naming logo; TestFakeCoa_RefusesLogoPartNotPNGorSVG",
    "Unit test that a JPEG brand kit produces a PNG logo part at the Coa seam (magic bytes)": "TestSubmit_LogoPartCarriesImageContentType jpeg case asserts prefix \\x89PNG"
  },
  "summary": "The Coa logo part now carries image/png (or image/svg+xml) instead of Go's default application/octet-stream, non-PNG/SVG kit logos convert to PNG at the shared seam, the card names Coa's rule, and the rehearsal fake refuses the wrong type as Coa does.",
  "blockers": []
}
**close-report** for #1806 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1806, "status": "success", "commits": [ "f7d209fb74734af5b24e7fcbab73dac585f7f03e" ], "changed_files": [ "STATUS.md", "cmd/rehearsal-coa/coa.go", "cmd/rehearsal-coa/coa_test.go", "docs/GOTCHAS.md", "internal/coaclient/client.go", "internal/coaclient/client_test.go" ], "tests": [ { "command": "go test ./internal/coaclient/ ./cmd/rehearsal-coa/", "exit_code": 0 }, { "command": "go test ./internal/communityapp/... ./internal/controlapi/...", "exit_code": 0 }, { "command": "cd control-plane && go test ./cmd/control-plane/", "exit_code": 0 }, { "command": "go vet ./internal/coaclient/ ./cmd/rehearsal-coa/ && go build ./...", "exit_code": 0 } ], "criteria": { "Logo part carries a real image Content-Type header, not application/octet-stream (root cause)": "internal/coaclient/client.go logoPart + mw.CreatePart; test TestSubmit_LogoPartCarriesImageContentType asserts image/png for png & converted jpeg, image/svg+xml for svg", "A non-PNG/SVG kit logo (JPEG/GIF) is converted to PNG at the one Coa seam shared by the founding tail and the gateway design act": "logoPart re-encodes via image.Decode+png.Encode; TestSubmit_LogoPartCarriesImageContentType 'jpeg converts to png' checks \\x89PNG magic; TestFakeCoa_AcceptsConvertedJPEGLogo drives it end to end through the real client", "The card reason names Coa's rule verbatim and points at the brand-kit page when the logo is refused": "coaReason validation branch carries iss.Message + ' — change the logo in Settings → Brand kit'; TestSubmit_LogoValidationNamesTheRuleAndBrandKit", "cmd/rehearsal-coa fails the way real Coa fails: a logo part outside LOGO_MIME is refused": "cmd/rehearsal-coa/coa.go logoMIMEAllowed check → 400 validation naming logo; TestFakeCoa_RefusesLogoPartNotPNGorSVG", "Unit test that a JPEG brand kit produces a PNG logo part at the Coa seam (magic bytes)": "TestSubmit_LogoPartCarriesImageContentType jpeg case asserts prefix \\x89PNG" }, "summary": "The Coa logo part now carries image/png (or image/svg+xml) instead of Go's default application/octet-stream, non-PNG/SVG kit logos convert to PNG at the shared seam, the card names Coa's rule, and the rehearsal fake refuses the wrong type as Coa does.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#1806
No description provided.