Skip to content

[$25 BOUNTY] [Rust] Add graceful shutdown config docs and parser tests - #124

Open
Saiaaax wants to merge 2 commits into
jaxassistant55:mainfrom
Saiaaax:bounty72-shutdown-config
Open

[$25 BOUNTY] [Rust] Add graceful shutdown config docs and parser tests#124
Saiaaax wants to merge 2 commits into
jaxassistant55:mainfrom
Saiaaax:bounty72-shutdown-config

Conversation

@Saiaaax

@Saiaaax Saiaaax commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Adds parser tests and operational documentation for the TOT_SHUTDOWN_GRACE_SECS shutdown grace-period setting.

Closes #72

Changes

  • New file: backend/src/shutdown_grace.rs — Grace-period parser module with:

    • GracePeriod struct with resolved Duration and GraceSource enum
    • parse_grace_period() reads TOT_SHUTDOWN_GRACE_SECS env var
    • parse_grace_period_from() testable entry-point accepting optional string
    • Constants: DEFAULT_GRACE_SECS (30), MIN_GRACE_SECS (1), MAX_GRACE_SECS (300)
    • 10 unit tests covering: unset/default, valid in range, valid at min/max boundary, zero clamped, negative clamped, too-large clamped, non-numeric fallback, whitespace trimming, float-string fallback
  • Updated: backend/src/lib.rs — Added pub mod shutdown_grace;

  • Updated: docs/OPERATIONS.md — Added "Graceful Shutdown Configuration" section documenting the env var, default, valid range, behavior table, how to run tests, and Kubernetes integration example

Testing

cargo test shutdown_grace

Tests cover all acceptance criteria:

  • Unset → default (30s)
  • Valid integer → parsed value
  • Zero → clamped to 1s
  • Negative → clamped to 1s
  • Too-large (>300) → clamped to 300s
  • Non-numeric → fallback to default

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Documentation has been updated, if applicable
  • Configuration or schema changes are documented, if applicable
  • No generated build artifacts are committed, except the required diagnostic build log
  • Changes are scoped to the PR purpose and avoid unrelated cleanup
  • Security, privacy, and error-handling implications have been considered

  • I would like to request that my diagnostic build log is removed before merging

Payout address: 0x5253757322092903C2F0a8EfEed592344216CC7E
Diagnostic artifact reference: diagnostic/build-db991709.logd

Saiaaax and others added 2 commits June 24, 2026 16:37
Add shutdown_grace module with parser for TOT_SHUTDOWN_GRACE_SECS env var.
Tests cover unset, valid, zero, negative, too-large, and non-numeric values.
Document default, valid range, and failure behavior in docs/OPERATIONS.md.

Closes #72

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

[$25 BOUNTY] [Rust] Add graceful shutdown config docs and parser tests

1 participant