Commit Graph
7806 Commits
Author SHA1 Message Date
ZverGuy 7105364161 test(dashboard): pin when the previous-lines note goes away
The note must leave as soon as the new result lands and must not appear
over live lines while following; neither was exercised, since the only
test kept the longer range pending forever.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 01:02:17 +07:00
ZverGuy 051442b318 fix(dashboard): mark previous log lines while a new query replaces them
The previous result stays on screen while a new range or filter loads,
with nothing saying those lines answer the old query. A status line now
says so until the new result arrives. The empty case reads a placeholder
as loading whether or not the request is in flight, so a paused query
does not claim that nothing matched either.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 00:58:29 +07:00
ZverGuy 48f459e103 fix(dashboard): say the logs are loading while an empty result stands in
The previous result stays on screen while a new range or filter loads.
When that result was empty, the query reports success, so the view said
no lines matched the range it had not read yet.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 00:54:51 +07:00
ZverGuy 7eff63b028 refactor(dashboard): drop the scope-keyed placeholder from the logs view
The logs view remounts under a key per scope, so its queries start with
no previous result to carry over and the scope check never had anything
to refuse. The key is the one guard, and the tenant-switch tests fail
without it.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 00:51:01 +07:00
ZverGuy 4be80657be test(dashboard): prove /observability/logs opens the application page
The list page shows the same "Loading…" text as the detail page, so the
previous check could not tell which route matched. A missing instance
makes only the detail page answer with its own name, and the GET it
issues names the plural and the application.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 00:41:10 +07:00
ZverGuy 2e5a3bd6a7 fix(dashboard): keep the tenant logs page off application URLs
Every console path of one or two segments belongs to an application
list or detail page, so /console/observability/logs took the Overview
of an application named logs whose kind has the plural observability.
Kubernetes names must start with an alphanumeric character, so the
reserved "-" segment cannot collide with any application.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-09 15:47:34 +07:00
ZverGuy 32a466fb14 fix(dashboard): scope the logs and metrics tabs to the selected app
The provider keeps a query's previous result while its key changes, so
while the next application's GET is pending the detail page still holds
the previous instance. The Logs and Metrics tabs took the application
name from that instance, so their proxy root did not change and the
previous application's lines and series stayed under the new heading
until the GET completed.

Take the name from the route instead, which is the identity the user
selected, and cover the pending GET at the route level with the real
page, router and production query defaults.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 18:10:35 +07:00
ZverGuy 89194b4f88 fix(dashboard): reset the log filters when the tenant or app changes
LogsView kept its filter, pod and container across a scope switch, so
the first request for the new tenant still asked for the previous
tenant's pod before the picker fell back to All. The view's state is
now keyed on the proxy root, so a new tenant or application starts
with no filter and All selected.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 06:17:48 +07:00
ZverGuy 711a82eaaf refactor(dashboard): drop the scoped placeholder from metrics panels
useQueries creates a new observer for every new key, so the metrics
panels never carried a previous result across scopes and the scoped
placeholder there did nothing. The switch test for the panels stays
and passes without it; the helper's comment now says which queries it
is for.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 06:15:06 +07:00
ZverGuy 9c111b3a95 fix(dashboard): keep placeholder results within one observability scope
The provider keeps a query's previous result while its key changes, so
switching tenants showed the first tenant's log lines and pod names
under the second tenant's heading until its request returned. Every
observability query now keeps the previous result only while the
proxy root is the same, so a new filter or range still shows the old
lines, but a new tenant or application starts empty. Tests render with
the provider's own query defaults.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 06:11:34 +07:00
ZverGuy 311cb1c90b fix(dashboard): skip tail dedup for rows without a stream ID
A pipe such as `delete _stream_id` leaves rows from different streams
that share a timestamp with the same dedup key, so a resumed tail
dropped a record it had never shown. Only rows that still carry both
_stream_id and _time are deduplicated now, as the accepted logs design
specifies.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 06:10:02 +07:00
ZverGuy bfa85e57bf fix(dashboard): show sample times the same way in legend and table
The legend used a fixed US date format while the data table used the
reader's locale, so one panel showed the same instant two ways. Both
now use one locale-aware format. A test also pins that the data
toggle stays disabled for a panel with no series or an error.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 00:56:26 +07:00
ZverGuy 046df7fe96 fix(dashboard): say the legend shows the latest sample
In the browser the legend's time still read "--" next to the latest
values, and the data table repeated the same minute on every row at
the one-hour range, whose step is 15 seconds. The legend's time now
reads "latest" until a point is hovered, and the table shows seconds.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 00:53:06 +07:00
ZverGuy 601c9ece3f docs(dashboard): note why the metrics panels refresh on an interval
The console rule against refetchInterval assumes a watch is available,
which holds for Kubernetes lists but not for the proxy's Prometheus
query API. Record the exception so the metrics panels' refresh does
not read as a rule violation.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 00:18:47 +07:00
ZverGuy 7d43c3bcd6 fix(dashboard): open each new log result at its newest line
The console keeps a query's previous data as placeholder while the next
one loads, so the log list was never remounted between queries. After
a reader scrolled up, a new filter or range opened at the old scroll
offset instead of the newest lines. The list is now keyed on the query
and range as well.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 00:18:38 +07:00
ZverGuy ef7312579d fix(dashboard): offer a retry when the log query fails
The console does not refetch on window focus and must not poll, so a
failed history query stayed failed until the filter or range changed,
even after the store recovered. The failed state now has a Retry
button that runs the same query again.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 00:18:33 +07:00
ZverGuy 52087d92dc fix(dashboard): keep the logs view when only the pod list is refused
The pod picker's values query counted as a scope-wide refusal, so a
proxy that refused only that path replaced the whole view, filter and
lines included, with a notice even though the log query itself worked.
A real scope-wide refusal still reaches the history or tail query and
shows the notice from there.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 00:18:25 +07:00
ZverGuy e65d827cf9 fix(dashboard): move the tenant logs page under observability/
The fixed /console/logs route came before the generic :plural route,
so an application kind with the plural "logs" would have its list page
replaced by the logs page. A two-segment path cannot shadow an
application list, the same way the backups and migration pages avoid
it.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 00:16:49 +07:00
ZverGuy 8e6048eb4a fix(dashboard): make metric samples readable without a pointer
The charts are a canvas and their legend showed dashes until a point
was hovered, so keyboard and screen-reader users could not read any
sample. The legend now shows each series' latest value when nothing is
hovered, and every panel has a Show data toggle that opens a focusable
table of all samples, newest first, in the chart's units.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 00:16:04 +07:00
ZverGuy 1e1fdb740c fix(dashboard): show log rows a pipe stripped of their timestamp
A LogsQL pipe such as `fields _msg` or `stats` returns rows without
_time, and the console dropped every one of them, so a successful
query read as "no lines matched". Such rows are now kept in the order
the store sent them, shown without a timestamp, and never
deduplicated on a tail resume. A row without _msg shows its remaining
fields instead of an empty line.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-05 00:14:24 +07:00
ZverGuy 2a473086cf fix(dashboard): advise a shorter range unless the proxy already did
Any "; " in a 422 message was taken as the proxy's own remedy, but the
proxy passes vmselect's 422 bodies through, and their advice (raise
the -search.max* flags) is for operators. Those lost the one thing a
tenant can do. Only the remedies the proxy itself appends now replace
the console's advice.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 19:11:05 +07:00
ZverGuy 76441871b8 fix(dashboard): keep caller headers of any shape in the k8s client
The client spread init.headers as a plain object, so a Headers
instance or a list of pairs passed by a caller was silently dropped
and the request went out without them. Headers are now built with the
Headers constructor, which accepts every shape fetch does.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 19:06:59 +07:00
ZverGuy 9498c9bff5 fix(dashboard): keep the proxy's own advice on a limit refusal
The notice appended "Choose a shorter range." to every 422, so a
message that already ended in "use a shorter range" said it twice and
one that ended in "raise step" got advice that contradicted it. The
console's own advice is now added only when the proxy gave none.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 19:05:42 +07:00
ZverGuy 881eea5246 fix(dashboard): suggest a longer log range only when there is one
On 24h, the longest range the log view offers, the empty console still
told the reader to try a longer range. It now suggests only a broader
filter there, as the metrics panels already do.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 19:04:58 +07:00
ZverGuy fca5ca78de fix(dashboard): treat an open log tail as live before its first line
The tail counted as live, cleared its error and reset its backoff only
when a line arrived. A quiet application therefore showed "Connecting"
forever, a 429 warning stuck after the retry succeeded, and every idle
close by the proxy (its tail idle timeout) raised the backoff towards
30s and reconnected without since, losing lines written in the gap.

The tail now reports when the response opens. That marks it live,
clears the error and resets the backoff; a clean close reconnects at
the base delay; and with no line seen yet the reconnect resumes from
the time the stream opened.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 19:04:29 +07:00
ZverGuy c9a15cb8ae fix(dashboard): suggest a longer metrics range only when there is one
With the longest range already picked, the empty panel still told the
reader to try a longer range, which the picker cannot offer.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 18:56:01 +07:00
ZverGuy 554dad87bb fix(dashboard): give the range picker the toolbar's focus ring offset
The range buttons drew their focus ring flush against the button while
the Select and Input next to them offset it, so keyboard focus looked
different from one control to the next. The empty metrics hint also
repeated its title; it now suggests the one thing that can help.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 18:53:58 +07:00
ZverGuy 6740ed4458 fix(dashboard): offer All once when a log stream has no pod name
VictoriaLogs can return an empty value for the pod or container field
when some streams lack the label. That empty value is the picker's own
"All" sentinel, so the list showed two selected "All" entries with the
same key. Empty values are dropped from the field values.

The tests now also pin what the log console says when Follow stops
before any line and when the history query fails, so those messages
cannot silently swap with the empty-result one.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 18:53:47 +07:00
ZverGuy 05b0ea0c45 fix(dashboard): hold each metrics chart's place while empty or loading
A metrics panel with no series, or still loading, shrank to one line of
small text or a bare spinner, so the tab jumped by the chart's height
when data arrived and an empty range looked like a broken panel. Both
states now fill the chart's slot and say what is going on, the same way
the log console does.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 18:49:39 +07:00
ZverGuy f5ebb43c4b fix(dashboard): match the range picker to the log toolbar controls
Next to the new Select and Input the range picker was shorter, lighter
bordered and had no focus ring, so the toolbar looked uneven and a
keyboard user could not see which range had focus. It now shares their
height, border and focus ring, and its buttons are grouped under one
accessible name.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 18:48:43 +07:00
ZverGuy b88ad09678 fix(dashboard): keep the log console on screen when it has no lines
With no matching lines, while loading, and while Follow waits for the
first line, the dark log console vanished and left a line of small
grey text or a bare spinner, so the page jumped and an empty result
looked like a broken view. The console frame now keeps a fixed height
in every state and says inside it what is going on.

The pod and container pickers move to the console Select and the
filter to the console Input, so the toolbar is keyboard and screen
reader friendly and a long pod name truncates instead of widening it.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 18:47:25 +07:00
ZverGuy f500aa955a feat(dashboard): add a text Input matching the console select
Every text field in the console restyles a bare input by hand, each a
little differently. A toolbar that mixes a text filter with the new
Select needs the two at the same height, border and focus ring, so the
styling lives in one place next to the Select instead of being copied.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 18:46:15 +07:00
ZverGuy 3b1302ba8e feat(dashboard): add an accessible Select to the console
The console has no select primitive: form widgets fall back to the
native element, and the shared Dropdown has no listbox roles, no
keyboard navigation and no label association. Base UI, already a
dependency, ships one; this wraps it the same way dialog.tsx wraps the
Base UI dialog so pickers get a labelled, keyboard-driven listbox that
matches the console's buttons.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 18:45:36 +07:00
ZverGuy 2b823ab79f fix(dashboard): rate over at least 5m and four steps
Long metric ranges are served by the longterm store, which keeps one
sample per 5m, so a rate window narrower than that can hold no samples
and the chart comes back empty. Four steps also keep every sample
between two points inside some window.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:53:50 +07:00
ZverGuy ebdd74ce4e fix(dashboard): name the proxy's real load status for a refused tail
The proxy caps rate and concurrent tails with 429, so the retry
reasoning and its test now say so. Leaving Follow also remounts the
log list, so the history it falls back to opens at the newest line
even when the reader had scrolled up while following.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:53:23 +07:00
ZverGuy 1b4ce7433e fix(dashboard): keep retrying a log tail refused for load
The proxy answers a tail over its rate or concurrent-tail cap with a
4xx, and a reconnect can arrive before the previous tail's slot is
freed. Treating that as final left Follow stopped for good, while the
existing backoff already waits long enough for the cap to clear.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:50:33 +07:00
ZverGuy 84ed3aaefd fix(dashboard): follow the newest line again after the log list clears
A reader who scrolled up stayed unpinned across a new follow run or a
new filter, so the fresh list sat at its top while lines streamed in
below. An empty list now means the reader is back at the bottom.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:50:33 +07:00
ZverGuy b05323f6be docs(dashboard): note the observability proxy client in the console guide
The next session needs to know why one module bypasses the typed
Kubernetes client and where the charting dependency is loaded.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:47:28 +07:00
ZverGuy 290490769e fix(dashboard): let the reader scroll up while logs stream
The viewer jumped to the newest line on every 100 ms flush, so a line
could not be read on a busy application. It now follows the bottom
only while the reader is already there, and says when a refused tail
has stopped instead of showing it as connecting.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:47:13 +07:00
ZverGuy 4b44971d12 fix(dashboard): start each log follow run with its own buffer
Turning Follow off and on again reused the previous run's buffer, so
new lines were appended after a silent gap and, on a quick toggle,
duplicated. A follow run is now identified by a session value, so the
buffer starts empty each time.

A resume now uses the newest _time seen rather than the last line
received, so an out-of-order line cannot move since backwards, and
the backoff sleep no longer leaves an abort listener per retry.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:47:13 +07:00
ZverGuy 97dcf4c4f0 fix(dashboard): treat an apiserver answer on a proxy path as no proxy
Until the console nginx routes the proxy roots, those paths reach
kube-apiserver, which RBAC-denies the namespace root with 403 for a
tenant, so the Logs page told every tenant they lacked permission. The
proxy itself answers in plain text, so a Kubernetes Status body is a
reliable sign that the path did not reach it.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:45:42 +07:00
ZverGuy c5b57bffd1 fix(dashboard): open log history at the newest line
A historical query lists lines oldest first, so the viewer opened at
the top of a 500-line window while the line a user looks for is
usually the latest. The chart's value axis also clipped wide labels
such as "476.8 MiB".

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:39:27 +07:00
ZverGuy f9ed2afad7 feat(dashboard): show logs on application pages and per tenant
A Logs tab on application detail pages reads the application root of
the observability proxy, and a Logs page under a new Observability
sidebar group reads the tenant namespace root, so lines from before
the application identity labels existed stay reachable there.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:34:01 +07:00
ZverGuy b5a0ab8de6 feat(dashboard): add a log viewer for the observability proxy
Tenants could not read their applications' logs without Grafana. The
viewer reads VictoriaLogs' native responses through a proxy root: a
time-ranged LogsQL query, pod and container pickers fed by the stream
field values of the same scope, and a follow mode over the streamed
tail.

The picked pod and container wrap the filter part of the query rather
than being appended to it, because AND binds tighter than OR in LogsQL
and the user's pipes must still run last. A dropped tail resumes from
the last line's _time; the proxy may replay lines around that point,
so the client drops replayed lines it already holds by stream and
time, which VictoriaLogs does not guarantee unique and is therefore
applied only at the resume boundary. Follow keeps the newest 1000
lines so a chatty stream cannot grow the page without bound.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:34:01 +07:00
ZverGuy 063e56ede5 feat(dashboard): show resource consumption on application pages
Tenants had no way to see what their applications consume. A Metrics
tab on every application detail page (except VM disks, which run no
containers) charts CPU, memory and network for a selectable range
through the observability proxy's application root, which injects the
scope server-side, so the queries stay kind-agnostic and no per-kind
UI is needed.

Charts use uPlot: about 25 KB gzipped with no dependencies, built for
time series, and loaded only with the Metrics tab so other pages do
not pay for it. A cluster without the proxy answers 404 and the tab
says metrics are not available there instead of showing an error.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:30:03 +07:00
ZverGuy e96ceedd7e feat(dashboard): add a console client for the observability proxy
The observability proxy serves metrics and logs under Kubernetes-shaped
paths but answers in native Prometheus JSON and VictoriaLogs NDJSON, so
the typed K8sClient methods cannot read it. A raw fetch on the client
keeps the same credentials and 401 handling the rest of the console
uses, and the proxy module maps each documented status to its own
error kind so a cluster without the proxy (404) can be told apart from
a denied request or a store that is down.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-04 05:25:58 +07:00
myasnikovdaniil 4087218a02 docs: move the repo-only guides onto the website (#5034)
## What this PR does

Seven guides under `docs/` were operator facing and written alongside
the code, and left in the source tree where no user looks. They are on
the website now, so this deletes them here and repoints every reference.

```
docs/operations/backup-classes.md                  -> operations/services/backup-classes
docs/operations/resource-presets.md                -> guides/resource-management
docs/storage-immutability.md                       -> operations/storage-class-immutability
docs/operations/system-memory-limits.md            -> operations/configuration/system-memory-limits
docs/gateway-classes.md                            -> networking/gateway-classes
docs/observability/distributed-tracing.md          -> operations/services/monitoring/distributed-tracing
docs/operations/seaweedfs-capacity-for-backups.md  -> operations/services/object-storage/capacity-for-backups
```

`docs/release.md`, `docs/deprecating-applications.md` and the two
SeaweedFS runbooks in `docs/operations/` stay. A workflow, `AGENTS.md`,
a migration and a bats suite read them by path, which is the test from
#3777.

References point at `https://cozystack.io/docs/v1/...`. The site
rewrites that short prefix to the latest version in `layouts/404.html`,
so the links follow releases and pin none. Backup Classes, resource
management and `storageClass` immutability exist in the latest version
already. The other four pages are only in `next/` until 1.7.0 is
promoted, and their links start to resolve then. The generated mongodb
files come from `values.yaml` through `make generate` with
cozyvalues-gen v1.7.0, the version pinned in
`.github/workflows/pre-commit.yml`.

Tests: helm unit tests for mongodb (151), postgres (209), vm-disk (114)
and kubernetes-nodes (223), go tests for backupcontroller, presets and
the operator, rd-presets-check, the migration-50 bats suite.

### Downstream repositories

- [x] [cozystack/website](https://github.com/cozystack/website) -
follow-up: cozystack/website#763

Walked the rest of the trigger map against the diff. No provider
follow-up: the mongodb `values.schema.json` diff is one `description`
string, with no field added, removed or renamed, no enum, no default,
and no `kind`, `plural` or `release.prefix` change.
`packages/core/platform/values.yaml` changed in comments only and no
key, so the hand written platform-package table on the site is
unaffected.

Please merge after cozystack/website#763, the links in the code only
resolve once those pages deploy.

### Release note

```release-note
docs: seven guides move from the docs/ directory of this repository to cozystack.io (Backup Classes, resource presets, storageClass immutability, system component memory limits, GatewayClass selection, distributed tracing, SeaweedFS capacity for backups), and in-repo references point there.
```
2026-11-03 23:09:46 +05:00
Timofei Larkin e31f518df7 ci(api-review-gate): publish the gate as a commit status (#3440)
## What this PR does

Publishes the `API Review Gate` merge context as a commit status, so a
skipped or cancelled run cannot pass it or poison it, and gives fork PRs
the same gate through a privileged `workflow_run` workflow.

### Why

The merge context was a job name. A required job that skips counts as
passed, and check runs are not deduplicated per name, so one cancelled
run on a head keeps the context failed until the next push. Measured on
this repo: `41d1153c` has four check runs with the gate's job name (one
`cancelled`, three `success`). Commit statuses are deduplicated per
context and the newest wins, so a run with no verdict posts nothing and
the previous status stays.

### What changes

Same-repo PRs get status from `api-gate-report`. A `pending` opener
marks the head before the evaluation on approve, dismiss and
request-changes reviews, so an old `success` is not mergeable for the
minute the evaluation takes. `COMMENTED` reviews no longer count as a
reviewer's latest review, so an owner who approved and then commented
keeps the approval. Concurrency is split, so bot comment run cannot
cancel live evaluation.

Fork PRs: `api-review-gate-fork.yaml` runs from the default branch and
reaches the verdict itself, the fork's run is only a trigger. `resolve`
finds PR by head SHA in open PR list (review runs on a fork report base
repo as head repository and have no pull requests). `detect` fetches the
head as data and runs the detector in a job with `contents: read` only.
`conclude` applies the approval rule and posts. A sweep every 15 minutes
moves the status of fork PRs whose runs wait for a maintainer in
`action_required`, those never fire `workflow_run`. This is lllamnyp's
patch, applied whole, with these changes on top:

- two open fork PRs on one head fail closed in `resolve` and in the
sweep, a head carried by a same-repo PR stays with `api-gate-report`
- detector is built from default branch only, merge base is picked by PR
author and an old one would mean an old detector
- the fork `detect` step runs under `bash -e` and detector exit 2 ended
it before the code was read, so it has `set +e` like the same-repo job
- head is checked out with links as links, like the same-repo gate does,
because flattening them hid a CRD behind a file link from the detector
while Helm still ships it

### Limits

- A fork PR whose push run waits for a maintainer's approval has no
status until that run executes, same as `E2E Tests`.
- A fork PR on a head that a same-repo PR also carries shows the verdict
standing there, one commit status cannot hold a verdict per base.
- The sweep can publish a stale `success` if it reads an approval,
stalls, and the owner withdraws it meanwhile. The next sweep flips it
back, so the window is up to 15 minutes.
- Two copies of one first-party CRD and CRDs behind directory links are
gaps of the detector on main, same for same-repo PRs, they are in
https://github.com/cozystack/cozystack/issues/5170.

### Testing

`actionlint` is clean on both workflows. `zizmor` is clean too, but
`dangerous-triggers` and `template-injection` are disabled repo-wide in
`.github/zizmor.yml`, so that says little about a privileged workflow. I
ran the `github-script` bodies under node with a mocked API (every
conclusion, approval and shared head case) and the run steps under `bash
-e` with a stub detector exiting 0, 2 and 1. `make unit-tests` passes
with `LC_ALL=C` (a kafka bats test depends on the locale, nothing to do
with this PR).

Not exercised live: the fork path and the sweep run only from the
default branch, so their first run is after merge.

### Repo admin

Branch protection requires the old job name `Require API owner review
for sizeable API changes`. This PR renames that job, so after merge the
required context has to be changed to the `API Review Gate` status.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
NONE
```
2026-11-02 19:15:18 +04:00
Aleksei Sviridkin a2cc9a3016 fix(dashboard): link a tenant row to its detail page (#4004)
## What this PR does

Fixes #3822

Tenant list showed name as plain text and the only link in a row was
Edit button, so tenant detail page with its tabs and Delete was
reachable only by opening edit form and cancelling out of it. Name cell
is a link to that page now, it appears exactly where Edit appears and
points to the same CR. Plain click switches selected tenant to the row's
parent first, same as Edit does, because detail page takes namespace
from selected tenant. Ctrl, cmd and shift click don't run that switch,
so the tab you open a tenant from stays where it was.

First commit fixes what the link depends on. Console recovers a tenant's
parent from namespace name (`tenant-a-b` sits under `tenant-a`), but
root is the one level that naming skips: tenant `acme` ordered in
`tenant-root` owns `tenant-acme`, not `tenant-root-acme`. So
`realParentNamespace` returned undefined for every top level tenant,
which is most tenants on a normal cluster, and Edit button has been
missing there for as long as it exists. Ancestor labels carry the parent
that the name does not. Root level tenant named `root-x` resolves to CR
`root-x` now, not `x`.

### Notes

I first tried to make links carry their tenant in the url (`?tenant=`),
so a detail page opened in new tab resolves on its own. That turned into
questions about tenant context itself: what to do with a tenant in a
link the user can't see, what localStorage may hold, and TenantNamespace
LIST ignoring `labelSelector`. Detail route addresses a Tenant CR by
relative name and takes namespace from selected tenant, and making that
robust is a refactor of tenant context and routing, which should start
with study and planning, not with patches on patches. So this PR only
closes the UX gap (no way from tenant list into a tenant's page), going
deeper is out of scope.

Known limit that comes with it: link has no tenant in it, so opening it
in a new tab (ctrl/cmd/middle click, open in new tab, copied url)
resolves against the tenant last selected in any tab, because selection
lives in shared localStorage. For a row directly under that tenant it
opens the right page. For a row deeper in the tree the page says
`Application <name> not found.` and there is no Delete. If that tenant
also has a direct child tenant with the same relative name, new tab
opens that other tenant's page with working Edit and Delete, and delete
confirm says only `Delete Tenant "<name>"?`. Plain click in the same tab
is not affected. Detail page's own tabs and Edit link already behave
this way, it's how detail route resolves its namespace today and fixing
it properly is the refactor above.

A row links, and offers Edit, exactly when namespace holding its Tenant
CR is one the apiserver returns to this user. It returns a tenant
namespace only if the user is subject of a RoleBinding in it, so
sub-tenant admin that cant act in `tenant-root` sees no link there.

No row level Delete button. Issue allows either that or a route to
detail page, I took the route so confirm and mutation stay in one place.

Covered by tests, every source change here fails a test when reverted:

- top level tenant, nested one, root level tenant named `root-x`, forest
root without ancestor labels
- bridged row whose real parent is invisible gets neither link nor Edit
- plain click switches to the row's parent and opens detail page
- ctrl click leaves selection and location alone

### Screenshots

Tenant list under root on a dev cluster. Every row name is a link to
tenant page now (`pr4078` is hovered), top level tenants had neither
link nor Edit before. Host column redacted.

<!-- SCREENSHOT: drag in 01-tenant-list-links.png here -->
<img width="1440" height="900" alt="01-tenant-list-links"
src="https://github.com/user-attachments/assets/39cd723a-1ac5-4d3b-8c36-b70ddc626961"
/>


### Downstream repositories

<!--
Cozystack is upstream for repositories that are NOT kept in sync with it
automatically, and nothing in CI compares the two sides, so a change
here can break them silently.

Which change forces what, and which file to touch, is the trigger map in
docs/agents/contributing.md under "Downstream Repositories". Walk it
before you tick anything.

IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM
TO FILL IN:

1. Walk the trigger map against the actual diff of this PR, file by
file. Do not decide from the PR title or from your memory of what you
changed.
2. For every repository you tick, open the follow-up PR there and link
it on the same line. A ticked box with no link claims work that does not
exist, which is worse than an empty box. Search that repository for an
open PR or issue covering it first, and link that instead of filing a
duplicate.
3. When the follow-up is out of scope, or needs a decision that is not
yours to make, open an issue in that repository instead, link that, and
say so in the PR body. Do not push a speculative PR into another
repository just to fill a line here.
4. Do not tick "No downstream repository is affected" to make the
checklist go away. If you are unsure, leave every box empty and say so
in the PR body, so a human decides.
-->

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

All changed files are under `packages/system/dashboard/images/console`,
console has no downstream copy (standalone UI repo is archived).

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same `type(scope):` prefix as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
fix(dashboard): tenant name in the tenant list links to its detail page now (where Delete is), and top level tenants get their Edit button back.
```



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Root-level tenant names are now displayed without incorrectly removing
prefixes, and tenants ordered directly under the root are correctly
recognized in the hierarchy.
* Tenant rows link to their detail pages when the parent tenant is
accessible. Same-tab navigation updates the active tenant, while opening
a link in another tab leaves the current selection unchanged.
  * Edit links and navigation now use consistent tenant routes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-02 16:33:51 +03:00
Myasnikov Daniil b5e3b37a9a ci(api-review-gate): build the fork detector from the default branch
The merge base is the commit the fork's author branched from, so a
branch cut from an old commit selected an old detector, and a fix to
the detector never reached the PRs an attacker controls. The workflow
itself comes from the default branch, so the detector now does too.

The head is also checked out with its links intact. Flattening them
hid a CRD behind a file link from the detector while Helm still
shipped it, and made the verdict differ from the one the same-repo
gate reaches.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-02 14:47:51 +05:00