Skip to content

refactor: write once what was written out in several places - #125

Merged
ingvarch merged 5 commits into
mainfrom
refactor/audit-duplicates
Oct 17, 2026
Merged

ingvarch merged 5 commits into
mainfrom
refactor/audit-duplicates

Conversation

@ingvarch

Copy link
Copy Markdown
Owner

What changes

Five refactors from the code quality audit of 2026-10-16. Each one writes once a rule, a mapping or a width that was written out in several places. Nothing changes for someone using urga: the screens draw the same and the requests are the same.

  • The rule "no namespace or * means every namespace" lives in nomad.EveryNamespace, and "something new goes to default then" in nomad.TargetNamespace. Five copies in nomad and ui use them.
  • A deployment is read from the API by one function, newDeployment, for the list and for the deployment screen. Deployments, namespaces, evaluations, variables, node pools and plugins go through listed. Characterization tests now assert the whole of each list item.
  • The width inside the box is Model.innerWidth, used by the table, the text, the panel and the bar, and by the tests.
  • Panel rows start at tableIndent through panelRow, and the shared loop over lines of fields is fieldLineRows. Seven panels, the checks title, the deployment groups, the client charts and the token hint under a table use them. Each panel still leaves an empty line out, or keeps it, as it did before.
  • applyWhen and its flag and callback are gone. markAnswered marks the screen answered and schedules the poll, and applyList(view) only checks that the screen is still open. A new test covers what that check guards: a list answer that arrives for a screen that was left changes nothing.

Closes #118
Closes #119
Closes #120
Closes #121
Closes #122

Checklist

  • The test for this change was written first and failed
  • make check is green
  • The title is a conventional commit: feat(ui): ..., fix(nomad): ...

@ingvarch ingvarch added refactor Code restructured, behavior unchanged ui Screens, keys and the header nomad The client of the Nomad API and what it reads priority: medium Wrong result or wrong target in a common case labels Oct 17, 2026
@ingvarch
ingvarch merged commit 9efedd3 into main Oct 17, 2026
5 checks passed
@ingvarch
ingvarch deleted the refactor/audit-duplicates branch October 17, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nomad The client of the Nomad API and what it reads priority: medium Wrong result or wrong target in a common case refactor Code restructured, behavior unchanged ui Screens, keys and the header

Projects

None yet

1 participant