Skip to content

feat(generator): standardize all reference image passing to inline Base64 data URLs - #364

Merged
JuhaoChen666 merged 7 commits into
1024XEngineer:mainfrom
JuhaoChen666:feat/base64-reference-standardization
Aug 28, 2026
Merged

feat(generator): standardize all reference image passing to inline Base64 data URLs#364
JuhaoChen666 merged 7 commits into
1024XEngineer:mainfrom
JuhaoChen666:feat/base64-reference-standardization

Conversation

@JuhaoChen666

Copy link
Copy Markdown
Contributor

Change Description (Required)

  • Standardizes all reference image passing to AI image model providers as inline Base64 data URLs (data:image/png;base64,...).
  • Fixes [BadRequestError] Unable to download content from the provided URL before the timeout on remote AI model providers (such as QNA) caused when providers attempt to fetch private S3/object storage URLs from external data centers.
  • Ensures scenery generation (generateSceneryLayers), prototype generation (normalizePrototypeReference), tileset generation, and tileset editing always pass self-contained Base64 data URLs in generation requests.
  • Added live integration test TestLiveBase64CharacterPrototypeGeneration verifying real end-to-end Character Prototype generation using Base64 reference inputs.

Implementation Approach (Required)

  • Updated normalizePrototypeReference in executor_prototype.go:
    • Always returns generatedImageDataURL(...) (data:image/png;base64,...) instead of returning raw remote object storage URLs when the image does not require upscaling.
  • Updated generateSceneryLayers in executor_scenery.go:
    • Resolves and normalizes base references via e.resolveReferences(ctx, GenerateScenery, ...) to ensure scenery references are also converted to Base64 data URLs.
  • Updated executor_prototype_test.go test expectations to reflect normalized Base64 data URLs.
  • Added TestLiveBase64CharacterPrototypeGeneration in executor_tileset_live_test.go verifying real model execution.

Related Issue (Required)

None

Testing (Required)

  • go test -v ./internal/module/generator/... - PASS
  • HOLONIC_LLM_INTEGRATION=1 go test -v ./internal/module/generator -run TestLiveBase64CharacterPrototypeGeneration -timeout 5m - PASS (Real model generation succeeded in 75.55s)

Screenshots or Recordings (Optional)

Character Prototype generation verified with Base64 reference image input.

Risks and Follow-ups (Optional)

None identified.

Checklist (Required)

  • The PR is focused and does not include unrelated changes.
  • Asset names, formats, dimensions, and metadata follow project conventions.
  • Licensing and attribution information is included or unchanged as appropriate.
  • Documentation or examples were updated when needed.

…l providers

Previously, normalizePrototypeReference passed raw remote S3 URLs to AI model providers if the image did not require upscaling.

Remote AI providers (such as QNA) often encounter network timeouts or authentication errors when attempting to download private S3 URLs.

Always convert normalized reference images to inline base64 data URLs to eliminate outbound image downloads by model providers.
…se64 prototype test

Ensure scenery generation resolves and converts references to inline Base64 data URLs.

Add live end-to-end character prototype generation test with Base64 reference.
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
holonic-asset Ignored Ignored Preview Aug 28, 2026 5:42am

@JuhaoChen666
JuhaoChen666 requested a review from cqhasy August 27, 2026 10:38
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.10345% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...l/module/generator/prototype_reference_download.go 92.59% 6 Missing and 4 partials ⚠️
Flag Coverage Δ
backend 90.48% <93.10%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...pi/internal/module/generator/executor_prototype.go 87.80% <100.00%> (+1.79%) ⬆️
...-api/internal/module/generator/executor_scenery.go 89.15% <100.00%> (-0.61%) ⬇️
...l/module/generator/prototype_reference_download.go 95.47% <92.59%> (-4.53%) ⬇️

... and 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference normalization paths now consistently convert downloaded/object-storage images before generation, and the focused generator suite passes. One compatibility issue remains for callers that already provide a sufficiently large data URL.

Comment thread core-api/internal/module/generator/executor_prototype.go
No-op reference normalization can return an existing image data URL.

Reuse normalized data URLs and wrap only raw Base64 payloads.

Prevent duplicate data URL prefixes and cover the behavior with a regression test.
Prototype reference downloads can stall while reading object-storage responses.

Retry transient transport and HTTP failures up to three attempts and extend each attempt to two minutes.

Preserve deterministic failures while logging redacted attempt diagnostics.
Reference download retries introduced uncovered timeout, size-limit, and logging paths.

Add focused tests for transient and permanent failures, empty responses, oversized content, cancellation, and retry classification.

Restore generator coverage to 90.6% and protect download observability behavior.
Codecov still reported uncovered branches when retry waits were canceled.

Add deterministic tests for default-client cancellation and canceled request/read retries.

Raise downloader coverage to 90.5% and the generator package to 90.7%.
@JuhaoChen666
JuhaoChen666 merged commit 78dfb76 into 1024XEngineer:main Aug 28, 2026
7 checks passed
@JuhaoChen666
JuhaoChen666 deleted the feat/base64-reference-standardization branch August 28, 2026 06:33
@JuhaoChen666 JuhaoChen666 self-assigned this Aug 28, 2026
@JuhaoChen666 JuhaoChen666 added area:upload Upload sessions, object keys, media metadata, access control. type:bug A reproducible defect or unexpected behavior. labels Aug 28, 2026
@JuhaoChen666 JuhaoChen666 added type:feature A new capability or improvement to existing behavior. and removed type:bug A reproducible defect or unexpected behavior. labels Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:upload Upload sessions, object keys, media metadata, access control. type:feature A new capability or improvement to existing behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants