1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00

Add attachments (protocol 4), their edge-case tests, and handoff docs

- One optional attachment per message, any size up to the server's
  MaxAttachmentSize (default 1G), sent and stored in 1 MB parts, checked
  with its SHA-256. Uploaded before its message (UploadStart, UploadChunk),
  then attached by the PushMessage in the same transaction; uploads never
  pushed expire after UploadTimeout. Read back a part at a time
  (GetAttachment).
- Replicated separately, after the messages: the message carries the size
  and SHA-256, then each check-in lists what the peer is missing
  (MissingAttachments) and sends the parts from where it stopped. Over the
  receiver's limit, the attachment is marked not kept.
- Deleted with its message by the retention, parts cleaned up in the
  background. Schema v7 (attachments, blobs, blob_chunks), replacing the
  unused attachements table.
- DLL: PushMessageWithFile/WithData, SaveAttachment, LoadAttachment,
  GetMessageAttachmentSize, IsMessageAttachmentReady. Python: push(...,
  attachment=), get_attachment(), save_attachment(). Tools: PushMessage -a,
  GetAttachment. The release smoke test round-trips one.
- Tests/Attachments-Test.ps1 (39 checks) and Tests/AttachmentEdges-Test.ps1
  (51 checks, with a raw protocol client): wrong SHA-256, bad parts,
  others' uploads, expiry, replication resuming after a kill, a corrupted
  stored copy. Found: a corrupted copy is re-sent to peers forever, noted
  as open item 3 in Notes.md with a proposed fix.
- CLAUDE.md: how to build, test, the traps and working rules, for the next
  session. Notes.md and the Design docs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVPXGLs3KK1MAQn3ouP
This commit is contained in:
2026-11-08 18:56:15 +01:00
parent 9caf816dca
commit df61ef9719
42 changed files with 4920 additions and 106 deletions
+7 -4
View File
@@ -24,11 +24,14 @@ database:
view with `is_json = 1`;
- if `python` is on the PATH, reads them and pushes one with
`python\bakashrot.py`;
- pushes a 3 MB attachment with `PushMessage.exe -a` and reads it back
identical with `GetAttachment.exe`;
- then force-kills the server and deletes everything.
The end-to-end tests in `Tests/` cover much more (names, replication, big
messages, GetMessages, the Python client), but against `Build\` (PB 5.73)
and `BenchServer.exe`, not the release.
messages, GetMessages, the Python client, retention, attachments and their
edge cases), but against `Build\` (PB 5.73) and `BenchServer.exe`, not the
release. The list is in `CLAUDE.md`.
## Fixed: the release needed the Visual C++ runtime
@@ -110,7 +113,7 @@ in `Tests/` already, to be pointed at the release instead.
10. **Version hygiene**:
- `-Version 1.0.0` refuses a dirty tree instead of appending `-dirty`;
- the release commit is tagged (`v1.0.0`), the version comes from it;
- `VERSION.txt` gives the protocol version (3) and the runtime needed;
- `VERSION.txt` gives the protocol version (4) and the runtime needed;
- the Python client is checked on the oldest version it claims (3.8),
not only on the latest (3.14 here).
@@ -210,7 +213,7 @@ Notes for when the builds move to a pipeline.
- `Build.ps1` ends by running the server, which waits on its console:
needs a `-NoRun` switch. It also writes private keys into `Build\`,
which must never be published as an artifact.
- The tests use fixed ports (12399 for the release, 12401-12409 for
- The tests use fixed ports (12399 for the release, 12401-12414 for
`Tests/`): parallel jobs on one runner collide, make them parameters
or pick free ones.
- One entry point that runs every test (`Tests/*.ps1`, the handshake