Repository navigation
fix: reject duplicate document source bytes - #459
Merged
Merged
Conversation
| from alembic import op | ||
| from sqlalchemy import text | ||
|
|
||
| revision: str = "5e6f7a8b9c0d" |
| from sqlalchemy import text | ||
|
|
||
| revision: str = "5e6f7a8b9c0d" | ||
| down_revision: str = "4d5e6f7a8b9c" |
|
|
||
| revision: str = "5e6f7a8b9c0d" | ||
| down_revision: str = "4d5e6f7a8b9c" | ||
| branch_labels: Sequence[str] | None = None |
| revision: str = "5e6f7a8b9c0d" | ||
| down_revision: str = "4d5e6f7a8b9c" | ||
| branch_labels: Sequence[str] | None = None | ||
| depends_on: Sequence[str] | None = None |
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
We replace filename-based ingestion rejection with a SHA-256 check of the downloaded original bytes. Different bytes under the same filename are accepted; identical bytes fail the job with
ALREADY_EXISTSbefore parsing or billing, including unchangeddocument_idupdates.Related task: reported duplicate-upload exception.
Verification
uv run --no-sync --all-packages pytest apps/worker/tests/contract/test_parse_task_contract.py apps/worker/tests/contract/test_source_content_admission_contract.py -q: 33 passed after rebasing onto currentmain.uv run --no-sync --all-packages pytest apps/api/tests/contract/test_job_creation_contract.py apps/api/tests/migrations/test_schema_contract.py -q: 65 passed, including all 12 index-definition migration scenarios, on the rebased branch.appsandpackages, Pyright across API/worker/shared production paths plus changed API contracts and the migration, andgit diff --checkpassed.Detailed review and ablation report. URL transport and external webhook delivery were not exercised; webhook outbox creation and dispatch requests were verified locally.
Deployment Notes
5e6f7a8b9c0d, roll out workers, then remove the API filename gate. Older workers do not reserve content hashes; full enforcement requires the worker rollout to finish.Checklist