Skip to content

Show a workload's possible creation constraints (#411 Q2, view) - #530

Open
hellices wants to merge 3 commits into
mainfrom
feat/411-possible-constraints-view
Open

hellices wants to merge 3 commits into
mainfrom
feat/411-possible-constraints-view

Conversation

@hellices

Copy link
Copy Markdown
Owner

Closes #529

Summary

The view half of #411's Q2 slice. The :blocked view gains a fourth section, Possible constraints, built from possible_constraints() (#528): what the workload's next Pod, as its template asks, could run into under the namespace's quotas and LimitRanges as now observed.

  • Rows.
    • Each row names its policy ("quota compute", "LimitRange tight") once per run of rows, then says what the row is about, the finding and the detail. For example: requests.cpu · would exceed · needs 500m; none remaining.
    • Enter opens the policy.
    • A claim row holds only if the claim is created: "would exceed, if the claim is created", or "if the claims are created" when several new claims are charged together.
  • Notes.
    • The LimitRanges' Container defaults filled what the template leaves unset; other admission plugins can change a Pod further.
    • A possible constraint is not a cause or a forecast: quota status is not a reservation, other Pods are created concurrently, and admission webhooks are not observed.
    • "No ResourceQuota or LimitRange observed constrains this template" appears only when the core concludes it.
    • Otherwise the view says why that is not established: the lists were not all read, a RuntimeClass is set, or a claim has no storage class.
    • An unreadable template leaves the possibilities not established.
  • Version matrix. The quota scenario now checks the blocked Deployment's possible constraints on a real cluster: defaults applied, and only matrix-pods: pods at its limit. The workflow also runs when creation_demand.py or creation_possibilities.py changes.
  • Docs. docs/tui.md (section table and reading note), docs/keybindings.md, the release notes, and the plan docs/superpowers/plans/2026-10-31-creation-possibilities-view.md.

The controller, command and wiring are unchanged; the report already carries the template. The row count does not depend on the clock (now only decides nothing_constrains, which is a note), so the timer's cell refresh stays index-stable.

Verification

  • 11 new tests in tests/ui/test_creation_constraints_screen.py (8 functions, one parametrized over 4 cases), written to fail first:
    • section order and once-per-run policy names;
    • claim condition, singular and plural;
    • defaults and caveat notes;
    • the "nothing constrains" conclusion;
    • each reason it is not established;
    • a list going stale;
    • an unreadable template;
    • Enter on a possibility row in a Textual pilot.
  • Mutation checks on every new branch of the view, all caught. They exposed a missing case: an inconclusive LimitRange list, now added.
  • The matrix expectation was checked offline: the fixture's Deployment, quota and LimitRange went through the real projections and gave [("matrix-pods", "pods", AT_LIMIT, "0 of 0 Pods exist")] with defaults applied. The live scenario runs on kind in CI.
  • uv run --frozen pytest -p no:tach tests/ui/test_creation_constraints_*.py: 57 passed.
  • Full gate run locally (check_source_size, ruff check, ruff format --check, mypy src, tach check, pytest -n 8): all pass except tests/providers/test_device_login_prefixes.py::test_the_measured_release_is_the_installed_one. That test fails only locally, because the installed litellm differs from the measured release; CI installs the locked version.

Checklist

  • This closes an accepted issue in this repository that is assigned to me.
  • Tests cover the change, written to fail first where behavior changed.
  • make check passes locally.
  • User-facing docs and the README match the change, or nothing user-facing changed.
  • No security invariant is weakened: writes still need a keystroke approval
    and a fail-closed audit entry, and sensitive reads are still masked.

hellices and others added 2 commits October 31, 2026 01:46
The view gains a fourth section, Possible constraints, from
possible_constraints(): each row names its quota or LimitRange once per
run, what it is about, the finding and the detail, and Enter opens the
policy. A claim row holds only if the claim is created.

Notes say that LimitRange Container defaults were applied, that a
possibility is never a cause or a forecast, and "No ResourceQuota or
LimitRange observed constrains this template" only when the core concludes
it; otherwise why that is not established. An unreadable template leaves
the possibilities not established.

Part of #529

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- The quota scenario checks the blocked Deployment's possible constraints
  against a real cluster: defaults applied, and only the Pod count left.
- The version-matrix workflow also runs when creation_demand.py or
  creation_possibilities.py changes.
- docs/tui.md, keybindings and release notes describe the section, and the
  plan records the slice.

Part of #529

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 16:47
@hellices hellices added this to the v0.7.0 milestone Oct 30, 2026
@hellices hellices added enhancement New feature or request area: ui Textual application, screens, widgets, and interaction design labels Oct 30, 2026
@hellices hellices self-assigned this Oct 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Timer refreshes can fail when stale LimitRange data introduces unmounted rows, and denied workload reads incorrectly suppress the required template-unreadable explanation.

2 open issues
What changed in this PR

Adds the view half of workload creation constraints: :blocked now displays the core calculations from #528 alongside recorded failures and namespace policies.

Changes:

  • Adds possible-constraint rows, policy navigation, conditional claim wording, and evidence caveats.
  • Extends UI tests and the live Kubernetes version-matrix scenario.
  • Updates workflow triggers and user-facing documentation.
File Description
tests/​version_matrix/​test_scenarios.py Checks computed possibilities against live cluster policies.
tests/​ui/​test_creation_constraints_screen.py Tests rows, notes, claim conditions, and navigation.
src/​korvid/​ui/​widgets/​creation_constraints_screen.py Renders possible constraints and explanatory notes.
docs/​tui.md Explains the new section and its evidence limits.
docs/​superpowers/​plans/​2026-10-31-creation-possibilities-view.md Records the implementation and verification plan.
docs/​release-notes/​unreleased.md Announces the possible-constraints section.
docs/​keybindings.md Expands the description of :blocked.
.github/​workflows/​k8s-version-matrix.yml Triggers matrix checks for demand and possibility changes.

Review effort: Balanced

@my-reviewer-agent my-reviewer-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

검토 범위에서 보고할 이슈가 없습니다.

- A LimitRange list going stale leaves defaults unknown, which can add
  possible-constraint rows that update_cell cannot reach. The timer now
  updates cells in place while every row still leads to the same place,
  and otherwise rebuilds the table, keeping the cursor index; only the
  last section changes with time.
- A workload that could not be read leaves the possibilities not
  established ("the Deployment could not be read"); only an absent one
  has no such note.

Part of #529

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

No active review issues remain for the change exposing possible workload constraints in the :blocked view.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@my-reviewer-agent my-reviewer-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

검토 범위에서 보고할 이슈가 없습니다.

This branch has not been deployed

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

Labels

area: ui Textual application, screens, widgets, and interaction design enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show a workload's possible creation constraints (#411 Q2, view)

2 participants