Files
artcraft-services/.sqlx
Alex72-py cc6d88e10d fix: extract OBJ from Fal ZIP packages (application/zip) (#155)
## Summary

Fixes https://github.com/storytold/artcraft/issues/1327

Handle single-OBJ ZIP packages on the Fal mesh-upload path by storing
the **extracted raw OBJ**, not ZIP bytes under an OBJ extension. Stored
size, SHA-256, `model/obj` MIME, `.obj` extension and
`MediaFileType::Obj` all describe the same extracted bytes.

The original incident's producing endpoint/output remains unknown; this
is **not a verified reproduction** of #1327.

## Scope and safeguards

Exactly **seven files**:
- Four Fal mesh-path Rust files: `mod.rs`, `download_mesh_file.rs`,
`resolve_mesh_file_metadata.rs`, and `process_model_mesh_payload.rs`.
- Two `mysql_queries` files: `get_media_file_storage_metadata.rs` and
its `get/mod.rs` declaration.
- One matching `.sqlx` cache entry.

**No workflow files are included in this PR.**

Preserved ZIP safeguards include safe enclosed paths, backslash
rejection, rejection of symlinks/special files, a 1,024-entry maximum,
the existing companion-extension allow-list, exactly one nonempty OBJ,
and nested/disguised-format rejection.

Limits are:
- **256 MiB** total declared uncompressed package size.
- **128 MiB** actually extracted OBJ bytes.
- A separate **256 MiB actual streamed mesh-download bound**, including
after gzip decompression—not merely `Content-Length`. Both initial
download and retry are bounded.

Non-ZIP metadata precedence and the shared/non-mesh downloader remain
unchanged. Typed rejection reasons retain actionable logging, including
unsupported MIME diagnostics.

The DB test remains compiled under `#[cfg(test)]`, with individual
`#[cfg_attr(feature = "skip_database_tests", ignore)]` gating. Its
size/checksum query now uses a `sqlx::query_as!` helper in
`mysql_queries`, backed by genuine matching MySQL-generated `.sqlx`
metadata—not fabricated cache data.

## Intentional appearance limitation — maintainer decision requested

Only raw OBJ is retained. Accepted MTL/texture companions are
deliberately discarded, with a warning reporting the actual
discarded-file count when nonzero.

**Materials/textures and their appearance are not retained.** Existing
`mtllib` references can remain unresolved; the OBJ bytes are not
rewritten to repair them. Explicit maintainer acceptance of this
geometry-only storage policy is still requested.

## Validation

Current PR head: `3a7d6dce7246653f4f42b4d43bb5b5c51c677043`.

[Current validation run
42058895273](https://github.com/Alex72-py/artcraft-services/actions/runs/42058895273)
completed **SUCCESS**. Its log records
`PR155_CHECKED_OUT_SHA=3a7d6dce7246653f4f42b4d43bb5b5c51c677043`—the PR
source commit, not the separate runner head.

Verified on that exact source:
- `cargo check -p storyteller-web --tests` and `cargo check -p
mysql_queries` passed with `SQLX_OFFLINE=true`.
- **21 resolver + 8 downloader tests on each of three binaries**, plus
**1 MySQL uploader/query integration test**: **30 unique targeted tests,
88 executions, zero failures or ignored tests**.
- **Four-file rustfmt, including the uploader**, and `git diff
--exit-code` passed.

Full-crate fmt and strict clippy were intentionally skipped in validate
mode; the limitations below remain applicable. This is targeted backend
validation, not the full workspace test suite.

The [previous verified functional run,
42052717146](https://github.com/Alex72-py/artcraft-services/actions/runs/42052717146),
checked out `18a2b23786414f6b6c0883c798699ed2a7e64732` and passed:
- Backend/test-target and query-crate offline checks.
- **21 resolver + 8 downloader tests on each of three binaries**, plus
**1 MySQL uploader/query integration test**: **30 unique targeted tests,
88 executions, zero failures or ignored tests**.
- Its then-three-file rustfmt check and final git-diff check.

That integration test verifies raw stored OBJ bytes and consistent
database metadata using isolated MySQL and a test bucket—not live
Fal/browser end-to-end coverage.

**Broader lint limitations:** Full-crate fmt on
[18a](https://github.com/Alex72-py/artcraft-services/actions/runs/42053921289)
and
[main](https://github.com/Alex72-py/artcraft-services/actions/runs/42053962625)
failed, exposing PR uploader formatting alongside shared baseline drift.
Follow-up `3a7d6dc` applies all **18 actual uploader rustfmt hunks**,
formatting only; other baseline files were not cleaned.

Strict clippy failed on both sources with the **same 28 vendored
Symphonia errors**, blocking completion of the backend lint assessment.
It was **not rerun on `3a7d6dc`**; clippy is not claimed clean.

## Authentic Fal evidence limit

#1327 provides only the error and a sign-in-required Rootly alert,
without a model/output sample.

The inspected Hunyuan2.1 fixture ZIP contains three
OBJs—`white_mesh_remesh.obj`, `demo_textured.obj`, `demo.obj`—and two
GLBs—`demo_textured.glb`, `demo_textured_pbr.glb`—plus companions.
Normal dispatch prefers the GLB and skips its mesh ZIP. It is **neither
the original reproduction nor evidence of an accepted single-OBJ Fal
ZIP**.

The Rapid fixture is raw OBJ with separate companions. The original
producing endpoint and authentic single-OBJ ZIP for the affected mesh
path remain unknown.

## Outstanding upstream gate

The separate backend-CI workflow PR is
[#349](https://github.com/storytold/artcraft-services/pull/349). Its
[workflow run
42267776142](https://github.com/storytold/artcraft-services/actions/runs/42267776142)
is waiting for maintainer approval (`action_required`); it has not run
and has zero jobs.

**Manual fork runs are supporting technical evidence only. They do not
satisfy reviewer request 1's upstream, current-head backend-CI gate.**
That gate and the appearance-policy decision remain outstanding; this
description does not claim approval or merge-readiness.
2026-11-11 11:22:16 -05:00
..