Skip to content

fix(k8s): resolve the port-forward state file under the repo data root #810

Closed as not planned

Description

@dan-petty

Context & Rationale

PortForwardDaemonManager defaults its state file to the relative path .data/k8s/port_forwards.json (src/devops_cli/k8s/port_forward_daemon.py:16, used at :75). A relative path resolves against the current directory. So devops k8s port-forward-status run from a subdirectory reads a different, usually missing, file and reports no forwards, and port-forward-stop cannot find the forward it should stop. Other .data paths resolve through resolve_data_path (src/devops_cli/core/repo.py:194-200), which places them under the main worktree.

Scope & Deliverables

  • Deliverable: the default state file resolves through resolve_data_path when the manager is constructed. An explicitly passed state_file is used as given.
  • Acceptance criteria:
    • The test suite leaves no .data/k8s/port_forwards.json in the project. Today tests/test_k8s.py writes one there, with pid 1 entries for the argocd, grafana, prometheus and jaeger forwards; stop_forwards skips pids of 1 or less, but the file escapes fix(test): tests never write to the project config, data or tracked files #749's guarantee that tests never write to the project data. Resolving the state file under the data root brings it under the tests' isolated data directory.
    • A forward record saved with the working directory at the repo root is listed by a manager constructed with the working directory in a subdirectory.
    • The symlink guard (port_forward_daemon.py:78-80) still refuses a symlinked state file.
    • Tests spawn no kubectl and touch no network.
  • Key questions:
    • Resolve at construction or at import? At construction (proposed), so a changed working directory and test fixtures are honoured.
    • Migrate existing state files? No (proposed). In the usual case the old relative path, taken from the repo root, is the same file.
  • Constraint: no change to how forwards are started or stopped.

Strategic Alignment

  • Milestone: Backlog
  • Depends on: none

Activity

  1. added
    type/bug
    scope/k8s
    priority/p2-medium
    on Oct 1, 2026
  2. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Merged into #1036: the port-forward state file is the same cwd-relative .data default as the durable store. #1036 now resolves both, plus docs ingest, through one data-directory helper with an invariant test, and it carries this item's criteria and constraints.

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

    priority/p2-mediumscope/k8stype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions