Skip to content

fix(swarm-coordination-registry): [#2226] recompute inactivity cutoff per tick - #2250

Closed
josecelano wants to merge 1 commit into
torrust:developfrom
josecelano:2230-add-fix-bug-skill-and-bug-spec-guardrails-spec
Closed

josecelano wants to merge 1 commit into
torrust:developfrom
josecelano:2230-add-fix-bug-skill-and-bug-spec-guardrails-spec

Conversation

@josecelano

Copy link
Copy Markdown
Member

Summary

The activity metrics updater now recomputes the peer inactivity cutoff before every update tick instead of reusing the startup timestamp.

Changes

Updated the swarm coordination registry metrics job and application bootstrap wiring. Added a stopped-clock regression test that advances time after the job starts and verifies inactive peers are reported on the next update.

Validation

The focused registry test and all 105 registry library tests pass. The mandatory pre-push checks also pass: nightly formatting, workspace checks, documentation build, and the full test suite.

Closes #2226

Copilot AI lite review requested due to automatic review settings September 17, 2026 12:14
@josecelano josecelano self-assigned this Sep 17, 2026
@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.79%. Comparing base (524faf3) to head (1b6eaac).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2250      +/-   ##
===========================================
+ Coverage    85.48%   85.79%   +0.30%     
===========================================
  Files          353      353              
  Lines        31321    31336      +15     
  Branches     31321    31336      +15     
===========================================
+ Hits         26776    26885     +109     
+ Misses        4166     4073      -93     
+ Partials       379      378       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josecelano

Copy link
Copy Markdown
Member Author

Superseded by #2252, which uses the correctly aligned branch 2226-fix-stale-inactivity-cutoff.

@josecelano josecelano closed this Sep 17, 2026
@josecelano
josecelano deleted the 2230-add-fix-bug-skill-and-bug-spec-guardrails-spec branch September 17, 2026 12:27

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

This PR fixes stale peer inactivity metrics by recalculating the inactivity cutoff on every metrics update tick rather than only during application startup.

Changes:

  • Passes max_peer_timeout into the registry metrics job instead of a startup-computed cutoff.
  • Recomputes the cutoff immediately before each activity metrics update.
  • Adds a stopped-clock regression test covering peers becoming inactive after the job starts.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/bootstrap/jobs/activity_metrics_updater.rs Passes the configured timeout into the registry job and removes startup cutoff calculation.
packages/swarm-coordination-registry/src/statistics/activity_metrics_updater.rs Recomputes the cutoff per tick and adds regression coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

fix(swarm-coordination-registry): calculate activity-metrics cutoff per update

2 participants