@team-semicolon/semicolony-cli 4.18.87 → 4.18.89
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/dist/bundle.js +1081 -1088
- package/migrations/189_lease_free_skill_staging.sql +56 -0
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
-- 189_lease_free_skill_staging.sql
|
|
2
|
+
--
|
|
3
|
+
-- Staging a skill no longer requires a task-scoped capability lease, so the
|
|
4
|
+
-- lease columns on the staging-side tables stop being mandatory.
|
|
5
|
+
--
|
|
6
|
+
-- Why: `semo skill lease issue` opens a direct operator database pool. Worker
|
|
7
|
+
-- devices hold only a Gateway URL and token, so no worker but the operator
|
|
8
|
+
-- could ever issue one — every command behind a lease was unusable on the rest
|
|
9
|
+
-- of the fleet. Reads were freed in the preceding change; this frees the
|
|
10
|
+
-- staging writes. Authorization moves to the transport credential's
|
|
11
|
+
-- `skills:write` scope, enforced at the route.
|
|
12
|
+
--
|
|
13
|
+
-- What this costs, deliberately accepted: rows written through the lease-free
|
|
14
|
+
-- path record no lease provenance. The question "under which approved lease was
|
|
15
|
+
-- this release staged" becomes unanswerable for them. Existing rows keep their
|
|
16
|
+
-- lease and their foreign key; nothing is rewritten or dropped.
|
|
17
|
+
--
|
|
18
|
+
-- What this does NOT touch: `skill_release_activations.lease_id` and
|
|
19
|
+
-- `skill_release_retirements.lease_id` stay NOT NULL. Activation and retirement
|
|
20
|
+
-- are the two operations that reach every device, and they keep the full
|
|
21
|
+
-- lease chain — approval reference, expiry, revocation, audit.
|
|
22
|
+
--
|
|
23
|
+
-- `skill_change_proposals` also keeps its lease. Its device_id and task_id are
|
|
24
|
+
-- NOT NULL and come from the lease context, so freeing it would widen the audit
|
|
25
|
+
-- loss well past staging, and authoring is inherently task-scoped anyway.
|
|
26
|
+
--
|
|
27
|
+
-- The runner owns the transaction boundary, so no BEGIN/COMMIT here, and it
|
|
28
|
+
-- retargets the `semicolony.` qualifier to the active schema.
|
|
29
|
+
|
|
30
|
+
ALTER TABLE semicolony.skill_releases
|
|
31
|
+
ALTER COLUMN created_under_lease_id DROP NOT NULL;
|
|
32
|
+
|
|
33
|
+
ALTER TABLE semicolony.project_skill_releases
|
|
34
|
+
ALTER COLUMN lease_id DROP NOT NULL;
|
|
35
|
+
|
|
36
|
+
-- The propagating operations must not have been loosened by this migration.
|
|
37
|
+
DO $$
|
|
38
|
+
DECLARE
|
|
39
|
+
loosened TEXT;
|
|
40
|
+
BEGIN
|
|
41
|
+
SELECT string_agg(format('%s.%s', table_name, column_name), ', ')
|
|
42
|
+
INTO loosened
|
|
43
|
+
FROM information_schema.columns
|
|
44
|
+
WHERE table_schema = 'semicolony'
|
|
45
|
+
AND is_nullable = 'YES'
|
|
46
|
+
AND (table_name, column_name) IN (
|
|
47
|
+
('skill_release_activations', 'lease_id'),
|
|
48
|
+
('skill_release_retirements', 'lease_id'),
|
|
49
|
+
('skill_change_proposals', 'lease_id')
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
IF loosened IS NOT NULL THEN
|
|
53
|
+
RAISE EXCEPTION 'activation/retirement lease provenance must stay mandatory: %', loosened;
|
|
54
|
+
END IF;
|
|
55
|
+
END
|
|
56
|
+
$$;
|