API Hardening, bug fixes, code cleanup#23
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A broad maintenance pass over the server, CLI, and tooling, plus one protocol
addition: record-level public content-addresses.
Protocol: public record hashes
Records of types with private fields now have a second content-address — the SHA-256 of the record with those fields stripped. Public manifests list records by this public hash, and the record endpoints resolve either address, so any reader can verify that hashing the document they received reproduces the address they requested. The version-level
public:hash now rolls up from stored per-record hashes instead of being recomputed from record bodies.public_record_hashcolumn onversion_records(additive migration, NULL when the type has no private fields — the common case)/protocolandai.txt; golden-value tests pin the formatAccess control and hardening
publicflag) applied uniformly on every read path — manifests, diffs, batch fetch, provenance, SQLite exports, and ARK resolutionwritescope; destructive actions are gated by per-resource org roles. Collection-scoped API keys are enforced on writesMIRROR_ADMIN_EMAILS) or an admin API key; CORS uses an explicit origin allowlist (CORS_ORIGINS)MAX_FILE_UPLOAD_BYTES, default 100 MB); pushed schemas are size/pattern-bounded before compilation; required secrets fail fast in production;generate-sqlis rate-limited per user/IPCLI
pullrewritten: handles incremental (?since=) pulls, follows manifest pagination cursors, chunks batch fetches, streams responses, and never writes the manifest/HEAD if a fetch failssrc/lib/core/and shared with the server — the wire format is now defined in exactly one place, locked by testsOps tooling
tool:backupstreams to S3 (constant memory regardless of dump size)tool:restore(lists backups; restores only with explicit--yes) andtool:pruneBackups(daily/weekly retention,--dry-run)tool:cleanupSessionsclears expired negotiate sessions; all three are scheduled via cronCode quality
src/lib/core/(hashing, semver, privacy, validation, version hashes) — 72 testsbcrypt,nodemailer,@sinclair/typebox), dead modules, design-playground routes, and the stalepackage-lock.json;packages/cliis now a proper pnpm workspace member{ error, statusCode }response shape; previously-swallowed errors are logged (exports now reportfiles_missingin their manifest)Docs
README reconciled with the code (real push endpoints, full env-var table, accurate project structure and CLI examples); scaling plan rewritten in
planning/.Notes for deploy
MIRROR_ADMIN_EMAILS,CORS_ORIGINS,MAX_FILE_UPLOAD_BYTES;SESSION_SECRETis now required in production