certal 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +6 -0
- package/README.md +2 -2
- package/dist/runtime/store.js +9 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "certal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Work through the Certal gate: leases, verified batches and operator approvals for every change.",
|
|
5
5
|
"author": { "name": "Paweł Olszewski" },
|
|
6
6
|
"repository": "https://github.com/polszewski-pl/certal",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `certal verify --offline` reported `CHECKPOINT_STATE_MISMATCH` for an untouched database after a repeated request, for example an approval that was sent twice. The kernel counts a repeated request in the state and writes no log entry for it, so the checkpoint and the replayed state differed in that counter. Since 0.1.1 the audit compared them in full. It now leaves out the two counters that the log cannot give back. Any other difference is still an error.
|
|
8
|
+
|
|
3
9
|
## 0.1.3
|
|
4
10
|
|
|
5
11
|
Fixes from an audit of 0.1.2. The kernel and the Lean model are unchanged.
|
package/README.md
CHANGED
|
@@ -205,7 +205,7 @@ Witness stages run as child processes. The time limit of a stage is the smaller
|
|
|
205
205
|
|
|
206
206
|
**File watcher.** With `"watch": true`, a file in a declared scope that changes without a matching batch becomes a human edit: it raises the epoch of that scope and evicts a colliding agent lease. A deleted file counts too. Other scopes are not touched. A write that matches the hash declared in a finalized batch is the agent's own and is not reported.
|
|
207
207
|
|
|
208
|
-
**Offline audit.** `certal verify --offline <db>` replays a copy of the database from the first entry. It compares every stored entry with the replayed one, field by field, checks the chain between entries, compares every stored checkpoint with the replayed state at its position, and compares the operation and approval indexes with the log. It needs no manifest: the operator public keys are stored in the database. A running server starts from its newest checkpoint and does not repeat this audit, so run `verify` on a database that someone else could write. `verify` proves that the stored entries are the ones that the stored events give. It does not prove that a field of an event which does not change the outcome, such as a label of the login method, is the one that was first written.
|
|
208
|
+
**Offline audit.** `certal verify --offline <db>` replays a copy of the database from the first entry. It compares every stored entry with the replayed one, field by field, checks the chain between entries, compares every stored checkpoint with the replayed state at its position, and compares the operation and approval indexes with the log. It needs no manifest: the operator public keys are stored in the database. A running server starts from its newest checkpoint and does not repeat this audit, so run `verify` on a database that someone else could write. A repeated request with the same operation id is answered from the record of the first one and leaves no log entry. The kernel counts such requests in the state, so the state hash of a running server can differ from the one that `verify` prints, in two counters only. `verify` leaves these two counters out when it compares a checkpoint. `verify` proves that the stored entries are the ones that the stored events give. It does not prove that a field of an event which does not change the outcome, such as a label of the login method, is the one that was first written.
|
|
209
209
|
|
|
210
210
|
Limits of this layer:
|
|
211
211
|
|
|
@@ -284,7 +284,7 @@ More limits are listed in [formal/README.md](formal/README.md).
|
|
|
284
284
|
## Checks
|
|
285
285
|
|
|
286
286
|
```bash
|
|
287
|
-
npm run check # structure, lint, typecheck,
|
|
287
|
+
npm run check # structure, lint, typecheck, 80 tests, 47 mutants
|
|
288
288
|
npm run check:formal # token scan, clean lake build, axiom audit, 5,005 vectors, 3 model mutations
|
|
289
289
|
npm run check:all # both
|
|
290
290
|
npm run test:bench # latency of the human lane under agent load
|
package/dist/runtime/store.js
CHANGED
|
@@ -741,8 +741,15 @@ export function replayFromStore(store, hooks, options) {
|
|
|
741
741
|
if (!stored)
|
|
742
742
|
return;
|
|
743
743
|
checkpointAt.delete(state.serverSeq);
|
|
744
|
-
|
|
745
|
-
|
|
744
|
+
// A repeated request is answered from the record of the first one and leaves no log entry, but the
|
|
745
|
+
// kernel counts it, and it counts the secrets that were redacted in it. The log cannot give these two
|
|
746
|
+
// counters back, so they are left out of the comparison. A live state can only be ahead in them.
|
|
747
|
+
const withoutReplayCounters = (s) => computeStateHash({ ...s, metrics: { ...s.metrics, idempotentReplays: 0, redactedSecretsTotal: 0 } });
|
|
748
|
+
const selfConsistent = computeStateHash(stored.state) === stored.stateHash;
|
|
749
|
+
const sameState = withoutReplayCounters(stored.state) === withoutReplayCounters(state);
|
|
750
|
+
const countersAhead = stored.state.metrics.idempotentReplays >= state.metrics.idempotentReplays &&
|
|
751
|
+
stored.state.metrics.redactedSecretsTotal >= state.metrics.redactedSecretsTotal;
|
|
752
|
+
if (!selfConsistent || !sameState || !countersAhead) {
|
|
746
753
|
throw new Error(`CHECKPOINT_STATE_MISMATCH at seq=${stored.serverSeq}: the stored snapshot is not the state that the log gives`);
|
|
747
754
|
}
|
|
748
755
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "certal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Deterministic execution firewall and runtime for AI agents. Zero dependencies, SQLite WAL, write-ahead outbox, human-priority undo, and Lean 4 proofs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Paweł Olszewski",
|