fix(supervise): store queue rows in host sqlite db
This commit is contained in:
@@ -49,51 +49,50 @@ one-off persistence.
|
||||
|
||||
### Database locations
|
||||
|
||||
Queue state remains tied to the mounted per-bottle queue directory:
|
||||
|
||||
```text
|
||||
~/.bot-bottle/queue/<slug>/supervise.db
|
||||
```
|
||||
|
||||
The supervise sidecar already receives that directory at
|
||||
`/run/supervise/queue`, so both the sidecar and host TUI can read and write the
|
||||
same SQLite file without changing backend mounts.
|
||||
|
||||
Audit state uses the host-level local database:
|
||||
Queue and audit state use the host-level local database:
|
||||
|
||||
```text
|
||||
~/.bot-bottle/bot-bottle.db
|
||||
```
|
||||
|
||||
This creates the shared host database that later forge/native lifecycle work can
|
||||
The supervise sidecar receives that database as a writable bind mount at
|
||||
`/run/supervise/bot-bottle.db` and gets the path through `SUPERVISE_DB_PATH`.
|
||||
The existing per-slug queue directory mount remains in place for compatibility
|
||||
with the supervise sidecar contract and any adjacent tooling that still expects a
|
||||
queue directory, but the active queue records live in the host database. This
|
||||
creates the shared host database that later forge/native lifecycle work can
|
||||
extend in separate PRDs.
|
||||
|
||||
### Tables
|
||||
|
||||
`supervise_proposals` lives in the per-queue database:
|
||||
`supervise_proposals` lives in the host database:
|
||||
|
||||
```sql
|
||||
CREATE TABLE supervise_proposals (
|
||||
id TEXT PRIMARY KEY,
|
||||
queue_key TEXT NOT NULL,
|
||||
id TEXT NOT NULL,
|
||||
bottle_slug TEXT NOT NULL,
|
||||
tool TEXT NOT NULL,
|
||||
proposed_file TEXT NOT NULL,
|
||||
justification TEXT NOT NULL,
|
||||
arrival_timestamp TEXT NOT NULL,
|
||||
current_file_hash TEXT NOT NULL,
|
||||
archived INTEGER NOT NULL DEFAULT 0
|
||||
archived INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (queue_key, id)
|
||||
);
|
||||
```
|
||||
|
||||
`supervise_responses` lives in the same per-queue database:
|
||||
`supervise_responses` lives in the host database:
|
||||
|
||||
```sql
|
||||
CREATE TABLE supervise_responses (
|
||||
proposal_id TEXT PRIMARY KEY,
|
||||
queue_key TEXT NOT NULL,
|
||||
proposal_id TEXT NOT NULL,
|
||||
status TEXT NOT NULL,
|
||||
notes TEXT NOT NULL,
|
||||
final_file TEXT,
|
||||
archived INTEGER NOT NULL DEFAULT 0
|
||||
archived INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (queue_key, proposal_id)
|
||||
);
|
||||
```
|
||||
|
||||
@@ -115,8 +114,8 @@ CREATE TABLE supervise_audit_entries (
|
||||
### Compatibility
|
||||
|
||||
The existing helper functions keep accepting `Path` arguments for queue
|
||||
directories. Internally, they map the queue directory to `supervise.db` and
|
||||
perform equivalent operations:
|
||||
directories. Internally, they map the queue directory to a queue key and perform
|
||||
equivalent operations against `~/.bot-bottle/bot-bottle.db`:
|
||||
|
||||
- `list_pending_proposals` returns non-archived proposals without a non-archived
|
||||
response, sorted by arrival time.
|
||||
|
||||
Reference in New Issue
Block a user