Files
magpie/docs
yetone b2034c1bcf gateway: an Ark video keeps the caller's content, ratio and own fields, and answers Ark's
axelburks on Discord listed what /v1/videos did to a Seedance request
against Ark's own API (docs 82379/1520757 create, 1521309 query). Each
item checked against those docs and video.go; the real ones:

- A caller's content was overwritten. volcengineVideoBody built content
  from the prompt and OpenAI's image fields and set it over the caller's,
  so reference_video, reference_audio and draft_task items were lost.
  Now a content sent is Ark's own and kept whole; the prompt goes first
  only when it has no text item, OpenAI's image fields after it.
- Image-to-video needed a prompt; asset:// and seconds -1 were refused.
  Ark's image-to-video takes no prompt, its asset library's asset://
  ids are images, and duration -1 lets the model choose. Now the prompt
  is optional with an image or a content, asset:// is kept as it is, and
  -1 goes as -1. These three are Ark's alone: arkOnly turns them away
  with a 400 before another vendor (MiniMax, Grok, an OpenAI-compatible
  one) is asked.
- size overrode an explicit ratio/resolution, and its mapping was wrong.
  size went through to ratio and resolution after the caller's own were
  copied, so ratio "adaptive" was lost; its resolutions stopped at 1080p
  and its ratios were Grok's, without 21:9 (3840x2160 went as 1080p). Now a ratio, resolution
  or duration the caller sends is never overridden; size is the nearest
  of Ark's tiers by pixels (480p, 720p, 1080p, 4k) and of Ark's
  ratios (arkVideoSize).
- Every string field, a JSON body's too, was read as JSON when it parsed
  as a bool or a number, and nothing else was: a form's tools stayed the
  string "[{...}]", and safety_identifier "12345" became 12345. Now only a
  multipart form's values are parsed (formValue), and Ark's text fields
  (arkTextFields: safety_identifier, callback_url, service_tier, ratio, …) stay strings. A
  JSON body's values keep their JSON types.
- The query answer dropped Ark's extras. Now every field of Ark's task
  that OpenAI's video object doesn't have (content.last_frame_url, usage,
  resolution, ratio, framespersecond, seed, tools, output_format, …) is
  passed on as it came (videoState.Ark, all but arkOwnFields).
- A MOV was served as mp4. /content now reads the ftyp brand ("qt  " is
  video/quicktime), then the vendor's video/* type, then Ark's
  output_format; mp4 only when none says otherwise (videoType).
- The expired message was wrong: Ark's expired is a task that ran past
  its execution_expires_after (48h by default) unfinished, not a link
  that expired. It now says so.
Not real: watermark is not forced on videos (it went as sent already).

Tests (internal/gateway/ark_video_fields_test.go):
TestArkVideoKeepsCallersContent, TestArkVideoFromImageNeedsNoPrompt,
TestOnlyArkTakesItsOwnVideoAsks, TestArkVideoSize,
TestArkVideoFieldTypes, TestArkVideoAnswersItsOwnFields, TestVideoType.
Docs: gateway-routing.md's Ark video paragraph and /content row.

Run on mote at the head of this stack (the Ark video fields, the native
route and the Ark image fields, three commits on af9ac3d25):
- go test -count=1 -timeout 45m ./internal/gateway ./internal/gui
  ./internal/access: gateway and access ok; gui red only in
  TestMainWindowCorners/macOS_26_SDK (#3949, red on main).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: clean. gofmt -l: nothing.
- No GUI file or script changes in this stack, so no GUI run.
The commits between were not run on their own at this base.

Broken by hand, each red, then put back:
- the caller's content not read: TestArkVideoKeepsCallersContent red
- the prompt required with an image: TestArkVideoFromImageNeedsNoPrompt red
- arkOnly skipped: TestOnlyArkTakesItsOwnVideoAsks red
- size overriding a named ratio: TestArkVideoSize red
- Grok's ratios in place of Ark's: TestArkVideoSize red
- Ark's text fields parsed as JSON: TestArkVideoFieldTypes red
- a JSON body's values parsed as a form's: TestArkVideoFieldTypes red
- Ark's extra fields not copied: TestArkVideoAnswersItsOwnFields red
- the old expired wording: TestArkVideoAnswersItsOwnFields red
- a MOV served as mp4: TestVideoType red

Not tried: no real Ark video was made (no money spent); the request and
answer shapes are from Ark's docs, on a fake Ark.

Credit: axelburks on Discord.
2026-11-03 18:46:54 +08:00
..