Resolve settled-System teardown route in the database, not by server upgrade order
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- authorization, backend, database
Research direction
Start with the resolver's latest definition in src/kdive/db/schema/0167_unrouted_preparing_teardown_route.sql and the settlement update in 0194_stranded_activation_settlement.sql, then read _enqueue_authority_teardown in src/kdive/mcp/tools/lifecycle/systems/admin.py. Done means a forward-only migration makes the resolver return no route for settled activations, with a real-database test for settled and unsettled Systems and updated migration-window tests and ADR-0816 notes.
Written by the indexing model from the issue text.
Description
Problem
An older server still routes a settled System's teardown to the external-boot authority. Settlement supersedes only allocating and current authority rows, so a retired row survives, and resolve_external_boot_system_teardown_dispatch_binding still returns a route for it. #3551 closes this in the new server code only; the database offers no protection, so ADR-0816 relies on upgrade order ("do not use the tool until every server is upgraded"). An authority teardown that finalizes for a settled System marks it torn_down while the worker's domain still runs.
Evidence
src/kdive/db/schema/0167_unrouted_preparing_teardown_route.sql:6-(latest definition of the resolver): the first branch joinsexternal_boot_authoritieswithstate IN ('current', 'retired')for the newest activation whose state is nottorn_down. A settled activation isabandoned, so it passes.src/kdive/db/schema/0194_stranded_activation_settlement.sql:282-284: settlement setsstate = 'superseded'onlyWHERE state IN ('allocating', 'current'), leavingretiredrows.src/kdive/mcp/tools/lifecycle/systems/admin.py:101-104,809: the resolver's only caller,_enqueue_authority_teardown.route_external_boot_teardown(admin.py:575-) reads the settlement first, but only in current code.- ADR-0816 amendment (#3551), Consequences: an old server routes a settled System to the authority over its
retiredrow. - PR #3579 WORK:REVIEW follow-up candidate 1.
Expected
The resolver returns no route when the newest activation is settled, so no server version can enqueue an authority teardown for a settled System, and the rollout no longer depends on upgrade order for this fence.
Proposed approach
Add a forward-only migration that replaces the resolver (CREATE OR REPLACE, same signature and grants) and adds AND NOT EXISTS (SELECT 1 FROM public.external_boot_activation_settlements s WHERE s.activation_id = newest.id AND s.settled_at IS NOT NULL) to both branches. An old server then fails closed through its existing external_boot_teardown_authority_unresolved path. Add a real-database test: a settled System with a retired authority row resolves to no route, and an unsettled one is unchanged. Update the ADR-0816 upgrade-order note and the runbook upgrade paragraph, and add the new migration row to the migration-window tests.
Provenance
Follow-up from campaign 4c2c8dc9e59d-7f9a87f5-2251-458a-bb30-04fbb2d4b05c, PR #3579.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 9h 13m
- Merged PRs (30d)
- 197
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from randomparity/kdive
-
area:core-platform effort:S priority:P3 risk:night-safe status:ready type:test
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
randomparity/kdive#3620 ·
Maintainers usually reply within 1 day
-
area:providers effort:S priority:P3 risk:night-watch status:ready type:docs
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
randomparity/kdive#3618 ·
Maintainers usually reply within 1 day
-
area:core-platform effort:S priority:P3 risk:night-safe status:ready type:test
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
randomparity/kdive#3603 ·
Maintainers usually reply within 1 day
-
area:providers effort:S priority:P3 risk:night-safe status:ready type:docs
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
randomparity/kdive#3593 ·
Maintainers usually reply within 1 day
-
area:providers effort:S priority:P3 risk:night-safe status:ready type:refactor
Difficulty 1/5 Under an hour Newbie friendliness 84/100
randomparity/kdive#3592 ·
Maintainers usually reply within 1 day
All issues in randomparity/kdive
Similar issues
-
fleet size/m
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sipyourdrink-ltd/bernstein#7548 ·
Maintainers usually reply within 1 day
-
good first issue help wanted level 1 wocs
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
GianlucaBave/murmury#73 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
G-nn-r/lg_heatpump#52 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
agno-agi/agno#11657 · 1 comment ·
Maintainers usually reply within 1 day
-
category:codebase:gpi category:codebase:handle type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day