Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m34s
Foundation / postgres-tools (push) Successful in 26s
Foundation / server-image (push) Successful in 4m30s
Foundation / image (push) Successful in 5m46s
ADR-0182 section 16, from playtesting region 16 at its 256-life cap. - Bud costs: the region host's cache of each genome's bud cost was keyed by genome only, so after a tuning adoption the client kept the old cost (or "cannot bud"). It now clears when the rules' encoding changes. - Wildlife cap: reproduction.wildlife_cap (optional, 0..organism cap, 0 = the organism cap) refuses buds of parents without an account at that many lives, keeping the slots above it for players. Bits 17-31 of the energy-cycle word, so older rules keep their bytes. DEV file: 200. - Schema 67: admin command kinds take_reserve (8: up to the amounts from a life's reserve to the spent pool) and remove_wildlife (9: every life without an account, as remove_cell). - Region view: caps; the portal shows lives against the cap. - Portal: Take reserve in the inspector, Remove all wildlife, and marking cells on the map (shift+click, shift+drag) for bulk removal; the guided editor lists optional keys the base revision lacks. - Client: a refused bud says the region may be full. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
2.9 KiB
PL/PgSQL
55 lines
2.9 KiB
PL/PgSQL
-- Admin take and cull (ADR-0182 section 16, 2026-10-28). Two more admin command kinds for
|
|
-- testing a live region: take_reserve (8) moves up to the given amounts from one life's
|
|
-- reserve to the spent pool, the inverse of grant_reserve; remove_wildlife (9) removes every
|
|
-- life without an account at once, as remove_cell does one.
|
|
|
|
ALTER TABLE evolution.admin_commands DROP CONSTRAINT admin_commands_kind_check;
|
|
ALTER TABLE evolution.admin_commands ADD CONSTRAINT admin_commands_kind_check
|
|
CHECK (kind BETWEEN 1 AND 9);
|
|
|
|
-- Queues a command (the same shapes the owner accepts). Spawning takes its identities from the
|
|
-- world's life allocator, so they never meet a player's.
|
|
CREATE OR REPLACE FUNCTION evolution.admin_enqueue_command_v1(p_world evolution.u64,
|
|
p_region evolution.u64, p_kind integer, p_count integer, p_target evolution.u64,
|
|
p_energy evolution.u64, p_carbon evolution.u64, p_nitrogen evolution.u64,
|
|
p_phosphorus evolution.u64, p_other evolution.u64, p_subject text, p_reason text)
|
|
RETURNS TABLE (command_id bigint, target evolution.u64)
|
|
LANGUAGE plpgsql SECURITY DEFINER SET search_path = pg_catalog, pg_temp AS $$
|
|
#variable_conflict use_column
|
|
DECLARE
|
|
has_amount boolean := p_energy + p_carbon + p_nitrogen + p_phosphorus + p_other > 0;
|
|
first numeric := p_target;
|
|
BEGIN
|
|
IF NOT ((p_kind IN (1, 2, 8) AND p_target > 0 AND p_count = 0
|
|
AND has_amount = (p_kind IN (2, 8)))
|
|
OR (p_kind IN (3, 5) AND p_target = 0 AND p_count BETWEEN 1 AND 256 AND has_amount)
|
|
OR (p_kind = 4 AND p_target = 0 AND p_count = 0 AND has_amount)
|
|
OR (p_kind = 6 AND p_count BETWEEN 1 AND 64 AND NOT has_amount)
|
|
OR (p_kind = 9 AND p_target = 0 AND p_count = 0 AND NOT has_amount)) THEN
|
|
RAISE EXCEPTION 'invalid admin command' USING ERRCODE = '22023';
|
|
END IF;
|
|
IF NOT EXISTS (SELECT 1 FROM evolution.region_leases l
|
|
WHERE l.world_id = p_world AND l.region_id = p_region) THEN
|
|
RAISE EXCEPTION 'unknown region' USING ERRCODE = '22023';
|
|
END IF;
|
|
IF p_kind = 6 THEN
|
|
SELECT a.next_identity INTO first FROM evolution.life_allocators a
|
|
WHERE a.world_id = p_world FOR UPDATE;
|
|
IF first IS NULL OR first + p_count > 9223372036854775808 THEN
|
|
RAISE EXCEPTION 'no identities for wildlife' USING ERRCODE = '22023';
|
|
END IF;
|
|
UPDATE evolution.life_allocators SET next_identity = first + p_count
|
|
WHERE world_id = p_world;
|
|
END IF;
|
|
RETURN QUERY
|
|
WITH queued AS (
|
|
INSERT INTO evolution.admin_commands AS q(world_id, region_id, kind, cell_count, target,
|
|
energy, carbon, nitrogen, phosphorus, other, author_subject, reason)
|
|
VALUES (p_world, p_region, p_kind, p_count, first, p_energy, p_carbon, p_nitrogen,
|
|
p_phosphorus, p_other, p_subject, coalesce(p_reason, ''))
|
|
RETURNING q.command_id, q.target)
|
|
SELECT queued.command_id, queued.target FROM queued;
|
|
END $$;
|
|
|
|
INSERT INTO evolution.schema_migrations(version,sha256) VALUES(67,:'migration_sha_67');
|