Skip to content

Say whether a ConfigMap or Secret changed after each consumer started (#410 P2) - #514

Open
hellices wants to merge 12 commits into
mainfrom
feat/513-config-change-order
Open

hellices wants to merge 12 commits into
mainfrom
feat/513-config-change-order

Conversation

@hellices

Copy link
Copy Markdown
Owner

Closes #513

Summary

Slice P2 of #410. The :consumers view now says whether a change to the selected ConfigMap or Secret, seen this session, followed each environment-variable or subPath consumer's container start. It follows the design's "P2: when a change is known to follow a start" section.

  • Start times (core/config_consumers.py): Consumer.started_at holds only state.running.startedAt, read from the container's own status list (containerStatuses, initContainerStatuses or ephemeralContainerStatuses) and matched by name. A container that is waiting, terminated or has no status has no start. lastState and terminated.startedAt are never read, and no other status field reaches the result.
  • Bounds and ordering (new core/config_changes.py, pure):
    • A change is bounded by the old sighting's send time and the new sighting's arrival, so a delayed old-version response can't push the bound past the change.
    • Resource versions are compared for equality only.
    • A change counts as after the start only when the whole bound is at least one minute after it (sent_old >= started_at + 1m), and as before only when it ends at least one minute before (arrived_new <= started_at - 1m). Anything else is "not established".
    • ChangeLog is keyed by context epoch, session generation, kind, namespace, name and observed UID. It holds at most 256 objects and ignores a sighting sent before the last one.
  • Sightings (core/config_propagation.py): each run takes a send time before its reads and reports PropagationReport.sighting from the metadata GET's resourceVersion and the observation's arrival. The design didn't say which reads make sightings; the plan's "Where the sightings come from" section explains the choice. As a result, a change is seen only when the view was opened both before and after it.
  • Controller: keeps the ChangeLog across runs and passes the latest change to the view.
  • View:
    • An Object change column appears only when a change is known. It reads "changed after this container started", "changed before this container started" or "not established" on environment and subPath rows, and is empty on volume rows.
    • A note gives the change's bounds in UTC and says a new resource version may change only metadata.
    • Without a known change, a note says how a change is seen.
  • Docs: docs/tui.md, the unreleased notes, and the plan docs/superpowers/plans/2026-10-31-config-change-order.md.

No version-matrix scenario is added: a matrix cluster's Pods are not guaranteed to be running, and P2 doesn't depend on the API version.

Verification

  • Tests were written to fail first for each task. New tests:
    • tests/core/test_config_changes.py: straddling, a delayed old response, the skew boundaries, another scope or UID, out-of-order and same-moment sightings, eviction, input checks.
    • Start-time projection cases in tests/core/test_config_consumers.py: each status list, waiting/terminated/missing, a restart, a naive timestamp, the repr-leak check.
    • tests/core/test_config_propagation.py: the report's sighting.
    • tests/ui/test_config_propagation_controller.py: changes across runs, a denied run, a new UID, epoch or session.
    • tests/ui/test_config_propagation_screen.py: cells, notes, the column only with a change.
    • tests/ui/test_config_propagation_workflow.py: reopening end to end.
  • Mutation-checked every new condition: the skew comparisons, the out-of-order guard, same-version replacement, eviction order, the status list per category, the timezone check, and the screen's cell, column and note. All are caught, except the UID guard in the controller, which exists only for mypy (an observed object always has a UID).
  • Local gate, using the venv's tools behind the corporate mirror:
    • scripts/check_source_size.py, ruff check src tests, ruff format --check src tests, mypy src (272 files), tach check: all passed.
    • pytest -n 8: 14951 passed, 40 skipped, 2 failed.
      • test_device_login_prefixes::test_the_measured_release_is_the_installed_one is the known local-only failure: the local venv has litellm 1.100.3 and can't re-sync behind the mirror. CI has 1.100.4.
      • tests/performance/test_replay.py::test_replay_forbidden_aborts_with_an_explicit_terminal_error failed under -n 8 load; the file passes on its own (21 passed), and this branch doesn't touch k8s/ or the store.

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 7 commits October 30, 2026 09:58
The projection now keeps, of a Pod's status, only state.running.startedAt
for the container's own status list, so a later step can say whether a
change to the object followed the container's start.

Part of #513

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
core/config_changes.py keeps each object's last resource-version sighting
and its latest change, bounded by the old sighting's send time and the
new one's arrival, and orders a change against a container start only
outside a one-minute skew allowance.

Part of #513

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
explain_propagation now takes a send time before its reads and reports the
object's resourceVersion with it and the read's arrival, so a later run
can bound a change between two sightings.

Part of #513

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The controller keeps a ChangeLog keyed by the run's context epoch, session
generation and the object's observed incarnation, so reopening the view
after the object's resource version moved shows the change between the
two runs.

Part of #513

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When the view knows a change to the ConfigMap or Secret from this session,
an Object change column says, for each environment and subPath row, whether
the change followed the container's start, preceded it, or is not
established, and a note bounds the change. Without one, a note says how a
change is seen.

Part of #513

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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe the Object change column, its limits and the P2 plan.

Part of #513

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 01:14
@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

A backwards system-clock adjustment can trigger an uncaught ValueError in explain_propagation, preventing the consumers view from opening despite successful reads.

1 open issue
What changed in this PR

Adds session-observed change ordering to the :consumers view, extending ConfigMap and Secret propagation diagnostics with comparisons against each consumer’s current container start.

Changes:

  • Projects running-container start times and tracks bounded, UID- and session-scoped resource-version changes.
  • Shows before/after/unknown ordering for environment and subPath consumers, with a one-minute clock-skew allowance.
  • Adds core and UI coverage and documents the limits of session-only, metadata-based evidence.
File Description
tests/​ui/​test_config_propagation_workflow.py Tests change ordering after reopening the view.
tests/​ui/​test_config_propagation_screen.py Tests ordering cells, conditional columns, and explanatory notes.
tests/​ui/​test_config_propagation_controller.py Tests sightings across runs and scope changes.
tests/​test_optional_extras.py Checks the new module imports without optional extras.
tests/​core/​test_config_propagation.py Tests sighting creation and unavailable resource versions.
tests/​core/​test_config_consumers.py Tests start-time projection and status-field isolation.
tests/​core/​test_config_changes.py Tests change bounds, ordering, isolation, and eviction.
src/​korvid/​ui/​widgets/​config_propagation_screen.py Displays object-change ordering and evidence limits.
src/​korvid/​ui/​config_propagation_controller.py Retains sightings and supplies changes to the view.
src/​korvid/​core/​config_propagation.py Adds timed resource-version sightings to reports.
src/​korvid/​core/​config_consumers.py Projects each running container’s current start time.
src/​korvid/​core/​config_changes.py Implements bounded change tracking and skew-aware ordering.
docs/​tui.md Explains the new column and its limitations.
docs/​superpowers/​plans/​2026-10-31-config-change-order.md Records the implementation plan and verification approach.
docs/​release-notes/​unreleased.md Announces session-observed change ordering.

Review effort: Balanced

Comment thread src/korvid/core/config_propagation.py Outdated

@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.

이슈 2건을 인라인 코멘트로 남겼습니다.

Comment thread src/korvid/core/config_changes.py
Comment thread src/korvid/ui/config_propagation_controller.py
hellices and others added 2 commits October 30, 2026 10:24
Part of #513

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- explain_propagation reports no sighting when the clock stepped back
  between the send and the arrival, instead of raising.
- ChangeLog counts another version only from a read sent after the last
  sighting arrived: overlapping reads cannot say which version the server
  served first. The same version never moves the bound back.
- The controller records a sighting only when it shows the run.

Part of #513

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI previously approved these changes 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.

🟢 Approved

No active review issues block approval of the session-observed ConfigMap and Secret change-ordering update.

No open issues 🎉

1 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.

이슈 4건을 인라인 코멘트로 남겼습니다.

Comment thread docs/superpowers/plans/2026-10-31-config-change-order.md
Comment thread src/korvid/core/config_consumers.py
Comment thread src/korvid/core/config_consumers.py
Comment thread tests/ui/test_config_propagation_controller.py
- The note no longer says an earlier change is not known: one may have
  been seen. It describes the latest change seen this session.
- The projection's docstring names status name as read, to match a
  status to its container.
- The dropped-run test checks for a stray screen before reopening.

Part of #513

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI previously approved these changes 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.

🟢 Approved

No active review issues are identified for the session-observed change-ordering update.

No open issues 🎉

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.

이슈 3건을 인라인 코멘트로 남겼습니다.

Comment thread src/korvid/core/config_consumers.py
Comment thread tests/core/test_config_changes.py
Comment thread docs/superpowers/plans/2026-10-31-config-change-order.md Outdated
Part of #513

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

@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.

이슈 2건을 인라인 코멘트로 남겼습니다.

Comment thread src/korvid/core/config_consumers.py
Comment thread docs/superpowers/plans/2026-10-31-config-change-order.md Outdated
Part of #513

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

@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.

Say whether a ConfigMap or Secret changed after each consumer started (#410 P2)

2 participants