Skip to content

--refresh-crds is ignored in daemon mode #69

Description

@ndenev

Summary

--refresh-crds is handled in batch and interactive modes, but ignored in daemon mode.

Affected code

  • Batch refresh handling: src/main.rs (run_batch)
  • Interactive refresh handling: src/main.rs (run_interactive)
  • Daemon startup path without refresh: src/main.rs + src/daemon/pgwire_server.rs

Problem

Starting daemon with --refresh-crds does not clear CRD schema cache before session initialization.

This is inconsistent with other modes and can leave daemon sessions running on stale CRD schemas.

Why this matters

  • Daemon is long-lived, so stale schema effects can persist for a long time.
  • Same flag has different semantics depending on mode.
  • Users may expect k8sql --refresh-crds daemon to force fresh schema discovery but it currently doesn't.

Proposed fix

  1. Centralize refresh logic in one helper (e.g. maybe_refresh_crd_cache(bool)).
  2. Invoke it before startup in all modes:
    • batch
    • interactive
    • daemon
  3. Keep failures non-fatal (current behavior), but emit warning consistently.

Tests to add

  1. Integration/behavioral test that daemon path triggers refresh when flag is set.
  2. Regression test ensuring mode parity for --refresh-crds behavior.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions