5ca52b5780
Implement POST /api/uploads/{id}/complete. The storage layer now reloads upload
metadata, verifies that every expected chunk exists with the exact expected
length, concatenates chunks in order into a temporary final file, flushes it,
and renames it into data/complete only after assembly succeeds.
The endpoint preserves staging data after completion, rejects incomplete uploads
with a conflict response, and refuses to overwrite an existing completed file.
This keeps failed or duplicate completion attempts explicit rather than silently
clobbering local files.
Extend the model, router, documentation, and test checklist for completion
responses and add integration coverage for successful assembly, incomplete
uploads, staging preservation, and duplicate completion conflicts.
Test Plan:
- just check
Refs: PLAN.md milestone 8
40 lines
1.4 KiB
Markdown
40 lines
1.4 KiB
Markdown
# Test Scenarios
|
|
|
|
Keep this file as the reusable verification checklist while implementing
|
|
`PLAN.md`.
|
|
|
|
## Automated
|
|
|
|
- `just check`
|
|
- Runs formatting, all Rust tests, and clippy.
|
|
- Current coverage:
|
|
- `GET /` serves the static browser page.
|
|
- `GET /healthz` reports `ok`.
|
|
- `POST /api/uploads` creates `meta.json` and chunk directories.
|
|
- `POST /api/uploads` rejects an empty file name.
|
|
- `PUT /api/uploads/:id/chunks/:index` stores validated chunk files.
|
|
- `PUT /api/uploads/:id/chunks/:index` rejects wrong-size chunks.
|
|
- `PUT /api/uploads/:id/chunks/:index` accepts duplicate chunks.
|
|
- `GET /api/uploads/:id` reports completed chunks from disk.
|
|
- `POST /api/uploads/:id/complete` assembles verified chunks.
|
|
- `POST /api/uploads/:id/complete` rejects incomplete uploads.
|
|
|
|
## Manual
|
|
|
|
These scenarios come from `PLAN.md` and should be retested as the matching
|
|
features land.
|
|
|
|
- Upload a small file in one pass.
|
|
- Upload a file larger than one chunk.
|
|
- Kill the browser tab mid-upload and resume.
|
|
- Restart the Rust server mid-upload and resume.
|
|
- Interrupt the network and resume.
|
|
- Retry a duplicate chunk and confirm it is accepted idempotently.
|
|
- Attempt an invalid chunk index and confirm it is rejected.
|
|
- Attempt a wrong-size non-final chunk and confirm it is rejected.
|
|
- Complete an upload and compare the final file with the source file:
|
|
|
|
```sh
|
|
sha256sum source-file data/complete/uploaded-file
|
|
```
|