Skip to content

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 24 Nov 17:35
· 113 commits to main since this release
b5c15c7

The second release, 0.2 Tenancy (#64): every call carries a scoped key, and the engine knows who exists. It adds three crates, ironflowx-operations, ironflowx-authz and ironflowx-store, and the facade re-exports them as operations, authz and store. examples/embed bootstraps an engine, emits an event, reads it back with a read key and sees that key's emit refused. A 0.1 ledger directory is refused, not migrated (D39).

  • Admin-key recovery (#98): recover_admin_key stores a fresh admin key in a data directory and returns its secret, once: all three scopes, no expiry, origin Recovered, labelled recovered. It is a host's function, not an operation: reaching the directory is the authority. It blocks, takes no engine lock and works beside a running engine, whose next call accepts the key. On a directory never bootstrapped, or whose bootstrap its transaction finds unmarked, it answers RecoverError::NotReady and stores no key; a control.db of another format, or a failure to read or write it, is RecoverError::Store. Revoking the last admin key needs no guard (D34).
  • Open safety (#97): every refused or failed open has a defined outcome, and the engine never deletes a ledger (D32, D40, D41). EngineError gains NotAnEngineRoot (a bare ledger's directory), Format (a control.db of another format), Orphaned (the control plane was lost) and LedgerMissing (the ledger was lost). A bootstrapping open that fails before its ledger is in place undoes itself. An open that finds a committed but unmarked bootstrap and succeeds finishes it: a minted key, whose secret no open returned, is revoked and Opened::lost_secret set, and, without a seed, a replacement is returned. A seeded bootstrap has no such key. The ledger gains open_blocking and open_existing_blocking, which answers the new OpenError::Missing instead of creating a ledger.
  • Everything runs through the engine (#95): LocalOperations, ironflowx-cell's Operations adapter over a bare ledger, is removed, and Engine implements Operations, which gains whoami and list_environments, so Operations always means credentialed (D36). Import the trait to call the engine's operations. An embedder without keys calls Ledger::submit and read. A failed ledger's hint says to reopen the engine. The events scenarios, the crash test (D23) and examples/embed run through an engine.
  • Seeds (#96): Engine::open takes an optional seed, a key the host supplies to be the bootstrap key, and then mints none. On a later open, a seed with a new key ID revokes the current seed and takes its place, leaving other keys alone; a revoked seed opens and stays revoked. Opened::seed reports SeedState::Current or Revoked. A malformed seed is EngineError::MalformedSeed, before anything is read; one whose key ID is already another key's is SeedConflict, and no key changes (D33). Each write of an open holds the root's lock until it ends, even when the open is cancelled.
  • Expiry sticks, and the key cap (#94): a key refused as expired has its expiry recorded, and from then on is never accepted again, whatever the clock does later, across restarts too. If recording fails, the refusal is the same, but a clock set back can accept the key until a later refusal records it (D42). At most 1,000 created keys per environment hold a slot, until each is revoked or its expiry is recorded; at the cap create_key answers the new ErrorKind::ResourceExhausted, retryable after a revoke (D44).
  • List and revoke keys (#93): list_keys pages newest first, 100 keys by default and 1,000 at most, with each key's label, scopes, origin, creator, times and status, never a secret. revoke_key keeps the row, and the key is refused from its next call (D35). A key change whose calling key was revoked or expired meanwhile is Unauthenticated and changes no key, except that a calling key that only expired has its expiry recorded (D42, D43). A failed control-plane read or write is Unavailable, retryable at once, except a failure to record an expiry (D44); the engine stays open, and key operations work while the ledger is Unavailable.
  • Scoped keys (#92): create_key takes scopes (read unless asked otherwise), an optional expiry and an optional label, and returns the secret once, in a CreatedKey, whose KeyInfo says what the key is, its KeyOrigin (in core) included. A key holds no scope its creator lacks and expires no later than its creator (D27, D28). Every operation's scope comes from one exhaustive required_scope (D37); without it a call is the new ErrorKind::PermissionDenied, and its hint names the scope (D31). A key is refused from its expiry on, by the ledger's clock.
  • Bad keys (#108): no key, or an empty one, is Unauthenticated "authentication required". A malformed key is "invalid API key", with a hint naming the key format. An unknown key, a wrong secret and another engine's key get one identical answer with no hint, as a revoked or expired key does; a key of another environment or incarnation is refused by both the lookup and verify (D29, D30).
  • Emit and read with a key (#107): the engine's emit, emit_batch, get_event and list_events admit the key on every call, with no cache. Each event records the key that emitted it, as key:<key-id>, taken from the verified grant; a lint confines Grant::submit_as to the engine (D36).
  • Fixed: secrets in freed memory (#124): parsing and minting a key leave no copy of its secret in freed heap memory (TEN-3). Which keys are accepted does not change.
  • Engine tracer (#91): three new crates. ironflowx-operations holds the engine. Engine::open locks the root, bootstraps a fresh data directory in one control-plane transaction, builds the ledger in staging and renames it into place, and returns the bootstrap key's secret once. ironflowx-authz holds the credentials: the ixk_ key format, its SHA-256 KeyDigest compared in constant time, and verify. ironflowx-store is the control plane, control.db. A call carrying the key is admitted (parse, look up, verify) and can ask whoami and list_environments. Core gains TenantId, ProjectId, Scope, Address, Secret (zeroed on drop, not printable or cloneable), ErrorKind::Unauthenticated and retryable(). Call::with_key arrives and Call loses Clone; OpError gains hint. The behaviors runner runs every feature file and checks each file's count; tenancy.feature lands with ACC-001, 002, 003 and 009 running. D38, D45 and D46.
  • Attribution (#90): every event records who emitted it. Core gains KeyId, Emitter and SubmitAs; Ledger::submit takes a SubmitAs beside the unchanged Submission, ironflowx_events::fold takes the record's Emitter, and both event types gain emitted_by (D36). The ledger format moves to 2, so a 0.1 directory answers Format (D39). A lint confines SubmitAs::key to the credentials crate.
  • README and crate pages (#63, #102): the README states the purpose and what 0.2 is, and shows the architecture with the crate and emit-then-read diagrams. Its links and images are absolute, so they work on crates.io; 0.1.0's example link there is broken. The emit-then-read diagram shows the committed head and applied position as p + 1, as the code does. ironflowx-core's and ironflowx-proto's pages name what they gain.
  • Ledger (#65): at most 16 submissions wait for the writer; more callers wait for a slot (D24). open takes a new <dir>/ledger.lock (D25), so a sealed log, whose own lock is released, still answers Locked to a second opener. A read store whose newest event disagrees with the log is rebuilt. With an empty log, a read store whose applied position cannot be read answers Io and is kept, and one with recorded progress answers Corrupt before genesis is written. open syncs the parent of each directory it creates. If the writer dies, a submission queued or being decided answers Unavailable, not Unknown; only one whose append began answers Unknown.
  • Docs: the C3 and restart diagrams no longer show a pending view or a rollback, and the restart diagram writes the applied position as one past the record. The Corrupt runbook adds the case where the ledger refuses a record, and narrows when segment-log's repair truncate refuses a class F plan. A sealed log's first append makes reads Unavailable too. The emit-read diagram's fold runs after the ack, not asynchronously. invariants.md: the public-API check covers every workspace crate, and __fault-points is an opt-in no published crate enables, not one no build can enable.
  • Crash test (#89): the fault hook and FaultPoint move into ironflowx-core, behind its own __fault-points, which ironflowx-cell's forwards to; no behavior change. ci/no-fault-points.sh allows a published crate to turn on a dependency's __fault-points only from its own feature of that name (D23).
  • Crash test (#99): kills inside a bootstrap, its undo, a finishing open and a seed rotation, each with one defined outcome (TEN-9, TEN-11, TEN-12); the child opens with the parent's seed, and tells it each key it is about to store over a socket of their own (D23). Every event's emitter is checked. ironflowx-store and ironflowx-operations gain the hidden __fault-points; no behavior change.
  • Crash test (#100): kills before and after the commits of create_key, revoke_key and a recorded expiry, and once each is answered (TEN-11, TEN-13). A created key is told to the parent before its commit, so that exact key is proven listed, or not; with __fault-points, the hook is told its secret too (TEN-3's stated exception). No behavior change.
  • Tenancy close-out (#101): a test searches an engine's data directory, while it runs and after close, and all its process prints, and finds no secret (TEN-3). control.db's format is 1, its schema pinned by a test (D47). The check that no error type holds a Secret reads rustdoc's JSON, private fields included, and the API checks of LED-9, TEN-4 and TEN-8 see through public aliases, callables and generics. No behavior change.
  • Docs gaps: the facade is in the modules table; Ledger::open and read show their Send + 'static bounds and runtime panics, and the Interfaces section points at public-api/ for the full API. Documented: cancelling an admitted submit can still commit; a panicking read query fails the ledger; IDs and tokens parse only in canonical lowercase; a cursor past every sequence lists from the newest; the ledger format version; the arbitrary_precision key (D12). D8 names the environment ID; D25 records why ledger.lock exists. Two Open-table rows, each with a new test: a record that does not decode, and a log without a genesis record. The 0.1 coverage sweep leaves docs/ for a pinned link.
  • Dependencies (D26): tokio, rusqlite and getrandom are caret ranges, not exact pins, so an embedder can use a later compatible release. serde_json and segment-log-core stay exact.
  • Glossary: defines submission, writer, read store, fold, sealed log, idempotency key, environment reference and fault point; Cell is marked not built in 0.1; the event clock stamps every record after the genesis record. The docs say "record" and "position" for the ledger's own, keeping "log record" and "log offset" for the segment log's, and "fault point" replaces "kill point".