Adopt the user's development rule: one lane at a time, no test suites

CLAUDE.md gains a 'How this project is developed' section: strictly
serial Dev (Opus 5) -> QA (Sonnet 5, code quality) -> lead inspection;
commit along the way without requiring every commit to compile; the
user is the tester. docs/loop.md, docs/topo.md and TODO.md are
rewritten to a serial lane order with no test-writing items; the test
targets are removed and tools/gates.sh is lint + layering grep + build.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5.1 committed 2026-09-15 23:55:41 -07:00
1 parent 671b3dfa61
commit 87aeee6f93
15 files changed
+391 -617

No files matched your search

+10 -14
View File
@@ -20,15 +20,14 @@ point; there is no "better" cipher choice to make here.
- **PBKDF2 goes through `CCKeyDerivationPBKDF`** with
`kCCPRFHmacAlgSHA512`, 100 000 rounds, 32 bytes. Password bytes are
UTF-8 of the key string — `Rfc2898DeriveBytes.Pbkdf2(string, …)` uses
UTF-8 (documented .NET behaviour). Pinned by a Python
`hashlib.pbkdf2_hmac('sha512', …)` vector.
UTF-8 (documented .NET behaviour).
- **The magic hash truncates each UTF-16 code unit to a byte**
(`(byte)st[i]`, `Encryption.cs:184`) and hashes a fixed 32-byte
buffer; keys longer than 32 characters contribute only their first 32.
The `<< 23` overlap is reproduced with `UInt32` wrapping arithmetic in
the same order as the C# expression.
- **Salt and IV are fresh per direction and never reused**; Windows
tests pin uniqueness (`EncryptionTests.cs:59-68`) and so do ours.
- **Salt and IV are fresh per direction and never reused**
(`EncryptionTests.cs:59-68` documents the Windows expectation).
- **The sacrificial block is part of the cipher type's contract**: the
writer emits it right after the header, the reader discards the first
16 plaintext bytes. Callers never see it (topo.md handshake 2).
@@ -53,7 +52,7 @@ public struct CipherReader {
}
```
`RandomBytes` is injectable so tests can pin whole streams.
`RandomBytes` is injectable so the lead can reproduce a stream by hand when checking against a Windows capture.
### Consumed
@@ -61,15 +60,12 @@ public struct CipherReader {
## Status / TODO
- [ ] `Sources/MWBCore/MagicHash.swift` + `Tests/MWBCoreTests/MagicHashTests.swift`
with `Tests/Fixtures/magic_reference.py` (run once; vector committed).
- [ ] `Sources/MWBCore/CipherStream.swift`: key derivation, writer, reader.
- [ ] `Tests/MWBCoreTests/CipherStreamTests.swift`: PBKDF2 vector;
round-trip; byte-at-a-time reader equals all-at-once; unique
header per instance; wrong key ⇒ garbage without throwing;
descriptions omit secrets.
- [ ] Note in `docs/perf/README.md`: PBKDF2 at 100 000 rounds SHA-512
costs ~N ms per connection open (measure; it is per direction).
- [ ] `Sources/MWBCore/MagicHash.swift`: `magicNumber(for:)` per §2.1,
every step cited to `Encryption.cs:173-200`.
- [ ] `Sources/MWBCore/CipherStream.swift`: PBKDF2 key derivation,
`CipherWriter`, `CipherReader` (header, sacrificial block,
streaming CBC), cited to `Encryption.cs` and `Common.cs:1528-1558`.
- [ ] `docs/perf/README.md`: note the PBKDF2 cost per connection open.
## Work log