Skip to content

[tracking] data-service low-severity hardening #68

Description

@tkowalczyk

Grouped low-severity findings in apps/data-service. Each needs a focused failing test.

  1. 429 ignores retry_afterchannels/telegram.ts:30,132-134. Fixed 1s/4s/16s (~21s total) backoff exhausts retries inside a typical 30–60s group rate-limit. Test: 429 with parameters.retry_after:30; assert no retry before 30s.
  2. KV-cached topic ids never invalidateddomain/system-topic.ts, domain/lead-topic.ts. A manually deleted topic → permanent 400s until the KV key is cleared. Test: send to cached id fails with thread-not-found → topic recreated.
  3. /trigger computes "today" in UTChono/handlers/sources.ts:149-156. Between 00:00–02:00 Warsaw, yesterday's pickup passes the >= today filter. Test with now=2026-07-01T22:30Z.
  4. Scheduling after the alarm slot skips an imminent pickupdomain/waste-collection-handler.ts:149. Creating at 21:00 with alertBeforeHours:6 drops tomorrow's ~27h-away pickup. Test: now=2026-04-29T19:00Z, date 2026-04-30 → non-null alarm.
  5. In-memory rate limiterhono/middleware/rate-limit.ts:8,27. Unbounded Map, per-isolate, not pruned. Test: store stays bounded after window passes.
  6. prune-leads month overflowdomain/prune-leads.ts:10-14. setUTCMonth(-3) on May 31 → Mar 3, deleting leads ~3 days early at 7 month-ends/yr. Test: computeLeadCutoff("2026-05-31T12:00Z")2026-02-28T12:00Z.
  7. householdId cast from raw bodyhono/handlers/sources.ts:33 (body.householdId as number). Missing/garbage → 500 not 400. Test: POST without householdId → 400.
  8. createSourceWithTopic non-atomicdomain/source-lifecycle.ts:24-29. Failed topic creation leaves an orphan row; UI retry duplicates. Test: createForumTopic rejects → no orphan / typed result.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    audit/2026-06Filed from June 2026 deep auditseverity/lowHygiene / latent risk

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions