You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,22 @@ The format loosely follows Keep a Changelog.
5
5
6
6
---
7
7
8
+
## 0.5.0 — 2026-06-27
9
+
10
+
### Added
11
+
-**`sentinel_events` append-only event log** — new table recording every state transition with `key`, `event`, `owner_id`, `fencing_token`, `metadata`, and `occurred_at`. Indexed on `(key, occurred_at, fencing_token)` for efficient history queries.
12
+
-**`write_event` / `async_write_event`** — internal helpers that write events atomically within the same transaction as each state transition. Events and lease changes commit together or not at all.
13
+
-**`SentinelEvent` enum** — typed event constants (`ACQUIRED`, `REJECTED`, `EXECUTING`, `COMPLETED`, `EXPIRED`, `RECONCILING`, `RESET`, `RELEASED`) used across sync and async paths.
14
+
-**`history(conn, key, *, limit=50)`** — query the event log for any key, returns a list of `EventRecord` dataclasses ordered oldest first.
15
+
-**`sen history <key>`** — CLI command to print the full execution history for a key directly from the terminal. Accepts `--limit` to cap results.
16
+
-**Fencing token rotation on reconciliation** — `reconcile()` now issues a new fencing token via `nextval('sentinel_token_seq')` at the moment it transitions a lease to `reconciling`. The original worker's token is immediately invalidated.
17
+
-**`RESET` and `RELEASED` events** — explicit events written when a lease is reset by the reconciler or explicitly released by the caller.
18
+
19
+
### Changed
20
+
-`TIMESTAMPTZ` replaces `TIMESTAMP` across all lease columns for correct timezone-aware behaviour in distributed environments.
Copy file name to clipboardExpand all lines: README.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,7 @@ Sentinel ships with `sen`, a command-line tool for inspecting lease state direct
63
63
64
64
```bash
65
65
sen inspect <key>
66
+
sen history<key> --limit 20
66
67
```
67
68
68
69
`sen` reads `DATABASE_URL` from your environment or a `.env` file automatically.
@@ -102,6 +103,8 @@ result = sentinel.once(
102
103
)
103
104
```
104
105
106
+
---
107
+
105
108
### Reading the result
106
109
107
110
```python
@@ -124,6 +127,29 @@ else:
124
127
125
128
---
126
129
130
+
## Execution History
131
+
132
+
Sentinel records every state transition to an append-only event log. Every acquire, rejection, execution start, completion, expiry, and reconciliation is written atomically with the lease change that caused it.
The sequence of events is the ground truth for what happened to any execution key. A `reconciling` event followed by `acquired` means a new worker took over. A `reconciling` event followed by `completed` means the original worker finished inside the uncertainty window. An `expired` event means the worker raised an exception and the lease was collapsed immediately.
148
+
149
+
The log does not resolve uncertainty — it records it honestly.
150
+
151
+
---
152
+
127
153
## Async
128
154
129
155
If you're working in an async context, use `AsyncSentinel`:
@@ -254,7 +280,6 @@ The core execution semantics are stable as of 0.4.0. Reconciliation tooling and
0 commit comments