Skip to content

docs(issues): [#2847] record SI-28 decisions for an automated hung-component test - #2909

Merged
josecelano merged 7 commits into
torrust:developfrom
josecelano-bot:2847-verify-hung-component-abort-spec
Nov 17, 2026
Merged

josecelano merged 7 commits into
torrust:developfrom
josecelano-bot:2847-verify-hung-component-abort-spec

Conversation

@josecelano-bot

Copy link
Copy Markdown
Contributor

Related to #2847 (SI-28 of EPIC #1488)

Spec-only PR. It records the maintainer's decisions of 2026-11-17 for SI-28, before any implementation.

What changes

The goal of SI-28 moves from manual evidence only to an automated executable-boundary test that a component which never finishes is aborted at the process deadline P and the process exits with code 1:

  • D1: a test-only binary in a new non-default dev crate starts the real tracker plus one component that never completes; the crate's own integration test signals it (SIGTERM, SIGINT) and asserts exit code 1 within P plus a margin, and that the log names the aborted components.
  • D2: the signal wait and shutdown reporting move from main.rs into one library function that both binaries call (behavior-preserving refactor), so the test binary cannot drift from the real one.
  • D3: the crate and its test stay as a permanent regression test; CI runs it through cargo test --workspace --all-targets.
  • D4: this spec merges before the implementation.

The spec also lists the alternatives considered (in-process test, external stall of a dependency, a manual example, a fault-injection feature in the real binary, nested cargo run, no-go) and why each was rejected, and states the coverage limit: the deadline abort only takes effect at an await point, so a component that blocks its thread is out of reach of this test.

The note of row 25 in the EPIC #1488 spec is updated to match.

Checks

  • linter all and the pre-commit gate pass.

🤖 Generated with Claude Code

…omponent test

The maintainer chose an automated executable-boundary test over manual
evidence only: a test-only binary in a non-default dev crate starts the
real tracker plus one component that never completes, and its own
integration test signals it and asserts exit code 1 at the deadline. The
shutdown sequence moves from main.rs into a library function shared by
both binaries (behavior-preserving refactor). The spec lists the
alternatives considered and why each was rejected, and the coverage
limit (hangs at an await point only). EPIC row 25 note updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@josecelano josecelano self-assigned this Nov 17, 2026
@josecelano
josecelano requested review from da2ce7 and a balanced review from Copilot November 17, 2026 13:41

@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 ac4e7eeb174f049db7c6e576278b2716fad2cfd3. Recomputed from the bytes at this head, against the merge base 5833cdae9; git merge-tree against develop 5833cdae9 is clean and its result tree equals the head tree.

Process: a spec-only update of an open sub-issue, governed by create-issue, open-pull-request and commit-changes; D3 leans on add-workspace-member. The required sections, the frontmatter (spec-path, quoted stamp, skill-links, related artifacts) and the Related to link are in place.

The change against its claim: both files change as described (the spec rewritten around D1 to D4 and alternatives A to H; the EPIC row 25 note). The mechanism holds: start_with_explicit_config_toml_path is public and returns the JobManager; reserve and spawn accept a component after startup and add the edge to the stop-last health_check_api, which is never asked to stop and is aborted with the hung component, so both land in incomplete_components; CARGO_BIN_EXE_<name> reaches only the owning package's tests; --workspace covers non-default members. Four statements do not match the code (F1 to F4).

Consistency: every link, related artifact and skill-link resolves; nothing moves; no dictionary change.

Hygiene: one commit, Conventional subject with [#2847], body matches the diff, author equals committer, one attribution footer (no rule in the tree forbids it); git diff --check is clean; the commit-id check prints nothing; no closing keyword in the title, body or message.

Findings: F1 Major, alternative D is rejected on a premise the code contradicts; F2 Minor, a plain move does not keep the same log lines; F3 Minor, a 4 s deadline fails validation with the default drains; F4 Nit, the spawn_blocking arm of case 4; F5 Suggestion, the .dockerignore block; F6 Nit, the EPIC stamp.

Checked, no finding: the SI-21 V6 quote; SI-26 M3 is the failure path; the default deadline is 25 s; branch: keeps the implementation name like its siblings; [#N] in a spec-only title matches merged precedent; the CI test step includes --workspace --all-targets.

Checks

On the loop's compute node at this head, against the merge base 5833cdae9 (receipt server-gates-kranich-1077): the repository's pre-commit gate and lint roster exit 0 (376 s wall). The PR changes documentation only, so no package tests apply. F1 checked against the bytes at posting: row D of the alternatives table says "real components select on their token while waiting", while packages/tracker-core/src/statistics/event/listener.rs awaits handle_persistent_completed_statistics_receive_result inside the receiver.recv() arm of its select!, outside the token branch. The head was confirmed with git ls-remote before posting. GitHub checks at this head at posting time: "Docs Lint: completed/success". At posting, develop is 5833cdae9.

- F1: alternative D is rejected on cost, not on a false premise: the
  persistent statistics listener awaits its database write outside the
  token branch, so a stalled MySQL write hangs it until the deadline.
  The Background no longer says no production component can hang.
- F2: the events moved out of main.rs pin target "torrust_tracker", so
  the log lines stay identical, target included.
- F3: T3 and M1 name drain budgets that pass shutdown validation.
- F4: case 4 names both mechanisms (a self-blocking task, and a
  spawn_blocking thread the runtime drop waits for).
- F5: the crate path moves under packages/, already admitted by
  .dockerignore.
- F6: the EPIC last-updated-utc stamp is bumped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

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 commit policy omits required recorded test-design reviews after each passing increment and final maintainer review, allowing subsequent test work and commits to bypass those checkpoints.

1 open issue
What changed in this PR

This spec-only PR records SI-28’s approved approach for automated hung-component shutdown verification under EPIC #1488. It plans implementation without changing runtime code.

Changes:

  • Defines a permanent test-only binary and signal-driven integration tests using shared production shutdown logic.
  • Specifies timing, exit-code, logging, cleanup, and manual-evidence requirements, including the blocking-task coverage limit.
  • Updates the parent EPIC roadmap to reflect the automated-test scope.
File Description
docs/​issues/​open/​2847-1488-si-28-verify-hung-component-abort/​ISSUE.md Records decisions, alternatives, implementation tasks, and verification criteria.
docs/​issues/​open/​1488-overhaul-tracker-shutdown/​ISSUE.md Aligns roadmap row 25 with the revised SI-28 plan.

Review effort: Balanced

josecelano-bot and others added 3 commits November 17, 2026 14:00
… and T3 commits

Copilot finding R1 on PR 2909: the commit points let the test work go
from a passing test straight to a commit. They now require the
prose-first Arrange-Act-Assert design review of the issue template,
recorded in test-design-review.md, and the maintainer review first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… resolution for PR 2909

Co-Authored-By: Claude Opus 5.5 <[email protected]>
da2ce7
da2ce7 previously approved these changes Nov 17, 2026

@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 7d7aafc7ec90410b7279f11d66b18f42765b6a5d. Recomputed from the bytes at this head, against the merge base 5833cdae9; git merge-tree against develop 5833cdae9 is clean and its result tree equals the head tree.

Process: create-issue, open-pull-request and commit-changes govern the spec; process-pr-review governs the audit record.

The change against its claim: 630207df0 resolves round-1 findings F1 to F6 as its message lists (Background and row D, the pinned log target, drain budgets that pass validation, both case-4 mechanisms, the packages/ path, the EPIC stamp). 8dc7be5a4 adds the prose-first Arrange-Act-Assert test-design review after each passing T2/T3 increment, recorded in test-design-review.md, with maintainer review before commit, which closes the gap thread R1 raised against docs/templates/ISSUE.md:118-130 and create-issue. e2232c96c and 7d7aafc7e add the audit record and its R1 row.

Audit record: all seven threads (F1 to F6 and R1) were posted before the last audit commit, and each has a reply on its own thread, a row with a detail entry, and a resolution. The validator's logic, run offline against the captured comments and the PR's commits, passes (7 rows, 5 log entries, 0 failures).

Consistency: links and related artifacts resolve; the record follows the template's sections and merged precedent.

Hygiene: five commits, Conventional with [#2847], bodies match their diffs, author equals committer, one attribution footer each (no rule in the tree forbids it); git diff --check is clean; no closing keyword in the title, body or messages. The commit-id check prints three PR-branch ids from the audit record (F9).

Findings: F9 Minor, non-blocking: the audit record cites PR-branch commit ids. Nothing blocks.

Checked, no finding: the R1 row's source, review ID, severity, reply and resolution subject; the Processing Log order and its account of the late R1 thread; the T1 commit wording mirrors the template's default.

Checks

On the loop's compute node at this head, against the merge base 5833cdae9 (receipt server-gates-kranich-1084): the repository's pre-commit gate and lint roster exit 0 (46 s wall), and the audit validator passes the record (7 rows, 5 log entries, 0 failures). The PR changes documentation only, so no package tests apply. The head was confirmed with git ls-remote before posting. GitHub checks at this head at posting time: "Docs Lint: completed/success". At posting, develop is 5833cdae9.

@da2ce7

da2ce7 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

ACK 7d7aafc — the SI-28 spec fixes all seven review findings, and every review thread is replied to, recorded in the audit and resolved, with the audit validator's logic passing offline at this head

…09 audit

Review finding F9 of PR 2909: the audit cited three PR-branch commit
ids, which a rebase would invalidate. They are replaced by commit
subjects, and the Processing Log records the in-place correction.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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 61d2712f9901c4ee9d19b72d8e785f76568a0c8e. Recomputed from the bytes at this head, against the merge base 5833cdae9; git merge-tree against develop 5833cdae9 is clean and its result tree equals the head tree.

Process: process-pr-review governs the only file that moved since the last review, the audit record; open-pull-request governs the commit-id rule F9 applied.

The change against its claim: bda70c827 replaces the three PR-branch commit ids in the record with commit subjects and logs the in-place correction; the commit-id check prints nothing at this head, so F9 is resolved and its reply matches the diff. 61d2712f9 adds the F9 row and detail entry and a log entry for its reply and resolution.

Audit record: all eight threads (F1 to F6, R1 and F9) were posted before the last audit commit, and each has a reply on its own thread, a row with a detail entry, and a resolution. The F9 row carries review 5940040689, severity Minor as bracketed, the reply on its thread and the fixing commit's subject. The validator's logic, run offline against the captured comments and the PR's commits, passes (8 rows, 7 log entries, 0 failures).

Consistency: the spec is unchanged since the last review; the record keeps the template's sections and a quoted stamp.

Hygiene: both new commits are Conventional with [#2847], match their diffs, author equals committer, one attribution footer each (no rule in the tree forbids it); git diff --check is clean; no closing keyword in the title, body or messages.

Findings: none open. F1 to F10 are resolved.

Checked, no finding: the round line naming the round-2 review; the Processing Log order and its account of the F9 reply and resolution, which agrees with the capture timestamps.

Checks

On the loop's compute node at this head, against the merge base 5833cdae9 (receipt server-gates-kranich-1086): the repository's pre-commit gate and lint roster exit 0 (47 s wall), and the audit validator passes the record (8 rows, 7 log entries, 0 failures). The PR changes documentation only, so no package tests apply. The head was confirmed with git ls-remote before posting. GitHub checks at this head at posting time: "Docs Lint: completed/success". At posting, develop is 5833cdae9.

@da2ce7

da2ce7 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

ACK 61d2712 — every one of the eight review threads is replied to, recorded in the audit and resolved, the record cites no PR-branch commit id, and the audit validator's logic passes offline at this head

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.

🟢 Approval recommended

No active review issues remain for the specification-only hung-component shutdown test plan.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@josecelano

Copy link
Copy Markdown
Member

ACK 61d2712

@josecelano
josecelano merged commit a544a58 into torrust:develop Nov 17, 2026
1 check passed
josecelano added a commit that referenced this pull request Nov 17, 2026
…mponent abort on a real tracker binary

58c32fb docs(pr-reviews): [#2847] record round 3 findings F7 and F8 for PR 2911 (josecelano-bot)
a49abfb test(hung-component-tracker): [#2847] fail on an output read error and document the reader panic (josecelano-bot)
c988912 docs(pr-reviews): [#2847] record Copilot's round 2 findings R1 and R2 for PR 2911 (josecelano-bot)
2b83b7e test(hung-component-tracker): [#2847] poll the child output without copying it and fail on a reader panic (josecelano-bot)
3f99f40 docs(pr-reviews): [#2847] add review audit for PR 2911 round 1 (josecelano-bot)
3be0f58 docs(issues): [#2847] record the stale build and correct the discarded M4 run's cause (josecelano-bot)
6b8f2db docs(agents): [#2847] place the shutdown sequence in app.rs and list the new crate (josecelano-bot)
1200272 docs(app): [#2847] document the panics of run_until_shutdown_signal and the test CLI's flag (josecelano-bot)
c7c27dc docs(skills): [#2847] name every root-crate requirement in the release version bumps (josecelano-bot)
5064d17 docs: [#2847] describe the shared shutdown function and the hung-component test (josecelano-bot)
6433c2b docs(issues): [#2847] record manual verification of the hung-component abort (josecelano-bot)
107e3ee test(hung-component-tracker): [#2847] verify the hung-component abort on a real tracker binary (josecelano-bot)
989edcc refactor(app): [#2847] move the shutdown sequence from main.rs into the library (josecelano-bot)

Pull request description:

  ## Summary

  Implements SI-28 of EPIC #1488 as specified in the spec merged by PR #2909: an automated executable-boundary test that a component that never stops is aborted at the process shutdown deadline, and the process exits with code 1.

  Closes #2847

  ## Changes

  - **Refactor, no behavior change (T1, D2).** `wait_for_shutdown_signal` and `report_shutdown` move from `src/main.rs` into `src/app.rs`, behind the new public `app::run_until_shutdown_signal(app_container, jobs) -> ExitCode` (wait for `SIGINT`/`SIGTERM`, `begin_shutdown`, `wait_for_all(P)`, map outcomes to the exit code). `main.rs` keeps only CLI parsing, startup and the startup-failure report. The moved events pin `target: "torrust_tracker"`, so their log lines are unchanged, target included.
  - **Test-only crate (T2, D1, D3).** `packages/hung-component-tracker` (`publish = false`, workspace member, not a default member, so it never enters the container image or its test archives). Its binary starts the real tracker, reserves and spawns `hung_component` (a future that never completes and ignores its cancellation token), then calls `app::run_until_shutdown_signal`. The shipped crate and binary contain no test code, feature or hook.
  - **Integration test (T3).** `packages/hung-component-tracker/tests/hung_component_abort.rs`, one case per signal, `deadline_in_secs = 4` with drains of 1 s. It asserts the signal was handled, exit code 1, exit no earlier than `P` and within `P` + 3 s, `hung_component` and `health_check_api` logged as aborted after the deadline, and exactly those two in `incomplete_components`. The child helper kills and reaps the child on every path. The prose-first test-design review is in `test-design-review.md`, reviewed by the maintainer before commit.
  - **Manual evidence (T4).** `manual-verification-evidence.md`, logs in `evidence/`: M1/M2 exit code 1 about 4.01 s after `SIGTERM`/`SIGINT`; M3 the health check API is aborted with the hung component and does not delay the exit; M4 the shipped binary before and after the refactor exits 0 with identical normalized logs (145 lines). The case-4 limit (a component blocking its thread is not stopped by the abort) is stated.
  - **Docs (T5).** `docs/architecture/application-jobs.md` describes the shared shutdown function and the hung-component abort; `docs/packages.md` lists the crate. No shutdown doc called the path unverified.

  ## Validation

  - `cargo test -p torrust-tracker --all-targets --all-features`: all green, including the native-tracker shutdown tests in root `tests/` (they cover the refactor).
  - `cargo test -p torrust-tracker-hung-component-tracker`: both cases pass (about 4 s each). Mutation check: with `hung_component` returning `Completed`, both fail on the exit code (status 0).
  - `cargo clippy --all-targets --all-features -- -D warnings`, `linter all`, `cargo machete`, `cargo metadata`, `docker build --target recipe --file Containerfile .`: pass.
  - Pre-commit and pre-push hooks: pass.

  ## Commits

  - refactor(app): [#2847] move the shutdown sequence from main.rs into the library
  - test(hung-component-tracker): [#2847] verify the hung-component abort on a real tracker binary
  - docs(issues): [#2847] record manual verification of the hung-component abort
  - docs: [#2847] describe the shared shutdown function and the hung-component test

  After merge, a close-out PR moves the spec to `docs/issues/closed/` and marks row 25 of EPIC #1488 done.

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

ACKs for top commit:
  da2ce7:
    ACK 58c32fb — the reader now fails on a read error before taking the lock and the fixture documents that panic, fixing F7 and F8, the audit's new rows match their threads and replies and pass the validator's checks offline, and the merge with develop a14a41a is clean
  josecelano:
    ACK 58c32fb

Tree-SHA512: 040a2fc4117e2525972ab49ea9df079243ce62753f241df44ce4735cfae8c87b7ca2bece91868d1487a303e5a959796fdd61cdad9219274aa9f2a551caa1d53f
josecelano added a commit that referenced this pull request Nov 18, 2026
…PIC #1488 row 25 done

5d1efbf docs(pr-reviews): [#2847] record Copilot's round 3 for PR 2929 and correct the F4 severity (josecelano-bot)
635b35d docs(pr-reviews): [#2847] record Copilot's round 2 findings F2 to F4 for PR 2929 (josecelano-bot)
eb6e48b docs(pr-reviews): [#2847] state the medium-to-minor severity mapping in the PR 2929 audit (josecelano-bot)
c7578ae docs(pr-reviews): [#2847] add review audit for PR 2929 round 1 (josecelano-bot)
41b031b docs(issues): [#2847] quote the evidence file's last-updated-utc timestamp (josecelano-bot)
558de61 chore(issues): [#2847] archive closed issue #2847 spec and mark EPIC #1488 row 25 done (josecelano-bot)

Pull request description:

  Close-out of issue #2847 (SI-28 of EPIC #1488), after PR #2911 merged. Docs only.

  - Moved the spec folder `2847-1488-si-28-verify-hung-component-abort` from `docs/issues/open/` to `docs/issues/closed/`.
  - Updated its frontmatter: `status: done`, `related-pr: 2911`, the new `spec-path`, and the evidence file's `issue-spec`.
  - Ticked the "Test runs in CI" acceptance criterion. Both tests in `packages/hung-component-tracker/tests/hung_component_abort.rs` ran and passed in the Unit (stable) and Unit (nightly) jobs of PR #2911.
  - Marked row 25 of the EPIC #1488 roadmap as Done, with the archived link.
  - Verified that issue #2847 is `CLOSED` on GitHub. Pre-commit hooks passed, `linter all` included.

  The PR #2909 review record still names the old `open/` path; it is a historical record, so it is left unchanged.

  Refs #2847, #1488

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

ACKs for top commit:
  josecelano:
    ACK 5d1efbf
  da2ce7:
    ACK 5d1efbf — the SI-28 spec folder is archived whole with its frontmatter, links and EPIC row 25 recomputed correct at this head, the audit's four rows match their threads and pass the validator's logic offline, and the merge with develop 8d932f3 is clean

Tree-SHA512: 11e1981a5469106008c4bd4656e0c51f8fc71e02424ebca7a78938c94513c4dfbe1edf5635505f19e09a1673c6e4acb05cd2d16da8729fe906f54883f7526869
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.

4 participants