fix(agent-rate-limit): accept offset timestamps whose UTC date differs; exclude node_modules from Sonar

Merged
DO
8d ago
+39-3

User description

What

Two small fixes salvaged from #1196, which is closed as superseded by #1463 (the same [ โ†’ [[ conversion, tracked by the open #1462).

  1. arl_token_iso_to_epoch rejected valid offset timestamps near midnight. Its calendar check compared the input's YYYY-MM-DD with the epoch's UTC date. 2026-09-08T23:30:00-05:00 is 2026-09-09T04:30Z, so it returned empty, and so did 2026-09-09T00:30:00+05:00 (UTC date 09-08). It now round-trips the date portion alone (date -d "${iso:0:10}"). That still rejects Feb 30, because date normalises it away, and it no longer depends on the offset.
  2. sonar-project.properties excludes node_modules/**. The vendored bats runner accounts for 7 open SonarCloud findings (node_modules/bats/lib/bats-core 6, node_modules/bats 1) that are not ours to fix.

Tests

Three boundary cases in tests/test_agent_rate_limit_weekly_glide.bats:

  • a negative offset whose UTC date rolls forward (failed before the fix);
  • a positive offset whose UTC date rolls back (failed before the fix);
  • Feb 30 carrying an offset, still rejected.

Run locally with GNU date: all 6 tests/test_agent_rate_limit*.bats suites pass (490 tests, 0 failures). shellcheck -x scripts/lib/agent-rate-limit.sh is clean.

๐Ÿค– Generated with Claude Code

Problem

See the linked issue.

Risk

Low โ€” changes automation shell logic under scripts/, covered by shellcheck (--severity=warning) and the bats suite.

Test plan

Tests added/updated: tests/test_agent_rate_limit_weekly_glide.bats. Verification: bash scripts/dev-lead-lint.sh (shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.

Rollback

Revert this PR. No non-revertible side effects (no tags, migrations, or external state).

Monitoring

This PR's Lint (shellcheck) and bats checks show pass/fail; watch subsequent dev-lead / pr-review runs for behavioral regressions.


CodeAnt-AI Description

Accept valid offset timestamps across UTC date boundaries

What Changed

  • Valid timestamps are accepted even when their UTC date differs from the date written in the timestamp.
  • Invalid calendar dates, such as February 30, are still rejected.
  • SonarCloud no longer reports findings from the vendored test runner.

Impact

โœ… Valid rate-limit reset times near midnight
โœ… Invalid calendar dates remain rejected
โœ… Fewer SonarCloud findings from vendored code

๐Ÿ’ก Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.