Skip to content

fix(devices): address cubic review on device-import display (#3308)#3311

Merged
tofikwest merged 1 commit into
mainfrom
tofik/device-display-cubic-3308
Jun 30, 2026
Merged

fix(devices): address cubic review on device-import display (#3308)#3311
tofikwest merged 1 commit into
mainfrom
tofik/device-display-cubic-3308

Conversation

@tofikwest

@tofikwest tofikwest commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Addresses the cubic findings on the Production Deploy PR #3308 (all on the device-import display work from #3305).

Fixes

  • P1 — API RBAC. api/people/agent-devices (and its twin api/people/fleet-hosts) only checked for an active session, so any authenticated member of an org could fetch all org device + integration data regardless of role. Both now use requireApiPermission(req, 'member', 'read') — the same contract as the People area (requireRoutePermission('people')).
  • P2 — CSV consistency. The export marked Fleet devices as not_tracked/n/a because it used source === 'device_agent' directly. Switched to the shared isComplianceTracked() so the CSV matches the rest of the UI (only integration imports are untracked).
  • P3 — DRY. Moved the duplicated device presentation helpers (PLATFORM_LABELS, CHECK_FIELDS, formatTimeAgo, isDeviceOnline, stale + not-tracked copy) into lib/device-source, and extracted a shared NotTrackedBadge — used by both the list (DeviceListCells) and details (DeviceDetails) views so copy/labels/thresholds can't drift.
  • P3 — Source filter. The filter keyed options off the display label, so two providers sharing a name would merge. Now keyed by a stable sourceKey (device_agent / fleet / integration:<slug>), label shown separately.

Notes

🤖 Generated with Claude Code


Summary by cubic

Tightened API access and fixed device-import display issues. RBAC now matches People permissions, CSV tracking is consistent with the UI, and the source filter no longer merges providers.

  • Bug Fixes

    • Enforce RBAC on agent-devices and fleet-hosts (member:read) instead of session-only access.
    • Use shared isComplianceTracked in CSV so only integration imports are "not_tracked"/"n/a"; Fleet now exports real checks.
    • Key the source filter by a stable source id (e.g., integration:kandji) to prevent merging providers with the same display name.
  • Refactors

    • Centralized device presentation helpers and copy in lib/device-source and added a shared NotTrackedBadge used by list and details.

Written for commit 9056d1b. Summary will update on new commits.

Review in cubic

…3308)

- agent-devices + fleet-hosts routes: enforce RBAC with requireApiPermission
  (member:read, matching the People page) instead of a session-only check, so
  the device/integration data can't be read by an active-org session that lacks
  people access (P1)
- CSV export: use the shared isComplianceTracked() so Fleet devices aren't
  wrongly marked "not_tracked"/"n/a" — keeps CSV consistent with the UI (P2)
- DRY: move shared device presentation helpers (PLATFORM_LABELS, CHECK_FIELDS,
  formatTimeAgo, isDeviceOnline, stale + not-tracked copy) into device-source,
  and a shared NotTrackedBadge — used by both the list and details views (P3)
- Source filter: key options by a stable source id (sourceKey) instead of the
  display label, so two providers sharing a name don't collapse into one (P3)

Tests: devices suite + agent-devices route (81) green; typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015iDU78gxNH9Wp9sex1BDLS
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jun 30, 2026 8:38pm
comp-framework-editor Ready Ready Preview, Comment Jun 30, 2026 8:38pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Jun 30, 2026 8:38pm

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@tofikwest tofikwest merged commit 96bc715 into main Jun 30, 2026
11 checks passed
@tofikwest tofikwest deleted the tofik/device-display-cubic-3308 branch June 30, 2026 20:38
@claudfuen

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.94.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants