Skip to content

fix(access-policy): show eval-result explicitly and auto-refresh expired debug token - #121

Merged
aleksandrkislitsyn merged 1 commit into
masterfrom
fix/policy-devtool-eval-result-and-token-refresh
Jul 24, 2026
Merged

fix(access-policy): show eval-result explicitly and auto-refresh expired debug token#121
aleksandrkislitsyn merged 1 commit into
masterfrom
fix/policy-devtool-eval-result-and-token-refresh

Conversation

@aleksandrkislitsyn

Copy link
Copy Markdown
Contributor

Summary

Three fixes to the AccessPolicy Policy Dev Tool:

  1. Show eval-result explicitly. Previously each policy's pass/fail was communicated only through the red/green color of its name — the boolean itself was filtered out of the displayed YAML. Now eval-result is shown as the first field of each policy block, so you can read the result directly alongside role, errors, etc.

  2. Auto-refresh the expired debug token. The tool signs each Debug request with a short-lived eval-policy-debug-token. executeDebugRequest catches transport errors internally and returns the 403 as a normal ResponseData (it does not throw), so the existing catch-based "retry once" never fired for the expired-token case. The tool got stuck showing 403 {"message":"eval-policy-debug-token is expired"} until a full page reload. Now we detect that specific 403, refresh the token, and retry once.

  3. Open-in-editor affordance. Added an external-link icon on each non-current policy row in the eval list that deep-links to the AccessPolicy editor.

Testing

  • pnpm biome check — passes for the changed file.
  • pnpm typecheck — no new errors introduced by this change. (Two pre-existing errors on master remain: notebook-chart/fold-data.ts codemirror duplicate-types — unrelated to this PR.)
  • Manually verified in the Policy Dev Tool: eval-result now renders per policy, and an expired token silently refreshes on the next Debug instead of showing the stuck 403.

🤖 Generated with Claude Code

…red debug token

Policy Dev Tool improvements:

- Show `eval-result` explicitly as the first field of each policy's YAML in
  the Policy eval panel, instead of encoding pass/fail only via the red/green
  policy-name color. Makes the debug output readable at a glance.
- Auto-refresh the eval-policy debug token on expiry. executeDebugRequest
  returns the 403 as a normal response (it does not throw), so the previous
  catch-based retry never fired and the tool got stuck showing
  "eval-policy-debug-token is expired". Detect that response, refresh the
  token, and retry once.
- Add an "external link" affordance to open a policy in the AccessPolicy
  editor from the eval list.
@aleksandrkislitsyn
aleksandrkislitsyn requested a review from Aitem July 24, 2026 14:21

@Aitem Aitem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@aleksandrkislitsyn
aleksandrkislitsyn merged commit 12f851c into master Jul 24, 2026
4 checks passed
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.

2 participants