Skip to content

Vision server: opaque upload IDs, a delete route and optional retention; Dependabot ignores transformers majors - #29

Merged
FzzySwtr merged 3 commits into
mainfrom
fix/upload-retention
Nov 14, 2026
Merged

FzzySwtr merged 3 commits into
mainfrom
fix/upload-retention

Conversation

@mrhegemon

@mrhegemon mrhegemon commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Summary

On main, the vision server (cv-server/) stores each glTF upload (POST /v1/gltf) in GLTF_UPLOAD_DIR under the name spatial-map-<date>-<time>-<8 hex>. The name holds the upload time but nothing about the user. Nothing can delete an upload except removing its files on the host, and uploads never expire.

transformers is pinned to 5.17.0 (#27), the last release that needs nothing newer than the server's torch 2.5.1, the last torch with CUDA 12.1 wheels. Nothing tells Dependabot to leave it there. #24, a Dependabot pull request, had moved it from 4.40.1 to 5.10.1, which cannot run this server.

This branch:

  • gives each new upload an opaque random ID;
  • adds DELETE /v1/gltf/{id}, behind the same bearer token as every other route; it answers 404 for unknown or malformed IDs and never touches files that are not uploads;
  • adds an optional retention period, GLTF_UPLOAD_RETENTION_DAYS (default 0, no expiry); when it is set, a sweep at startup and then every hour deletes older uploads;
  • adds .github/dependabot.yml, which ignores semver-major transformers updates. It cannot stop a security update from moving transformers to 6.x.

Existing uploads stay readable, and neither the Quest app nor the web client needs a change. How long to keep uploads is the owner's decision, so the default keeps them as main does.

Three commits on main at 714feb8: 4b1b925 (IDs, DELETE and retention), 9f37767 (Dependabot) and 682752d (the platform-independent DELETE test added after review).

What changed

Upload IDs (cv-server/app/gltf_store.py, new, called from cv-server/app/routers/gltf.py)

  • Each new upload gets an ID of 32 random lowercase hex characters: 128 bits from Python's secrets, with no file name, counter or timestamp in it. Its parts are stored as <id>.gltf, <id>.bin and <id>.extras.json. As before, the file names the client sends are not kept.
  • The response adds id and keeps ok, gltf_path, bin_path and extras_path.
  • The .gltf is created exclusively, so an ID already on disk is never reused, and a failed write removes the parts already written. The files are now written in a worker thread instead of on the event loop.

DELETE /v1/gltf/{id}

  • Deletes the upload's files and answers 204. An ID that names no upload, or is not a well-formed ID, gets 404 (Upload not found.).
  • The ID must match exactly: 32 lowercase hex characters, or an upload name from before this change. A request therefore cannot name a file outside the upload folder, as ..\x otherwise could on Windows. Files in the folder that are not uploads, such as scan.gltf, are never touched.
  • Like every route, it sits behind the bearer-token middleware: 401 without the token or with a wrong one, 503 when the server has no token configured. Without the token, a known and an unknown ID get the same answer.

Retention (GLTF_UPLOAD_RETENTION_DAYS, in cv-server/app/config.py and cv-server/app/main.py)

  • Unset or 0, the default, keeps uploads until they are deleted, as on main.
  • A positive number of days deletes every upload whose newest file is older than that, at startup and then every hour. A failed hourly sweep is logged and the next one still runs. The startup sweep is not guarded: if it fails, for example because GLTF_UPLOAD_DIR cannot be listed, the server does not start. Shutdown stops the loop.
  • A negative or non-integer value stops the server from starting. An empty value counts as 0.
  • Only files named like an upload are deleted. Other files and folders in GLTF_UPLOAD_DIR are left alone.
  • cv-server/docker-compose.yml passes the variable to the container, with 0 when it is unset or empty.

Existing uploads stay readable. Files stored before this change keep their names and contents, and new uploads do not touch them. Their ID is the file name without the extension, so DELETE and retention cover them too.

Clients. The Quest app (GltfSyncClient) and the web client (GltfExporter) send the upload and check only the HTTP status. Neither builds nor parses IDs or paths, and neither calls the new route, so neither needs a change. The Quest app stores nothing on a server today, and the web client stores uploads only through its development server:

  • The Quest app's upload is off in the shipped scene (uploadAfterExport: 0 in CompanionCapture.unity).
  • The browser code in web/src never sends the bearer token. Only the Vite dev server's proxy adds it, from CV_SERVER_API_TOKEN (web/vite.config.ts), so uploads made through npm run dev with the token set are stored. A production build, or a server URL set in the Settings panel, sends no token, and the server refuses those requests, uploads included. That gap was already on main, and this pull request leaves it as it is.

Dependabot (.github/dependabot.yml, new)

  • One pip entry for /cv-server. With open-pull-requests-limit: 0, Dependabot opens no version-update pull requests there. An ignore rule skips semver-major transformers updates if that limit is ever raised.
  • Security updates are not covered. GitHub's documentation says an ignore rule's update-types affects only version updates, and that security updates are created regardless of update-types (how-to; dependabot.yml options reference, Enterprise Server 3.9). A security update could therefore still move transformers to 6.x, as Bump transformers from 4.40.1 to 5.10.1 in /cv-server in the pip group across 1 directory #24 moved it from 4.40.1 to 5.10.1.
  • Security updates also keep their own limit of 10 open pull requests, which open-pull-requests-limit does not change. A comment in the file says both.

Docs and tests

  • cv-server/README.md (the setting, the route list and the glTF Upload section), cv-server/.env.example and docs/quest-capture-gltf.md.
  • cv-server/tests/test_gltf.py (new, 51 cases) and one more case in cv-server/tests/test_auth.py (DELETE without the token).

Verification

The repository's CI runs no cv-server tests. No workflow runs pytest or a linter on cv-server/, and none runs on a pull request that changes only cv-server/, docs/ and .github/dependabot.yml. Everything below therefore ran locally on Windows, outside the Docker image, without the model weights.

  • pytest, whole cv-server suite: 140 passed, 6 skipped. The six skipped tests need the model weights or the GroundingDINO package, which the test machine does not have. main at 714feb8 gives 88 passed and 6 skipped, and this branch before its last commit gave 139 passed and 6 skipped.
  • What the 52 new cases cover:
    • IDs: the format; no shared 12-character prefix among 2,000 new IDs; 13 malformed values refused; an ID already on disk never reused; no files left by a failed write.
    • DELETE: every part removed, then 404; 404 for unknown IDs, inexact IDs and three traversal paths; an old spatial-map-* upload left unchanged by a new upload, then deleted by its name.
    • Auth: 401 for a missing, wrong, Basic or empty bearer token; the same 401 for known and unknown IDs; 503 when no token is configured.
    • Retention: off by default; values read from the environment, an empty one included; -1, 1.5 and a week refused; expiry by the newest file; other files and folders kept; the startup sweep with 0 and with 7 days; the loop running again after a failed sweep.
  • Deliberate breaks. Each of these was made in a throwaway copy, and each made tests fail:
    • timestamped IDs instead of random ones;
    • expiry by an upload's oldest file instead of its newest;
    • no sweep at startup;
    • no upload-ID check in delete_upload (see the next point).
  • The ID check on Linux, found in review. Before 682752d, removing the ID check failed only three cases in two tests, and all three depend on Windows path rules: the uppercase-ID case of test_delete_needs_the_exact_id (Windows file names ignore case) and the two backslash cases of test_delete_stays_inside_the_upload_dir. With those two tests deselected (all four of their cases) to stand in for Linux, where the image runs, the other 71 cases in test_gltf.py and test_auth.py passed, while DELETE /v1/gltf/scan returned 204 and deleted a scan.gltf placed in the upload folder.
    • 682752d adds test_delete_leaves_files_that_are_not_uploads, which does not depend on the platform. It puts scan.gltf, notes.bin, x.extras.json, spatial-map.gltf and a .gltf named with an uppercase ID in the upload folder, then checks that DELETE answers 404 for each name and leaves every file in place.
    • With the ID check removed, four cases fail on Windows: the new test and the three above. With the two Windows-only tests deselected, the new test is the only failure: its first DELETE, for scan, answers 204 and removes scan.gltf. The broken copy deletes all five files.
  • ruff 0.17.3, which the repository does not configure: clean with the classic rule set and a 100-character line limit, and the format check passes. Its newer default rules flag six typing-style lines in test_gltf.py.
  • .github/dependabot.yml passes schema validation.

Not verified

  • Linux and the image. The tests ran on Windows only; Linux was approximated by deselecting the Windows-only tests. No image was built from this branch, and no running server answered DELETE or ran a sweep.
  • Compose. Passing GLTF_UPLOAD_RETENTION_DAYS through docker-compose.yml was not tried; only the parsing of the value is tested.
  • The hourly interval. The loop was tested with a 10 ms interval.
  • The sweep's log line. A sweep that deletes uploads logs Deleted N glTF upload(s) older than D day(s). at INFO. Nothing in cv-server/ configures logging, and uvicorn's default configuration sets up only its own loggers. Whether the line reaches the container log was not checked.
  • Real clients. No upload from the Quest app or the browser reached this code (see Clients above).
  • Dependabot. GitHub reads dependabot.yml from the default branch, so how it treats this file shows only after merge. The statement about security updates rests on GitHub's documentation, not on a test.

Merge notes

Owner actions

Before release

  1. Choose the retention period. Until you do, the default stays 0, no expiry.
    • Set GLTF_UPLOAD_RETENTION_DAYS on each vision server you run (with compose, in .env beside docker-compose.yml). On any server Companion Intelligence runs, such as a reviewer server for store review, set it before the server takes uploads.
    • To make every install expire uploads, change the default in cv-server/app/config.py and cv-server/docker-compose.yml instead.
    • The first start with a period set deletes every upload older than it, including uploads from before this change. There is no dry run, so copy GLTF_UPLOAD_DIR first if any of them matter.
    • The stock docker-compose.yml mounts no volume for GLTF_UPLOAD_DIR, so with it, uploads already disappear whenever the container is recreated.
    • The Companion Scan privacy policy says the server software keeps uploaded maps until whoever runs it deletes them. That stays true while the default is 0. If the default changes, change that sentence too.

After merge

  1. Smoke-test an image built from main. Start it as docker-compose.yml does. Send POST /v1/gltf with the token, then DELETE /v1/gltf/{id} with the returned id: expect 204, then 404 for a second DELETE. With a period set, check that an upload whose files are older than the period is gone after a restart.
  2. Check the Dependabot tab under Insights > Dependency graph for errors in the new config.
  3. Decide whether security updates may move transformers. Adding a versions range to the ignore rule makes it apply to security updates too, as the comment in the file notes. It would then also hold back a security fix that ships only in a newer release.

🤖 Generated with Claude Code

mrhegemon and others added 3 commits November 13, 2026 18:13
…l retention

POST /v1/gltf named every upload spatial-map-<date>-<time>-<8 hex>, so the
name gave away when a scan was uploaded, and nothing could remove an
upload: files stayed in GLTF_UPLOAD_DIR until someone deleted them on the
host.

- Each upload now gets an ID of 32 random lowercase hex characters (128
  bits from secrets), with no file name, counter or timestamp in it. Its
  parts are stored as <id>.gltf, <id>.bin and <id>.extras.json. The .gltf
  is created exclusively, so an ID is never reused, and a failed write
  leaves no partial upload. The response adds "id" and keeps ok,
  gltf_path, bin_path and extras_path.
- DELETE /v1/gltf/{id} deletes an upload's files: 204, or 404 for an ID
  that names no upload. The ID must match exactly, so nothing outside the
  upload directory can be named (on Windows "..\x" could). The route sits
  behind the same bearer-token middleware as every other route.
- GLTF_UPLOAD_RETENTION_DAYS deletes uploads whose newest file is older
  than that many days, at startup and then hourly. 0 or unset, the
  default, keeps today's behaviour (no expiry): the period is the owner's
  decision. A negative or non-integer value stops the server from
  starting. Only files named like an upload are ever deleted.
- Uploads stored before this change keep their files and names; their ID
  is the name without the extension, so DELETE and retention cover them.

The Quest app (GltfSyncClient) and the web client (GltfExporter) only send
the upload and check the status; neither builds nor parses IDs or paths,
so neither needs a change.

Documented in cv-server/README.md, .env.example, app/config.py and
docker-compose.yml, which now passes the variable to the container.
tests/test_gltf.py covers the ID format, the new route and its auth, and
retention on and off, including at server start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…updates

transformers is pinned to 5.17.0 (#27), the last release that needs
nothing newer than torch 2.5.1, the last torch with CUDA 12.1 wheels.
.github/dependabot.yml adds a pip entry for /cv-server that ignores
semver-major updates of transformers, with open-pull-requests-limit: 0
so it opens no version-update pull requests.

This does not cover Dependabot security updates. Per GitHub's
documentation, ignore rules that match by dependency name or version apply
to version and security updates, but update-types applies to version
updates only, and security updates are created whatever it says. A
security update can therefore still move transformers to a new major
version, as #24 moved it from 4.40.1 to 5.10.1. Security updates also
keep their own fixed limit of 10 open pull requests, which
open-pull-requests-limit does not change. The file says so in a comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e system

The exact-ID and traversal tests notice a missing upload-ID check only on
Windows, where paths ignore case and split on backslashes. This test puts
files with upload suffixes but names that are not upload IDs (scan.gltf,
notes.bin, x.extras.json, spatial-map.gltf and an uppercase ID) in the
upload folder, then checks that DELETE answers 404 for each and leaves every
file in place. Without the ID check it fails on every platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@FzzySwtr
FzzySwtr merged commit 475d554 into main Nov 14, 2026
@FzzySwtr
FzzySwtr deleted the fix/upload-retention branch November 14, 2026 04:06
mrhegemon added a commit that referenced this pull request Nov 14, 2026
…ver retention (#29)

README.md conflicted in two places: keep this branch's release-build text
(signing from GameCI's environment names, versionCode from bundleVersion)
with the artifact names main's command-line build now writes,
Builds/Android/CompanionScan.apk and .aab. The signature-check commands in
the README and docs/SIDELOAD.md named the old CompanionCapture artifacts
too and are updated the same way. The workflows pick packages up by
dist/*.apk and dist/*.aab, so they need no change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants