Skip to content

docs(issues): [#2668] add issue specification for shutdown policy configuration - #2669

Merged
josecelano merged 6 commits into
torrust:developfrom
josecelano:2668-configure-shutdown-policy-spec
Oct 27, 2026
Merged

josecelano merged 6 commits into
torrust:developfrom
josecelano:2668-configure-shutdown-policy-spec

Conversation

@josecelano

@josecelano josecelano commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Related to #2668

Spec-only PR for SI-20 (roadmap row 20) of EPIC #1488, "Configure shutdown policy and deployment contract". No code, tests or configuration change; implementation follows after this merges.

Summary

  • Refreshes the SI-20 draft (last updated 2026-10-02) against develop after sub-EPIC SI-22 and SI-23/24, and moves it to docs/issues/open/2668-1488-si-20-configure-shutdown-policy/ISSUE.md. Every claim read from source and not run is marked as such.
  • Adds the listener drain admission budget (SI-22) as a fourth budget and a chained budget model, max(HTTP drain, UDP drain) + listener drain < process deadline. With the Q4 defaults plus SI-22's 5 s listener budget the chain is 25 s with no slack, so the spec proposes a 15 s HTTP drain default (decision D1, approved by the maintainer).
  • Corrects the draft: the health-check drain is already 5 s, a second hard-coded 10 s deadline exists in the startup-failure cleanup of src/app.rs, and a drain that reaches its budget is reported as JobStatus::Failed.
  • Places the settings in a generic application-level [application.shutdown] table (approved by the maintainer) and records the candidate section names with their pros and cons, the other application-level values found in source, and decisions D1 to D10.
  • Plans the work in ten tasks (T1 to T9, with T3 split into a red regression test and the fix) with a design-review stop after the first schema change, executable-boundary evidence (SIGTERM and SIGINT on the real binary PID), a Docker, systemd and Podman deployment contract, and a documented rollback.
  • Records the pre-review reproduction of the defect the task also corrects, exit code 0 after a failed or aborted shutdown, in manual-verification-evidence.md. Four network attempts on the unmodified binary did not fail a component; with a temporary fault-injection patch (embedded in the evidence, reverted, not committed) an aborted and a failed component both exit 0 with the success message, for SIGTERM and SIGINT.
  • Removes the skeleton verification.md (the evidence goes in manual-verification-evidence.md), marks EPIC Overhaul: Tracker Shutdown #1488 roadmap row 20 as planned with the issue number, and repairs the links to the old draft path in SI-8 and in three closed specs.

Files

docs/issues/open/2668-1488-si-20-configure-shutdown-policy/ (ISSUE.md, manual-verification-evidence.md, evidence/hold-and-stop.sh, evidence/baseline.toml), docs/issues/open/1488-overhaul-tracker-shutdown/ISSUE.md, docs/features/shutdown-process/questions.md, docs/issues/drafts/1488-si-8-configurable-grace-periods/ (two files), the closed specs of #2370, #2412 and #2410 (frontmatter links only), docs/pr-reviews/pr-2669-review/PR-REVIEW.md, and the removed draft under docs/issues/drafts/1488-si-20-configure-shutdown-policy/.

Validation

TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh passed (all 9 steps, including linter all, the staged frontmatter validator and cargo test --doc --workspace) for every commit, and the pre-push hook passed for each push. The commit-id check from the open-pull-request skill printed nothing. python3 .github/skills/dev/pr-reviews/process-pr-review/scripts/validate-audit-record.py --pr-number 2669 exits 0.

Review

The Copilot review (three inline threads) is processed in docs/pr-reviews/pr-2669-review/PR-REVIEW.md: one signed fix commit per finding, a reply on each thread naming the fixing commit's subject, and all three threads resolved.

Head to merge

The branch has six commits, in this order: docs(issues): add issue specification for #2668 (the specification), docs(issues): record the spec pull request in the #2668 frontmatter (sets related-pr), then the three review fixes docs(issues): record the pre-review reproduction of exit code 0 after a failed shutdown, docs(issues): use the registered lifecycle-signals test target in the #2668 checks and docs(issues): make the #2668 worked examples satisfy the shutdown chain rule, and finally docs(pr-reviews): record the review audit for pull request 2669. Merge the head, which is the last one, the audit commit.

Refresh the SI-20 draft against develop (listener drain budget, chained
budget model, second hard-coded deadline, health-check drain) and move it to
docs/issues/open/2668-1488-si-20-configure-shutdown-policy/. The spec places
the shutdown settings in an application-level [application.shutdown] table.

Drop the skeleton verification.md, mark EPIC torrust#1488 roadmap row 20 as planned
with the issue number, and repair the links to the old draft path.

Related to torrust#2668

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 27, 2026 08:08
@josecelano josecelano self-assigned this Oct 27, 2026
@josecelano
josecelano requested a review from da2ce7 October 27, 2026 08:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The verification plan contains invalid inputs and a nonexistent test target, and required pre-review bug-reproduction evidence is missing.

3 open issues
What changed in this PR

This spec-only PR prepares issue #2668, the shutdown-policy configuration task in EPIC #1488. It defines planned behavior without changing runtime code, tests, or configuration.

Changes:

  • Defines four shutdown budgets, their validation rule, configuration placement, exit outcomes, and deployment requirements.
  • Adds implementation tasks, verification scenarios, acceptance criteria, and rollback guidance.
  • Moves SI-20 into the open issue collection and updates roadmap and documentation references.
File Description
docs/​issues/​open/​2668-1488-si-20-configure-shutdown-policy/​ISSUE.md Adds the refreshed shutdown-policy specification.
docs/​issues/​open/​1488-overhaul-tracker-shutdown/​ISSUE.md Marks SI-20 planned and links issue #2668.
docs/​issues/​drafts/​1488-si-8-configurable-grace-periods/​verification.md Redirects verification ownership to the new spec.
docs/​issues/​drafts/​1488-si-8-configurable-grace-periods/​ISSUE.md Updates the superseding SI-20 link.
docs/​issues/​drafts/​1488-si-20-configure-shutdown-policy/​verification.md Removes the obsolete evidence skeleton.
docs/​issues/​drafts/​1488-si-20-configure-shutdown-policy/​ISSUE.md Removes the draft replaced by the open spec.
docs/​issues/​closed/​2412-1488-si-16-migrate-standalone-http-environment/​ISSUE.md Updates the SI-20 metadata reference.
docs/​issues/​closed/​2410-1488-si-22-process-queued-events-before-listeners-stop/​EPIC.md Updates the SI-20 metadata reference.
docs/​issues/​closed/​2370-1488-si-15-define-udp-active-request-policy/​ISSUE.md Updates the SI-20 metadata reference.
docs/​features/​shutdown-process/​questions.md Corrects the planned verification evidence filename.

Review effort: Balanced

josecelano and others added 4 commits October 27, 2026 08:35
…atter

Set related-pr to the spec-only pull request and log its opening.

Related to torrust#2668

Co-authored-by: Copilot <[email protected]>
… a failed shutdown

Reproduce the false-success exit code on the real binary before review and
record it in manual-verification-evidence.md: an aborted and a failed component
both give exit status 0 and the success message, with SIGTERM and SIGINT, once
a temporary fault-injection patch makes a component fail. Four network attempts
on the unmodified binary did not fail a component, and the evidence says so.

Replace the not-applicable bug sections with the workflow link, the regression
boundary and the recheck plan, split T3 into a red test and the fix, mark T1
done, rewrite scenarios M1 and M5, and record the disposable script.

Related to torrust#2668

Co-authored-by: Copilot <[email protected]>
…orrust#2668 checks

The Automatic Checks listed `cargo test --test integration`, which selects the
integration targets of other workspace packages and never runs the root
package's native-binary lifecycle tests. Name the registered lifecycle-signals
target instead, and make T6 register its new test files as [[test]] targets,
because Cargo does not discover files in subdirectories of tests/.

Related to torrust#2668

Co-authored-by: Copilot <[email protected]>
…own chain rule

Scenario M3 left the UDP drain at its 5 s default, so max(2, 5) + 1 = 6 is not
below the 5 s deadline and startup would reject the configuration before the
scenario reached the HTTP drain failure it shows. Set udp_request_drain_in_secs
to 1, and check every other worked example against max(H, U) + L < P.

Give M4 six explicit configurations with their arithmetic, and use a 3 s HTTP
drain in M6 and the temporary fault-injection patch in M7, because a held
request ends within about 5 s on its own. Name the M3 budgets in T6.

Related to torrust#2668

Co-authored-by: Copilot <[email protected]>
Record the three findings of the Copilot review of 2669 with their fixes,
replies and resolution, and the correction to the finding about the
integration test target.

Related to torrust#2668

Co-authored-by: Copilot <[email protected]>
@josecelano

Copy link
Copy Markdown
Member Author

ACK 65faa45

@josecelano
josecelano merged commit 802612d into torrust:develop Oct 27, 2026
24 of 25 checks passed

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 65faa45b13ee4845410ac1747fab393afa16e1b3 (post-merge). Recomputed from the bytes at the merged head, against the base 72fbeacc1; the PR merged on 2026-10-27 at 10:57:14Z as 802612dce.

Label: POST_MERGE_FINDINGS — Review requested at 2026-10-27T08:10:56Z; the PR merged before this round ran. Findings below stand at the merged head for a follow-up; no ACK follows a merged PR.

Specification: the four budgets, 25/15/5/5 defaults, strict chain rule, optional application section, two production deadline consumers and intended exit mapping are coherent with the existing lifecycle. D5 intentionally leaves delivery design for the first implementation review. The corrected worked examples satisfy the rule; M4 distinguishes rejected cases from the accepted 19+5<25 boundary. The issue template's planning, ownership, bug-process, regression, commit-point and verification sections are present.

Records and bot: agree with R2 (missing bug-workflow evidence), R3 (wrong test target) and R1 (invalid M3 arithmetic). The audit maps them to F1/F2/F3, with matching source/reply threads, fix subjects and resolved states. The R3 reply correctly distinguishes the root target from similarly named workspace targets: the old command would not run the lifecycle tests. The embedded temporary patch preserves the existing outcome path while injecting failure or delay, and no such patch reaches runtime source here. Its execution remains reported evidence. The record incorrectly calls an attempt after the first review a pre-review event.

Change and hygiene: recomputed six commits, fourteen files, +1048/-312. Runtime source and manifests are unchanged; the added shell harness and baseline TOML are verification artifacts, qualifying the body's broad “no code or configuration” wording. The shell parses, but readiness is not bounded by its advertised watchdog. Subjects are Conventional with scopes and issue references; identities match, whitespace checks are clean, and attribution footers have no applicable prohibition. No closing-keyword match occurs in the title, body or commit messages. Changed Markdown file links and checked heading targets resolve.

Group relationship: follows the health-environment migration/archive in PRs 2652/2664. PR 2678 implements this policy, revises D5 and removes the disposable harness. PR 2686 archives the specification.

Findings: F4/F5 below, both Minor. F4 concerns this historical head; the harness is absent after PR 2678.

Checked, no finding: budget arithmetic; lifecycle target registration; no runtime fault injection; audit reply targets; optional-schema migration plan; explicit distinction between unmodified attempts and injected reproduction.

Checks

On the loop's compute hub at the merged head, against the base 72fbeacc1 (receipt server-gates-sojka-469; the PR merged as 802612dce): pre-commit profile gate exit 0 (94 s); linter markdown, linter cspell, linter lychee exit 0; frontmatter-validator --all: 16 errors / 4 warnings at the merged head and 16 / 4 at the base re-measured, the same 20 diagnostics by path and category; the audit validator over docs/pr-reviews/pr-2669-review/PR-REVIEW.md with the review comments and commit list captured at gate time: ok, 3 rows, 3 log entries, 0 failures. GitHub checks at this head at posting time: "Publish (Release): completed/skipped; Publish (Development): completed/skipped; Context: completed/success; Test (Docker) (release): completed/success; Docker E2E: completed/skipped; Unit (stable): completed/success; Workspace Packaging: completed/success; Unit (nightly): completed/success; Documented Clippy Allows: completed/success; Layer Boundary Bans: completed/success; Package Coverage (${{ matrix.package }}): completed/skipped; Package Coverage Regression: completed/success; Discover Package Coverage: completed/success; Generate Coverage Report: completed/success; Build on windows-latest (nightly): completed/success; Build on windows-latest (stable): completed/success; Build on ubuntu-latest (nightly): completed/success; Build on macos-latest (stable): completed/success; Build on macos-latest (nightly): completed/success; Build on ubuntu-latest (stable): completed/success; Docs Lint: completed/success". At posting, develop is 968099d93.

sleep 0.1
done
for _ in $(seq 1 100); do
curl -fsS -o /dev/null http://127.0.0.1:11313/health_check 2>/dev/null && break

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor][F4] Bound readiness before starting the shutdown watchdog

The readiness curl has no connection or total timeout, and the 40-second watchdog is not started until line 44, after both readiness loops and the held-connection setup. A server that accepts the probe but never answers can therefore leave this script and its child running indefinitely; exhausting either loop also continues without proving readiness. This contradicts the script's bounded-run claim and the specification's absolute-deadline requirement. Use a bounded readiness deadline, fail if readiness is not established, and ensure child cleanup on that path. PR 2678 later deletes this disposable harness, so the defect is historical rather than live on the current target.

| Step | Status |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Analysis and hypothesis | Done. `main` discards the supervisor outcomes and always logs success (`src/main.rs`, read from source). Hypothesis: a failed or aborted component still gives exit `0`. |
| Real-artifact reproduction | Done before review: **Reproduced, with a temporary fault-injection patch** (V1 in [manual-verification-evidence.md](manual-verification-evidence.md)). Exit `0` and the success message for an aborted component and for a failed one, with SIGTERM and SIGINT. Four network attempts on the unmodified binary did not fail a component, and the evidence says so. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor][F5] Record the reproduction as a response to review

The row says the reproduction was done before review, and the T1 row and 09:02 progress entry repeat that chronology. The capture places the review request at 08:10:56Z and the review bot's review at 08:27:54Z; the evidence itself dates the reproduction attempts to 08:45–08:58Z. The attempt addresses the missing-evidence finding, but cannot establish compliance with the earlier pre-review checkpoint. Correct the mutable summary and append a chronology correction to the progress log: this was performed after the first review and before the 09:17 reply. Preserve the distinction from the planned final implementation recheck.

This branch was previously deployed

1 inactive deployment
coverage — 65faa45b Deployed Oct 27, 2026 by josecelano via Generate Coverage Report #2828
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants