@team-semicolon/semicolony-cli 4.18.74 → 4.18.76
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.
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
-- 182_worker_agent_installation_kind.sql
|
|
2
|
+
--
|
|
3
|
+
-- Distinguish human-operated worker devices from service-hive Agent runtime
|
|
4
|
+
-- installations without replacing the existing worker_devices compatibility
|
|
5
|
+
-- key or changing any existing Human row identity.
|
|
6
|
+
|
|
7
|
+
ALTER TABLE semicolony.worker_devices
|
|
8
|
+
ADD COLUMN IF NOT EXISTS installation_kind TEXT NOT NULL DEFAULT 'human-device';
|
|
9
|
+
|
|
10
|
+
ALTER TABLE semicolony.worker_devices
|
|
11
|
+
ADD CONSTRAINT worker_devices_installation_kind_check
|
|
12
|
+
CHECK (installation_kind IN ('human-device', 'agent-runtime')),
|
|
13
|
+
ADD CONSTRAINT worker_devices_agent_installation_identity_check
|
|
14
|
+
CHECK (
|
|
15
|
+
installation_kind <> 'agent-runtime'
|
|
16
|
+
OR (
|
|
17
|
+
device_id = 'hermes-principals@hermes'
|
|
18
|
+
AND installed_profile_id = 'semo-ops-worker-agent'
|
|
19
|
+
AND kb_access_mode = 'worker-gateway'
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
CREATE INDEX IF NOT EXISTS idx_worker_devices_installation_kind_profile
|
|
24
|
+
ON semicolony.worker_devices (installation_kind, installed_profile_id, status);
|
|
25
|
+
|
|
26
|
+
COMMENT ON COLUMN semicolony.worker_devices.installation_kind IS
|
|
27
|
+
'human-device for a person-operated Worker; agent-runtime for a service-hive Agent installation.';
|
|
28
|
+
|
|
29
|
+
CREATE OR REPLACE VIEW semicolony.v_worker_environment_status AS
|
|
30
|
+
SELECT
|
|
31
|
+
wd.device_id,
|
|
32
|
+
wd.worker_id,
|
|
33
|
+
wd.display_name,
|
|
34
|
+
wd.hostname,
|
|
35
|
+
wd.os,
|
|
36
|
+
wd.workspace_root,
|
|
37
|
+
wd.installed_profile_id,
|
|
38
|
+
wd.installed_profile_version,
|
|
39
|
+
wd.tool_adapters_enabled,
|
|
40
|
+
wd.kb_access_mode,
|
|
41
|
+
wd.last_seen_at,
|
|
42
|
+
wd.last_doctor_status,
|
|
43
|
+
wd.last_doctor_summary,
|
|
44
|
+
wd.setup_progress,
|
|
45
|
+
wd.status,
|
|
46
|
+
wd.updated_at,
|
|
47
|
+
COALESCE(
|
|
48
|
+
jsonb_agg(
|
|
49
|
+
jsonb_build_object(
|
|
50
|
+
'local_hive_id', lh.local_hive_id,
|
|
51
|
+
'workload_type', lh.workload_type,
|
|
52
|
+
'status', lh.status,
|
|
53
|
+
'migration_target', lh.migration_target,
|
|
54
|
+
'expiry_at', lh.expiry_at,
|
|
55
|
+
'last_seen_at', lh.last_seen_at
|
|
56
|
+
)
|
|
57
|
+
) FILTER (WHERE lh.local_hive_id IS NOT NULL),
|
|
58
|
+
'[]'::jsonb
|
|
59
|
+
) AS local_hives,
|
|
60
|
+
wp.active_release_id,
|
|
61
|
+
active_release.version AS active_release_version,
|
|
62
|
+
wd.applied_release_id,
|
|
63
|
+
wd.applied_release_version,
|
|
64
|
+
wd.applied_at,
|
|
65
|
+
wd.installation_kind,
|
|
66
|
+
wd.device_id AS installation_id
|
|
67
|
+
FROM semicolony.worker_devices wd
|
|
68
|
+
LEFT JOIN semicolony.local_hives lh
|
|
69
|
+
ON lh.device_id = wd.device_id
|
|
70
|
+
LEFT JOIN semicolony.workspace_profiles wp
|
|
71
|
+
ON wp.profile_id = wd.installed_profile_id
|
|
72
|
+
LEFT JOIN semicolony.worker_profile_releases active_release
|
|
73
|
+
ON active_release.release_id = wp.active_release_id
|
|
74
|
+
GROUP BY wd.device_id, wp.active_release_id, active_release.version;
|
|
75
|
+
|
|
76
|
+
COMMENT ON COLUMN semicolony.v_worker_environment_status.installation_id IS
|
|
77
|
+
'Runtime-neutral installation identity; backed by device_id for compatibility.';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- Migration 181 made source_repository nullable for DB-native common-skill
|
|
2
|
+
-- releases, but migration 161 also created a separate non-empty CHECK. A
|
|
3
|
+
-- PostgreSQL CHECK containing `IS NOT NULL` rejects the intended NULL even
|
|
4
|
+
-- after the column-level NOT NULL constraint is removed.
|
|
5
|
+
--
|
|
6
|
+
-- The composite skill_releases_provenance_check remains authoritative: it
|
|
7
|
+
-- requires NULL Git provenance for source_kind='db' and non-empty repository
|
|
8
|
+
-- provenance for source_kind='git-legacy'. Hash format checks remain in place;
|
|
9
|
+
-- they naturally accept NULL for DB-native rows and validate legacy values.
|
|
10
|
+
|
|
11
|
+
ALTER TABLE semicolony.skill_releases
|
|
12
|
+
DROP CONSTRAINT IF EXISTS skill_releases_source_repository_check;
|
|
13
|
+
|
|
14
|
+
COMMENT ON CONSTRAINT skill_releases_provenance_check
|
|
15
|
+
ON semicolony.skill_releases IS
|
|
16
|
+
'Source-specific provenance contract: DB releases have task/base lineage; legacy releases retain complete Git lineage.';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
-- 183_db_native_skill_release_constraints.sql
|
|
2
|
+
--
|
|
3
|
+
-- Migration 181 made Git provenance nullable for DB-native authoring, but the
|
|
4
|
+
-- inline checks created by migration 161 still reject NULL before the new
|
|
5
|
+
-- source-kind provenance check can accept it. Replace those legacy checks with
|
|
6
|
+
-- nullable format checks; skill_releases_provenance_check continues to require
|
|
7
|
+
-- all three values for git-legacy rows.
|
|
8
|
+
|
|
9
|
+
ALTER TABLE semicolony.skill_releases
|
|
10
|
+
DROP CONSTRAINT IF EXISTS skill_releases_source_repository_check,
|
|
11
|
+
DROP CONSTRAINT IF EXISTS skill_releases_git_commit_sha_check,
|
|
12
|
+
DROP CONSTRAINT IF EXISTS skill_releases_git_tree_oid_check;
|
|
13
|
+
|
|
14
|
+
ALTER TABLE semicolony.skill_releases
|
|
15
|
+
ADD CONSTRAINT skill_releases_source_repository_format_check
|
|
16
|
+
CHECK (
|
|
17
|
+
source_repository IS NULL
|
|
18
|
+
OR NULLIF(btrim(source_repository), '') IS NOT NULL
|
|
19
|
+
),
|
|
20
|
+
ADD CONSTRAINT skill_releases_git_commit_sha_format_check
|
|
21
|
+
CHECK (
|
|
22
|
+
git_commit_sha IS NULL
|
|
23
|
+
OR git_commit_sha ~ '^[0-9a-f]{40}$'
|
|
24
|
+
),
|
|
25
|
+
ADD CONSTRAINT skill_releases_git_tree_oid_format_check
|
|
26
|
+
CHECK (
|
|
27
|
+
git_tree_oid IS NULL
|
|
28
|
+
OR git_tree_oid ~ '^[0-9a-f]{40}$'
|
|
29
|
+
);
|
|
30
|
+
|