feat(judgement,approvals,ui): action classes are records with a level, history and reset; the precedent guard reads the class level (#2003)
This commit is contained in:
15 files changed
+900
-16
No files matched your search
@@ -0,0 +1,36 @@
|
||||
-- +goose Up
|
||||
-- An action class is what earned autonomy belongs to: one connector's action on
|
||||
-- one kind of target in one environment. A class is made the first time an
|
||||
-- action of it is judged, at the level its kind of action starts at, and its
|
||||
-- decisions stay in judgement.decisions under the same four names. A target
|
||||
-- that moves environment is a different class, which starts as any new one.
|
||||
CREATE TABLE judgement.classes (
|
||||
id uuid PRIMARY KEY,
|
||||
org_id text NOT NULL,
|
||||
connector text NOT NULL,
|
||||
action text NOT NULL,
|
||||
target_kind text NOT NULL,
|
||||
environment text NOT NULL,
|
||||
read_only boolean NOT NULL,
|
||||
level text NOT NULL CHECK (level IN ('act_quietly', 'act_and_tell', 'propose_and_wait', 'escalate', 'never')),
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
reset_at timestamptz,
|
||||
UNIQUE (org_id, connector, action, target_kind, environment)
|
||||
);
|
||||
|
||||
-- A reset returns a class to its default and keeps what led there.
|
||||
CREATE TABLE judgement.class_resets (
|
||||
id uuid PRIMARY KEY,
|
||||
org_id text NOT NULL,
|
||||
class_id uuid NOT NULL REFERENCES judgement.classes (id),
|
||||
from_level text NOT NULL,
|
||||
to_level text NOT NULL,
|
||||
by text NOT NULL,
|
||||
at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX class_resets_by_class ON judgement.class_resets (class_id, at);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE judgement.class_resets;
|
||||
DROP TABLE judgement.classes;
|
||||
Reference in new issue
Block a user