Files
zeekay 3bb86da715 Add sdk/: the shared framework, from the private build
The code is the private build's sdk/ with the module path swapped and the
hostnames, private issue refs and incident prose taken out. Its self-contained
tests come with it; the framework's own tests need the private test kits and stay
behind. Builds and vets in this module; needs luxfi/kms v1.12.26.

Claude-Session: https://claude.ai/code/session_015XYKLn69gF4x75RWePpDBV
2026-11-20 20:25:04 -08:00

31 lines
1.2 KiB
Go

package kit
import (
"testing"
sqlitedrv "github.com/hanzoai/sqlite"
)
// Codec skips the test when the C codec is absent, naming why in the caller's
// own words.
//
// ENCRYPTION IS NOT THE REASON. A keyed store is ciphertext on every build —
// hanzoai/sqlite encrypts through the pure-Go SQLCipher codec envelope, and a
// database written by either engine reads back under the other. What the envelope
// does differently is share: it decrypts to a plaintext copy PRIVATE to the handle
// and seals it on close, so a second opener sees the last sealed state rather than
// the live writer, and durability is per-checkpoint rather than per-commit.
//
// So this is for tests whose subject is that sharing — two openers of one store,
// or a reload observing another handle's write. Those properties belong to the C
// codec, which encrypts pages in place inside the pager. So does conversion: cek
// turns a plaintext store into a keyed one with sqlcipher_export, a SQL function
// only the C engine has, so a test that needs cek to publish a store waits on the
// same build.
func Codec(t *testing.T, why string) {
t.Helper()
if !sqlitedrv.CodecLinked() {
t.Skip("no C codec linked: " + why)
}
}