Skip to content

cold-store: TURSO_DUMP_MAX_TIME_SECONDS validation accepts 0, silently disabling the dump timeout it exists to enforce #1428

Closed

Description

@dezren39

Finding (from PR #1373, merged)

pkgs/cold-store-reaper/scripts/export-turso.sh (validation added by PR #1373, still on main at lines 74–80):

DUMP_MAX_TIME="${TURSO_DUMP_MAX_TIME_SECONDS:-1800}"
case "${DUMP_MAX_TIME}" in
'' | *[!0-9]*)
  echo "turso export: ERROR: TURSO_DUMP_MAX_TIME_SECONDS must be a positive integer (got '${DUMP_MAX_TIME}')" >&2
  exit 1
  ;;
*) ;;
esac

The case rejects empty and non-digit values, but 0 is all digits and passes — despite the error message and the PR body both describing the check as validating "a positive integer". All-digit zero forms (00, 000) pass the same way.

Why it matters

The value is passed straight to curl --max-time "${DUMP_MAX_TIME}" for the /dump download. For curl, --max-time 0 means no timeout at all — the transfer runs unbounded. PR #1373 exists because a ~500 MB dump outgrew the old fixed 300 s cap; setting TURSO_DUMP_MAX_TIME_SECONDS=0 (a plausible "disable/zero" knob value, or a templating accident) silently removes the cap entirely while the operator believes a validated positive cap is in force. A stalled dump then hangs the export step indefinitely instead of failing loudly at the cap.

Suggested fix

After the digit check, reject zero explicitly (e.g. strip leading zeros and require a non-empty/non-zero remainder, or [ "$DUMP_MAX_TIME" -gt 0 ] with the digit check first so the arithmetic is safe). Add a regression test beside test_dump_max_time_env_override_is_honored covering 0 (and ideally 00) expecting exit 1 with the positive-integer error.

Provenance

Identified by pr-diff-review-b run 04a1ab0f (2026-10-27 04:18 CDT) during review of PR #1373; that run was interrupted before filing and later runs advanced the watermark past the PR. The run's own log did not survive the 2026-10-27 overload window, so the finding was re-verified firsthand against the merged diff and current main before filing (2026-10-27).

Acceptance criteria

  • TURSO_DUMP_MAX_TIME_SECONDS=0 (and all-zero forms like 00) is rejected with the positive-integer error and exit 1.
  • Non-zero positive values and the unset default (1800) behave exactly as before.
  • A regression test beside test_dump_max_time_env_override_is_honored covers 0 (and ideally 00) expecting exit 1.
  • No other validation behavior in export-turso.sh changes.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)
    on Oct 27, 2026
  2. developing-today commented on Oct 27, 2026

    @developing-today
    Contributor
  3. added
    effort/sSmall: expected under 2 hours of work
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Oct 27, 2026
  4. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    Intake review

    Fleet monitor intake pass, 2026-10-27 (repo-fleet-monitor).

    Related: filed from the merged PR #1373 diff review; that PR added the validation but is not a fix for this gap. A triage task for this issue is live in the code queue (task 1437, enqueued by this monitor run after the issue was found labelled queue/queued with no task).

    Notes: The defect is confirmed in the issue body against current main (lines 74–80): the case pattern only excludes empty/non-digit values, so every all-zero form passes. curl --max-time 0 disables the timeout entirely, which inverts the knob's purpose.

    Risks: Low — a rejection-path change plus a test. The main care point is ordering: keep the digit check first so the -gt 0 comparison is arithmetic-safe.

    Suggested approach: strip leading zeros after the digit check and require a non-zero remainder (or [ "$DUMP_MAX_TIME" -gt 0 ]), then add the 0/00 regression cases.

  5. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), Lane D shift
    • Session / ID: queue task 1437 (triage)
    • Found via: queue claim
    • Task: Triage verdict — CONFIRMED on current main bdfde619 (fresh gh api contents read, 2026-10-31): pkgs/cold-store-reaper/scripts/export-turso.sh:74-81 rejects only '' and non-digit values, so TURSO_DUMP_MAX_TIME_SECONDS=0 and =00 pass even though the error text claims a positive integer is required; line 169 feeds the value to curl --max-time, where 0 means no timeout — a stalled ~500MB dump hangs indefinitely. The neighboring test named in the routing exists on current main: tests/test_export_turso.py:158 test_dump_max_time_env_override_is_honored.
    • Routing: small_fix follow-up enqueued as queue task 4680 (packet: reject all-zero values after the digit check + regression tests for 0 and 00 beside the existing test). No duplicate issue filed.
    • Expectation: task 4680's PR closes this issue.
    • Links: packet hidden_files/dispatch-packets/packet-1428-fix.json (keep-the-four-repos-healthy goal workspace)
  6. removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 31, 2026
  7. 6 remaining items

  8. added
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Oct 31, 2026
  9. chatgpt-codex-connector commented on Oct 31, 2026

    @chatgpt-codex-connector

    You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard.

  10. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 31, 2026
  11. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  12. added a commit that references this issue on Oct 31, 2026
  13. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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

Metadata

Metadata

Assignees

Labels

app/cold-store-reaperPackage/app: cold-store-reaper (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/pr-diff-reviewFiled by the pr-diff-review jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions