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

17 Commits

Author SHA1 Message Date
aziascreations 17ec69c03c Removed the PureBasic version, Fixed refused certificates seen as lost connections
OldSource/ is deleted, with its PB-MessagePack submodule: it stays in git
history (up to 68966a8). What of its notes still holds is in
Source/docs/known-issues.md (the threat model, the known limits, ideas
for later); the old Docker image's publishing notes are in revamp.md's
step 13, the wheel's and releases' in Source/README.md. The Rust tests
are now the one runner. readme.md describes the Rust version.

The server now closes gently after refusing a certificate (shutdown,
then reading until the client closes, 1 s at most): closing at once
reset the connection, which could beat TLS's alert to the client
(ConnectionLost instead of AuthRejected, 14 of 160 runs under load).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 00:42:19 +01:00
aziascreations 68966a8031 Added replication, Added clean stops, logs and releases (0.2.0)
Step 11: the servers replicate by name (push_to and accept_from), their
messages and attachments, damaged copies asked for again.

Step 12: the server stops cleanly on SIGTERM/SIGINT (Ctrl+C, Ctrl+Break
and the console closing on Windows), committing what was queued; logs go
to the console, BAKASHROT_LOG sets the level. release.py builds a
release per platform (the programs, the DLL, a Python wheel with the
library, THIRD-PARTY.txt) and smoke-tests it; CI runs it on v* tags.
Built for size (opt-level "s"): 25-31% smaller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 20:38:32 +01:00
aziascreations e044fcf359 Moved the PureBasic version to OldSource/, Started the Rust rewrite in Source/
The rewrite's plan and decisions are in revamp.md. Steps 0 to 10 are done:
the workspace and checks, bakashrot-proto, bakashrot-pki and
bakashrot-cert, bakashrot-config, bakashrot-storage (schema v9), the
server and the client library (every request but replication's,
attachments and retention included), the C DLL with its C, PureBasic and
Python bindings, and the bakashrot tool. Step 11 (replication) is next.

OldSource/ is the old implementation, kept building and passing as the
reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVTGs2SsufaH6zquzcb
2026-11-14 12:47:40 +01:00
aziascreations d0048b17c8 Labeled the server image for ghcr.io, Built it without attestation
The Dockerfile sets org.opencontainers.image.source (and description,
licenses), and the build command adds --provenance=false: with the
default attestation the image is pushed as an index, where GitHub doesn't
read the label, so the package wasn't linked to the repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 23:18:20 +01:00
aziascreations aa8b2c1780 Added the Linux wheel
make_wheel.py --linux packs bakashrot.py with the Linux client library
only (named BakaShrot_Client.dll, as the repository does on Linux),
libsodium coming from the system (libsodium23), glibc 2.34+, tagged
linux_x86_64. Refuses a library from the other platform. The Windows
wheel is byte-identical to before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 23:16:02 +01:00
aziascreations d0f1866bb3 Fixed a server crash on bad frames under load, Noted the Docker checks
The listener called NetworkServerEvent() while a client thread aborting
called CloseNetworkConnection(), neither under *Server\Mutex: both change
PureBasic's connection list, which segfaulted the server on Linux when
invalid frames came in while clients were busy. Both now hold the mutex.
Every suite passes on Linux (6.41 C and asm), 5.73 compiles it.

Notes.md: the Docker image tested under load, open items 21 (this, fixed),
22 (a leading BOM is dropped) and 23 (a NUL cuts a message).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.0.1
2026-11-11 22:41:42 +01:00
aziascreations 5887e70e70 Added python wheel stuff, Added libsodium's license for packaging
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 21:55:32 +01:00
aziascreations 42bd1f76d9 Added headers, Added license, Added docker example, Cleared trash
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 21:35:28 +01:00
aziascreations 6eedc1ec21 Build the server image on the registry's PureBasic image
Docker/Server now compiles on git.nibblepoker.lu/packages/purebasic:6.41-linux3-trixie-slim
(private: needs a docker login) instead of a local compiler image, so
Docker/Compiler and its hand-copied PureBasic archive are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVRXRpeMy93si5a8cPW
2026-11-11 14:01:05 +01:00
aziascreations 8a90067d1c Merge pull request #1 from aziascreations/timestamps-retention
Timestamps retention
2026-11-10 21:16:16 +01:00
aziascreations 3d960bfa95 Run the server headless on Linux, add Docker images for it
The server no longer stops when it has no console input on Linux: it
reads its own dup of stdin (taken before OpenConsole(), which closes
fd 0; Input() returns "" at EOF there), and SIGTERM/SIGINT stop it like
"quit". Windows is unchanged.

Docker/Compiler: PureBasic 6.41 on debian:trixie-slim (the archive is
copied in by hand and git-ignored). Docker/Server: multi-stage, built
with the C backend and the optimizer, run on debian:trixie-slim with
libsodium and SQLite only, as user bakashrot; config
/etc/bakashrot/server.ini, volume /var/lib/bakashrot, port 12345.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVQCBfcPDfAPqX8z2TF
2026-11-10 19:04:03 +01:00
aziascreations 5270f25ac1 Fix the server on Linux, and test races it showed
Server:
- Storage: #BakaShrot_Storage_SqliteLibrary, the SQLite the server loads:
  sqlite3.dll on Windows, the system's libsqlite3.so.0 on Linux (PB 5.73's
  bundled 3.33 has no JSON functions). The query error check and the
  writer's prepared statements use it too, so a JSON function on a row
  that isn't JSON is refused on Linux as well, not answered with no rows.
- SendPacket: SendNetworkData() returns -1 once the send buffer is full
  (EAGAIN on Linux), which aborted clients reading big answers. Retried
  until nothing goes out for #BakaShrot_SendStallTimeout (10 s).

Tests, timing they relied on:
- Attachments, BigMessages: link failures before the first link are
  expected, Linux refuses at once where Windows retries for ~1 s.
- Restart: a pusher whose server is killed between two pushes sees 100
  (NotConnected), during one 104 (ConnectionLost): both accepted.
- Retention: deletions counted over every retention check, a batch can be
  split over two.
- AttachmentEdges: waits for B's corrupted attachment to be dropped, A
  sends it again at every check-in.

All tests pass on Linux with PB 6.41 (asm and C backends).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVQCBfcPDfAPqX8z2TF
2026-11-10 15:32:22 +01:00
aziascreations 488ffe4bc8 Protocol 6: node identities, error codes, Synchronous, schema v8, examples
- Protocol 5: a client authenticates as a node (Node), its pushes go to the
  section's DefaultTopic unless they name one; old Identities refused at
  start with what to write instead.
- Topics listed by name, ids picked and kept by the server; nodes come from
  client sections, [BakaShrot.Nodes] optional, AcceptNodes = * by default.
- Protocol 6: every refusal carries a code, every client failure too
  (BakaShrot_ErrorCodes.pbi, BakaShrot_GetLastError(), ErrorCode in Python);
  nothing reconnects by itself, delivery is at least once.
- [BakaShrot.Server] Synchronous = FULL (default) or NORMAL, benchmarked.
- Schema v8: browse table and browse_messages view for database tools.
- Tools renamed BakaShrot<Name>, wait for Enter when started from Explorer.
- Examples/SingleServer: a server and a client with scripts (example keys,
  public on purpose).
- Restart-Test.ps1: servers killed mid-traffic and mid-catch-up.
- Docs: one server per node rule, DatabaseError() checked per thread,
  release notes' Compatibility section, Notes "Right now".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVQrLqMQPw9AZnsHqQH
2026-11-09 23:57:55 +01:00
aziascreations df61ef9719 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
2026-11-08 18:56:15 +01:00
aziascreations 9caf816dca Add pushed_at timestamps and per-topic retention
- Every message is stamped with the time its push arrived (UTC ms since
  1970, the server's clock), carried as is by replication. Exposed in
  LatestMessage and Messages, BakaShrot_GetMessagePushedAt() in the DLL,
  Message.pushed_at / .pushed in Python, GetMessages --time,
  GetLatestMessage, and the messages view (pushed_at, pushed_utc).
- [BakaShrot.Retention] in each server's config: a max age per topic, by
  name, id, pattern or *, ages like 30d or 1d12h. A background pass
  (Server/Storage/Retention.pbi, every RetentionInterval seconds) deletes
  what's older, in batches through the writer. node_heads is left as is,
  so ids never go back and peers don't resend what was deleted.
- Replicated messages already past the receiver's max age are skipped on
  arrival, their head still raised so they aren't sent again.
- Schema v6: data.pushed_at (older databases stamped at upgrade time),
  a (topic_id, pushed_at) index, the unused archives table dropped. The
  writer takes the next id from node_heads.
- Folded into protocol 3, not released yet.
- Tests/Retention-Test.ps1 (52 checks), Python checks for pushed_at.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVPXGLs3KK1MAQn3ouP
2026-11-08 17:01:48 +01:00
aziascreations 12fbe5f4da Got close to the final version
comitting Claude's code before the last mile improvements
2026-11-08 13:16:37 +01:00
aziascreations a0daf73c8e Initial commit 2026-11-05 22:45:47 +01:00