Repository navigation
Keep the bot token out of stored image edit jobs - #275
Merged
Merged
Conversation
VIP image edit jobs stored Telegram file URLs, which carry the bot token, in taskman_jobs, and the same URLs reached Discovery job bodies. - Edit jobs store the pictures' Telegram file IDs (`image_file_ids`); the resolver only checks that the bot can fetch each file. - The VIP edit worker loads the pictures by file ID and hands the editor base64 bytes, so draw-api gets `image_b64` and no token URL. Queued jobs with stored file URLs load the same way. - Migration 211 removes the token from file URLs already stored in taskman_jobs (one-way; the redacted form still resolves).
Owner
Author
|
Danger warning on migration notes: added a "Migration compatibility" section to the PR body (up rewrites only the token part; down is a no-op, irreversible by design; old and new records both deserialize). The SQLx/storage check is in Verification: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
VIP image edit jobs stored Telegram file URLs (
https://api.telegram.org/file/bot<token>/…) intaskman_jobs.record, and the same URLs went into Discovery job bodies for draw-api. Prod had 31 such records (2026-10-19…10-21).Change
ImageJobDatagetsimage_file_ids(skipped when empty, so other job records keep their shape). The edit resolver stores the pictures' Telegram file IDs and only checks withgetFilethat each one is downloadable; it no longer builds file URLs and no longer needs the bot token.TelegramPictureBytesEditorwraps the VIP editor: when a request names Telegram pictures (file IDs, or Telegram file URLs from jobs queued before this change), it loads them once on the bot side and passes base64 bytes on. draw-api then receivesimage_b64instead of a URL. The prompt optimizer reuses the same bytes.taskman_jobs(bot<token>/→bot<redacted>/). The down migration is a no-op: the scrub is one-way by design. A queued job with a redacted URL still loads, because the loader uses the file path after the token.Migration compatibility
taskman_jobsrows that contain one (31 on prod). Job shape, status and timestamps stay the same.image_file_idsstill deserialize (the field defaults to empty), so a rollback of the code and a forward deploy are both compatible with the stored jobs.Verification
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings: clean.cargo test --no-fail-fast -p openplotva-app -p openplotva-taskman -p openplotva-storage: 1438 + 179 + 68 passed.image_urls.