Skip to content

VOK-160 Linear desktop pages fail when no Foreman node is selected#158

Merged
rhymiz merged 1 commit into
mainfrom
foreman/019de3c4-d38d-74a3-bda1-e51dd7c94eb9
May 1, 2026
Merged

VOK-160 Linear desktop pages fail when no Foreman node is selected#158
rhymiz merged 1 commit into
mainfrom
foreman/019de3c4-d38d-74a3-bda1-e51dd7c94eb9

Conversation

@vkforeman
Copy link
Copy Markdown

@vkforeman vkforeman Bot commented May 1, 2026

Request

Prompt context:

<title>Linear desktop pages fail when no Foreman node is selected</title> ## Summary

The node-scoped hosted Linear change now makes the proxy Linear routes reject requests unless X-Foreman-Node-Id is set to a real owned node. The desktop Linear surfaces still load those routes immediately on mount without checking auth state first, so an unpaired desktop or a proxy session with no selected node now lands in a raw hosted-Linear error path instead of a guided "pair/select a node first" state.

Concrete repo evidence

Recent commits in scope:

  • 34dcaf87dd23ad0eaf56fb03065ecc67cd6378c8 Fix node-scoped Linear disconnect
  • de8aa8020c78ca43617ea29b60775187604f867c Validate Linear node scope

Proxy now hard-requires a selected node before any hosted Linear management call:

  • foreman-proxy/src/api/linear.rs:46-66
    • require_selected_node_scope(...) returns 400 bad_request with Select a Foreman node before managing Linear connections. when the node header is missing.
  • foreman-proxy/src/api/linear.rs:155-209
    • GET /integrations/linear/connections, GET /integrations/linear/connections/{id}/catalog, and DELETE /integrations/linear/connections/{id} all call that guard.

Desktop Linear pages still call those routes immediately without checking whether the desktop actually has a selected node:

  • foreman-desktop/src/features/projects/components/LinearPageView.tsx:67-96
    • loadData() immediately calls getLinearConnectionsStatus() on mount.
  • foreman-desktop/src/features/projects/components/ProjectLinearBindingSection.tsx:80-129
    • the binding panel immediately calls getLinearConnectionsStatus() on mount as well.

The desktop already has auth-state plumbing that exposes selectedNodeId, but these Linear surfaces do not use it:

  • foreman-desktop/src/lib/api.ts:744-760
    • ForemanAuthStateSchema includes hasNodeSession and selectedNodeId.
  • foreman-desktop/src/features/projects/components/GithubRepositoriesPageView.tsx:29-41
    • the GitHub import page fetches getForemanAuthState() first and uses it to gate node-dependent actions.

User-visible failure

Any desktop session that has a proxy session but no selected Foreman node can now open the hosted Linear page or a project settings page and hit the proxy bad_request path immediately, instead of seeing the same kind of explicit "pair/select a node" guidance already used on the GitHub import surface.

Minimal safe fix

  • Load getForemanAuthState() before the initial hosted Linear fetches in LinearPageView and ProjectLinearBindingSection.
  • If selectedNodeId is missing, skip getLinearConnectionsStatus() / catalog requests and render an instructional empty or warning state.
  • Only enable connect/disconnect/catalog actions once a node is selected.

This keeps the new proxy node-scope contract intact and fixes the desktop regression at the actual caller boundary instead of weakening the proxy validation.


Bug

Linear issue VOK-160: Linear desktop pages fail when no Foreman node is selected
Issue URL: https://linear.app/vokality/issue/VOK-160/linear-desktop-pages-fail-when-no-foreman-node-is-selected
Team: Vokality
State: Todo
Labels: Bug

Summary

The node-scoped hosted Linear change now makes the proxy Linear routes reject requests unless X-Foreman-Node-Id is set to a real owned node. The desktop Linear surfaces still load those routes immediately on mount without checking auth state first, so an unpaired desktop or a proxy session with no selected node now lands in a raw hosted-Linear error path instead of a guided "pair/select a node first" state.

Concrete repo evidence

Recent commits in scope:

  • 34dcaf87dd23ad0eaf56fb03065ecc67cd6378c8 Fix node-scoped Linear disconnect
  • de8aa8020c78ca43617ea29b60775187604f867c Validate Linear node scope

Proxy now hard-requires a selected node before any hosted Linear management call:

  • foreman-proxy/src/api/linear.rs:46-66
    • require_selected_node_scope(...) returns 400 bad_request with Select a Foreman node before managing Linear connections. when the node header is missing.
  • foreman-proxy/src/api/linear.rs:155-209
    • GET /integrations/linear/connections, GET /integrations/linear/connections/{id}/catalog, and DELETE /integrations/linear/connections/{id} all call that guard.

Desktop Linear pages still call those routes immediately without checking whether the desktop actually has a selected node:

  • foreman-desktop/src/features/projects/components/LinearPageView.tsx:67-96
    • loadData() immediately calls getLinearConnectionsStatus() on mount.
  • foreman-desktop/src/features/projects/components/ProjectLinearBindingSection.tsx:80-129
    • the binding panel immediately calls getLinearConnectionsStatus() on mount as well.

The desktop already has auth-state plumbing that exposes selectedNodeId, but these Linear surfaces do not use it:

  • foreman-desktop/src/lib/api.ts:744-760
    • ForemanAuthStateSchema includes hasNodeSession and selectedNodeId.
  • foreman-desktop/src/features/projects/components/GithubRepositoriesPageView.tsx:29-41
    • the GitHub import page fetches getForemanAuthState() first and uses it to gate node-dependent actions.

User-visible failure

Any desktop session that has a proxy session but no selected Foreman node can now open the hosted Linear page or a project settings page and hit the proxy bad_request path immediately, instead of seeing the same kind of explicit "pair/select a node" guidance already used on the GitHub import surface.

Minimal safe fix

  • Load getForemanAuthState() before the initial hosted Linear fetches in LinearPageView and ProjectLinearBindingSection.
  • If selectedNodeId is missing, skip getLinearConnectionsStatus() / catalog requests and render an instructional empty or warning state.
  • Only enable connect/disconnect/catalog actions once a node is selected.

This keeps the new proxy node-scope contract intact and fixes the desktop regression at the actual caller boundary instead of weakening the proxy validation.

Session comment:
This thread is for an agent session with foreman.

Summary

Gated desktop Linear surfaces on selected-node auth and added regression coverage

Checks

  • foreman-server-format: passed (exit status 0)
  • foreman-server-checks: passed (exit status 0)
  • foreman-server-tests: passed (exit status 0)

Foreman Metadata

  • Task ID: 019de3c4-d38d-74a3-bda1-e51dd7c94eb9
  • Delivery ID: 019de3c7-5cf4-7741-9dcc-13639e948bfa
  • Run ID: 019de3c7-5b99-72f1-a59b-0ccf860d1938
  • Attempt: 1
  • Branch: foreman/019de3c4-d38d-74a3-bda1-e51dd7c94eb9

@vkforeman vkforeman Bot requested review from foreman-vk and rhymiz as code owners May 1, 2026 14:00
@rhymiz rhymiz merged commit e3bfc33 into main May 1, 2026
2 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