feat: add atomic, revisioned tile-order API with set-based updates - #994
Open
devin-ai-integration[bot] wants to merge 16 commits into
Open
feat: add atomic, revisioned tile-order API with set-based updates#994devin-ai-integration[bot] wants to merge 16 commits into
devin-ai-integration[bot] wants to merge 16 commits into
Conversation
…reproduction Establishes the epic #975 fixture: 80 sibling categories, 600 sibling images, mixed root and nested scopes, duplicate sort_order values, with idempotent CLI seeding, backend integration tests against real PostgreSQL, and frontend latency-injected regression tests reproducing the silent-drop, stale-refresh-overwrite, and partial-persistence failures. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…arent Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…etry Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ned semantics Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ecording Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…y doc Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…uous positions Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…nt scopes Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This was referenced Jul 28, 2026
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.
Summary
Closes #978 (epic #975). Adds one atomic, revisioned ordering contract per root/category scope so a reorder can never partially persist and stale writers get an explicit 409.
tile_order_revisions(migration0018_tile_order_revisions):scope_key(parent category ID,0= root) →revision(CAS counter, lazily created at 1).backend/app/routers/tile_order.py:GET /api/tile-order?parent_category_id=→ authoritative order + current revision.PUT /api/tile-order— in ONE transaction:app/tile_order.py):(sort_order, item_type_priority(category=0,image=1), item_id)— never labels/names.python -m app.tile_order: walks every scope, rewrites contiguous positions, initializes revision rows.entity="tile"(tile.reorderspan,reorder.persistedlog,hriv_reorder_*metrics); bodyoperation_idsupersedes the header for this endpoint.parent_id/category_id); legacyPUT /categories/reorder+PUT /images/reorderkept for the staged frontend migration (Implement a navigation-safe frontend reorder coordinator and save-state UX #979–Migrate Manage Categories to the shared ordering workflow and complete end-to-end verification #982), documented as deprecated indocs/tile-ordering.md.Stacking
Stacked on PR #993 (#977 telemetry) which is stacked on PR #992 (#976 fixture); this diff includes their commits until they merge. Tile-order-only changes are in commit 4ea973c.
Testing
backend/tests/test_tile_order.py: unit tests (canonical rule, validation, mocked endpoint 400/409/success) + PostgreSQL integration tests against the Establish a production-scale reorder fixture and deterministic failure reproduction #976 fixture: atomic mixed commit, rollback of both entity types on failure, duplicate/missing/foreign rejection, CAS exclusivity (second writer with same revision → 409), membership preservation, bounded statement count (600+ image gallery vs small scope), deterministic normalization.0018, revision id 25 chars).Needs human verification
tile.reorderspans /entity="tile"metrics visible in Grafana/Tempo/Loki after deployment.Link to Devin session: https://app.devin.ai/sessions/414754bd88374dc693f47100ac269e78