DESIGN_READY_FOR_OPERATOR_REVIEW: managed runtime components, shutdown deadline, and reconnect fencing #200
Labels
No labels
bug
design
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/starintel-auto-research#200
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Authority / state
lost-rob0t/starintel-server#37starintel-server#35,#368fb297d146e7332fae7e38170b5b49d49530ac53READY_FOR_DESIGNDESIGN_READY_FOR_OPERATOR_REVIEWThis design must not enter executable RAGE until explicit operator implementation approval.
Design goal
Extend the existing
star.runtimelifecycle owner into a closed component/resource supervisor. Do not replace it and do not introduce a second service manager.The resulting runtime must:
Existing implementation retained
Preserve current
star.runtime, consumer owned-thread retention, finite Rabbit polling, Clack handle stop, Sentoshutdown :wait t, lparallel shutdown, signal handling, startup rollback and live/ready endpoints.This is a refinement/migration of hard-coded orchestration into registered components, not a rewrite.
Common Lisp component contract
Conceptual protocol:
Use ordinary Common Lisp protocol/generic functions or structs/classes consistent with repository style. No StarLang grammar is added.
Registration must reject:
Initial component inventory
Migrate current hard-coded owners behind component adapters, in dependency order where applicable:
Do not pretend pure initialization with no retained resource is a lifecycle component unless it needs cleanup/readiness/reconnect semantics.
Startup algorithm
registered -> starting;runningonly after successful start contract;Start/stop remains idempotent. A second start of an active runtime rejects; stop of absent/stopped runtime succeeds without side effects.
One absolute shutdown deadline
Use one process-wide shutdown duration authority (current
*shutdown-timeout-seconds*may remain the source value). At stop initiation compute a monotonic absolute deadline once.Every phase receives the same absolute deadline or a context exposing
remaining-time. Components never receive a fresh full timeout.Required invariant:
A component that exhausts the remaining budget returns
timedOut. The runtime continues only with cleanup operations that are themselves bounded by remaining time or safe immediate fencing.Shutdown phases
1. Quiesce
Stop new external/data-plane intake while retaining control capacity.
Examples:
#36 defines overload/rejection semantics. #37 merely invokes the lifecycle boundary.
2. Drain
Wait for already accepted work within the remaining deadline.
Each component reports counts where meaningful:
No component may wait forever.
3. Stop
Release resources in reverse dependency order: consumers/workers, actors/timers, transport connections, executors, etc., as dictated by graph dependencies rather than a second handwritten shutdown list.
Shutdown result
Do not collapse everything to boolean
t.Conceptual result:
The runtime may enter
:stoppedas a lifecycle fact after bounded teardown is over, but the report must preserve whether cleanup was clean. Readiness is false from the moment quiesce/stopping begins.Reconnect supervisor
Reconnect is a component lifecycle sub-state, not a detached worker architecture.
States:
Rules:
Rabbit, CouchDB and KV adapters opt into this independently. Do not force identical reconnection mechanics below the lifecycle protocol.
Health/readiness contract
Replace handle-presence assumptions with component probes.
Runtime readiness requires:
:running;running;Optional component failure may produce degraded diagnostics without making the whole runtime unready only when the component is explicitly declared optional.
#177 thread-budget integration
Every lifecycle component has the stable owner ID used by thread-demand allocations and live thread registration.
Invariant:
Thread-producing components must obtain the relevant grant before realizing workers. #37 does not duplicate the budget planner.
#35/#36 boundaries
StarLang boundary
No new syntax/runtime extension is required for this host-level process lifecycle problem.
StarLang actors/domain servers continue to use their lifecycle/cancellation semantics inside their host. The Common Lisp host is responsible for process resources, OS threads, Clack, Sento, Rabbit, CouchDB/KV adapters and their lifecycle ownership. No Python/external supervisor is justified.
Migration slices
All slices remain AWAITING_OPERATOR_IMPLEMENTATION_APPROVAL.
star.runtime;Mandatory RED-first tests
Slice 1
Before production mutation, add pure fixtures:
Untouched current code must fail because no component registry/graph exists.
Slice 2
Fake three stop adapters that would each consume a full current timeout. Assert the runtime passes one shared deadline and total stop cannot consume three fresh budgets. Untouched code must fail this contract.
Also assert a stop failure appears in
ShutdownReportand does not disappear behindignore-errors.Slice 3
Start failure at component N must stop exactly the successfully started prefix once, reverse ordered, with no stop call for never-started components.
Slice 4
A fake intake component must reject new work after quiesce while previously accepted work can finish until the shared deadline.
Slice 5
Reconnect generation N completes after N+1 and after runtime stop. Both stale completions must be fenced and their resources closed/not installed.
Slice 6
A retained non-NIL component handle whose explicit health probe is false must make runtime readiness false.
Adversarial review
Rejected:
star.runtime;bt:all-threadsfor ownership;Acceptance
Implementation approval
PENDING / AWAITING_OPERATOR_IMPLEMENTATION_APPROVALOnly the operator may authorize implementation.