Skip to content

Improve UX: Forbidden requests should not redirect to login page (#2270) - #2271

Open
semekh wants to merge 1 commit into
temporalio:mainfrom
semekh:bug/ux-forbidden-page
Open

semekh wants to merge 1 commit into
temporalio:mainfrom
semekh:bug/ux-forbidden-page

Conversation

@semekh

@semekh semekh commented Aug 15, 2024

Copy link
Copy Markdown

This is a draft PR, trying to address #2270.
I'd like to know if the general idea is ok so that I can fix the tests, etc.

@vercel

vercel Bot commented Aug 15, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
holocene ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 15, 2024 9:15am

@CLAassistant

CLAassistant commented Aug 15, 2024 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@jcrsilva

Copy link
Copy Markdown

@semekh for what it's worth this approach won't work:

Svelte seems to handle the error after navigation. So just pushing a toast will leave the UI in an error state, you have to navigate somewhere else.
Also, it seems that it's not just the UI that's bugged, it's also the temporal server. It handles authentication errors with a 403, never a 401; which means that if you add this patch in and the server isn't fixed, if you're logged in with an auth token that expires the UI gets borked again.

As a workaround you'd need to implement expiry checking for the JWT and clearing it automatically to force the UI to present the login page. The actual fix is to fix the server so it returns a 401 error.

rossnelson added a commit that referenced this pull request Aug 20, 2026
The emoji circles rendered large and dominated every line. Slack holds no badge
primitive, but a code span is close: the client draws it as a small bordered
chip, the same shape it already gives a version, a package name, and the mode in
the root message. A badge is now a code span.

The Show more control also had a different cause than the earlier commit
assumed. Slack collapses a whole message, not one block, so a per-block budget
measured the wrong thing. The external reply held about 814 visible characters
and collapsed.

A list item no longer repeats its status. The group badge already names the
state of every item it holds, so a line that read

  #2271: Improve UX ... — review requested, conflicting, checks none

now reads

  #2271: Improve UX ...

That takes the external reply from 814 visible characters to 489, and the
dependency reply to 360. The test now measures the whole message and holds it
under 600.

The statusText helper is gone with its last caller.

98 tests pass.
rossnelson added a commit that referenced this pull request Aug 20, 2026
* feat(ci): post the weekly review only when it needs a person

The thread carried four replies. Two of them said nothing: one reported that no
VLN pull request was pending, and one reported that all three modules
succeeded. It also linked the same workflow run four times, and it cut a pull
request title in the middle of a word behind a Show more control.

A message that usually says nothing teaches a reader to skip the message that
matters.

Each module now decides whether a person must act, and the workflow posts only
when the answer is yes:

- The dependency module acts on an authorized change, a classification that
  waits on a person, an alert that covers an already patched tree, or a failed
  publication.
- The VLN module acts on a pending or untriaged pull request.
- The external module acts on a pull request in any of its three groups. A
  stale count alone is context, not work.

The closing job now reports only a module that did not succeed. A reply already
carries its own outcome, so three restatements of success add nothing.

The replies also use Block Kit rather than one markdown string:

- A header block names the module, so bold text no longer stands in for three
  levels of heading.
- A divider separates each group.
- One context block at the end holds the run link. It appeared four times
  before, once per builder and once in the root message.
- The dependency reply names the package, the range, and the version the
  lockfile resolves, so a reader learns what changed without opening the pull
  request. It also names the published pull request by number.
- A group holds its own section, so a long title no longer lands in a 3000
  character block that the splitter cuts.

An unset actionable value still posts. A digest that did not run is worth
reporting.

91 tests pass.

Refs UI-142, UI-138

* ci: run the weekly review from the revision it was dispatched from

The coordinator never passed source_ref, so every module used its default of
main. A run dispatched from a branch therefore used the branch workflow files
with the scripts from main. A person testing a script change on a branch saw the
behavior of main and had no signal that the test proved nothing.

The coordinator now resolves source_ref to the revision the run was dispatched
from, and passes it to all three modules. A dispatch from main behaves as it did
before, because the resolved value is main. A scheduled run pins main.

A new optional source_ref input overrides the resolved value.

This makes a Slack thread testable before merge: dispatch the coordinator from a
branch with the mode dry-run.

* fix(ci): keep a Slack list short enough to read, and fix the reply order

Run 32380193609 showed three faults that the first redesign did not fix.

A list still ended in a Show more control, and a title was still cut in the
middle of a word. The reason was the wrong limit. A section holds 3000
characters, and no section came near that, but the Slack client collapses a
section long before then. The two lists measured 614 and 799 characters.

- A list item title now holds 72 characters, where it held 800.
- A group now shows 3 items, and the omitted count is the last line of the same
  group.
- The two lists now measure 340 characters at most, and no visible line passes
  120 characters.

The omitted count also sat in its own section, so a reader could not tell which
group it counted. It now belongs to its group.

The replies arrived in the order the jobs happened to finish, so the external
reply landed before the dependency reply. The VLN and external modules now wait
for the dependency module. The dependency module is already the critical path,
so the wait costs seconds. Both still run when it fails, because each carries
`always()`.

The new test measures the text a reader sees, not the raw markup. A link hides
its URL, so the raw length says little. The earlier assertion would have passed
on its fixture and failed on the live data.

93 tests pass.

Refs UI-142, UI-138

* feat(ci): add severity badges, advisory links, and a field grid

Three changes bring the thread closer to the design.

Slack holds no badge primitive, so a badge is an emoji plus bold text. The
colour carries the severity, and the count leads the label:

- A published change leads with READY and the number of alerts it closes.
- A decision group leads with the worst severity across its alerts and how many
  carry it, such as 2 HIGH.
- Each external group leads with its own count.

Every alert number now links to its advisory page. The audit already held both
the URL and the severity of each alert, so the digest reads them from there and
falls back to building the URL from the repository name.

The change itself now uses the fields of a section, which Slack lays out as a
two column grid. A reader sees the package and the range, the version the
lockfile resolves, and every alert the change closes, each one a link.

A package name is also wrapped in backticks, because Slack rendered
`@grpc/grpc-js` as a mention. The name is escaped before it is wrapped, so the
escape still stops a name from carrying formatting of its own. A test covers
both: the scoped name renders as code, and a name holding an asterisk is still
escaped.

98 tests pass.

Refs UI-138, UI-142

* Revert "pin the reply order by serializing the modules"

The fan-out is deliberate. Each module is an independently callable workflow,
and the coordinator runs all three at once on purpose. Making two of them wait
for the dependency module coupled three independent jobs to gain a fixed reply
order, and the order does not matter.

The modules fan out from the root message again.

The rest of the earlier commit stays: a list item title holds 72 characters, a
group shows 3 items, and the omitted count belongs to its group.

* fix(ci): use code chips for a badge, and stop Slack collapsing a reply

The emoji circles rendered large and dominated every line. Slack holds no badge
primitive, but a code span is close: the client draws it as a small bordered
chip, the same shape it already gives a version, a package name, and the mode in
the root message. A badge is now a code span.

The Show more control also had a different cause than the earlier commit
assumed. Slack collapses a whole message, not one block, so a per-block budget
measured the wrong thing. The external reply held about 814 visible characters
and collapsed.

A list item no longer repeats its status. The group badge already names the
state of every item it holds, so a line that read

  #2271: Improve UX ... — review requested, conflicting, checks none

now reads

  #2271: Improve UX ...

That takes the external reply from 814 visible characters to 489, and the
dependency reply to 360. The test now measures the whole message and holds it
under 600.

The statusText helper is gone with its last caller.

98 tests pass.

* feat(ci): link the omitted items to where a reader can see them

"…and 2 more" was plain text, so a reader who wanted the rest had nowhere to
go. Each overflow line is now a link, and each module points at the page that
holds its own list:

- The dependency module links the open Dependabot alerts.
- The VLN module links the open pull requests that name VLN.
- The external module links the open pull requests.

The link for the external module is the honest one available. GitHub search
cannot express "a pull request from a fork by a non-member", which is what that
module selects, so the link lands on the open pull requests instead of the exact
group. It reaches the page where the work happens.

The audit already carries the repository name, so the digest builds each URL
from it and omits the link when the name is absent.

99 tests pass.

Refs UI-138

* fix: refuse a manifest floor that the lockfile does not honor

The planner read the manifest floor, saw that it met the patched version, and
reported `safe` with no action. It had already read the lockfile and knew the
resolved version was still vulnerable, and it ignored that.

```
override:  cookie >=0.7.0     the floor is correct
lockfile:  cookie 0.6.0       the tree is vulnerable
advisory:  < 0.7.0

status: safe   actions: 0   resolvedVersions: ["0.6.0"]
reason: Existing override lower bound 0.7.0 already meets 0.7.0.
```

Nothing downstream caught it. The verification step reads only an alert that an
action names, and there was no action. So a run reported success, created no
pull request, and left the alert open for as long as the condition held.

This is reachable when a peer constraint pins the package below the floor, and
when the lockfile is stale with respect to package.json.

Such a package now classifies as manual and the reason names both facts:

```
Existing override lower bound 0.7.0 already meets 0.7.0. The lockfile still
resolves 0.6.0, so that floor does not take effect.
```

The check sits in `classifyPackage`, so it covers the override path and the
direct dependency path with one rule: the planner found no work, and the
lockfile disagrees. A package with no lockfile evidence is unaffected, and an
alert over a tree that is already patched still reports `alreadySafe`.

The Go path does not need this. `go.mod` is both the manifest and the
resolution source, and a module resolves to one version.

The live alert set produces the same plan as before this change, so the rule is
inert until the condition occurs.

102 tests pass.

Refs UI-135

This branch was successfully deployed

1 active deployment
Preview — b35044f4 Deployed Aug 15, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants