@skyhook-io/radar-app 1.18.1 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/package.json +4 -4
  2. package/src/App.tsx +23 -9
  3. package/src/api/client.deleteResource.test.tsx +111 -0
  4. package/src/api/client.resourceAudit.test.tsx +57 -0
  5. package/src/api/client.resourcePath.test.ts +107 -0
  6. package/src/api/client.ts +136 -37
  7. package/src/api/diagnose.test.ts +33 -2
  8. package/src/api/diagnose.ts +93 -3
  9. package/src/api/radarFeatures.ts +1 -0
  10. package/src/components/capacity/CapacityDemand.tsx +6 -3
  11. package/src/components/capacity/CapacityOverview.tsx +14 -7
  12. package/src/components/capacity/CapacityPoolDetail.tsx +7 -5
  13. package/src/components/capacity/ClusterSchedulingCard.tsx +3 -3
  14. package/src/components/capacity/shared.tsx +9 -5
  15. package/src/components/cnpg/CNPGOverview.tsx +4 -1
  16. package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +1 -0
  17. package/src/components/diagnose/AIMarkdown.tsx +1 -1
  18. package/src/components/diagnose/ActivityTurn.tsx +34 -14
  19. package/src/components/diagnose/AgentControls.tsx +53 -6
  20. package/src/components/diagnose/AgentSetupNotice.tsx +1 -1
  21. package/src/components/diagnose/AgentSigninNotice.test.tsx +98 -0
  22. package/src/components/diagnose/AgentSigninNotice.tsx +61 -0
  23. package/src/components/diagnose/AnalysisStory.test.tsx +22 -0
  24. package/src/components/diagnose/AnalysisStory.tsx +17 -4
  25. package/src/components/diagnose/ApplyDialog.test.tsx +10 -0
  26. package/src/components/diagnose/ApplyDialog.tsx +8 -1
  27. package/src/components/diagnose/AssessmentCard.tsx +99 -8
  28. package/src/components/diagnose/DiagnoseContext.capacity.test.tsx +113 -0
  29. package/src/components/diagnose/DiagnoseContext.question.test.tsx +245 -0
  30. package/src/components/diagnose/DiagnoseContext.tsx +205 -9
  31. package/src/components/diagnose/DiagnoseSurface.test.tsx +54 -0
  32. package/src/components/diagnose/DiagnoseSurface.tsx +98 -21
  33. package/src/components/diagnose/EvidenceCard.tsx +67 -14
  34. package/src/components/diagnose/Home.test.tsx +182 -5
  35. package/src/components/diagnose/Home.tsx +168 -36
  36. package/src/components/diagnose/InvestigationCapacityNotice.test.tsx +246 -0
  37. package/src/components/diagnose/InvestigationCapacityNotice.tsx +241 -0
  38. package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +97 -6
  39. package/src/components/diagnose/InvestigationEvidencePane.test.tsx +119 -2
  40. package/src/components/diagnose/InvestigationEvidencePane.tsx +59 -11
  41. package/src/components/diagnose/InvestigationEvidenceSections.tsx +11 -6
  42. package/src/components/diagnose/InvestigationView.tsx +203 -42
  43. package/src/components/diagnose/LocalDiagnoseAction.tsx +23 -16
  44. package/src/components/diagnose/QuestionComposer.test.tsx +553 -0
  45. package/src/components/diagnose/QuestionComposer.tsx +487 -0
  46. package/src/components/diagnose/QuestionFocus.test.tsx +38 -0
  47. package/src/components/diagnose/QuestionFocus.tsx +123 -0
  48. package/src/components/diagnose/ResourcePicker.tsx +206 -0
  49. package/src/components/diagnose/StoryExcerpt.tsx +12 -3
  50. package/src/components/diagnose/assessmentCopy.ts +16 -0
  51. package/src/components/diagnose/investigationCase.runs.test.tsx +328 -0
  52. package/src/components/diagnose/investigationCase.ts +33 -1
  53. package/src/components/diagnose/investigationEvidence/adapters/changes.ts +36 -1
  54. package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +46 -0
  55. package/src/components/diagnose/investigationEvidence/adapters/crossplane.test.tsx +85 -0
  56. package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +8 -0
  57. package/src/components/diagnose/investigationEvidence/adapters/issues.ts +1 -0
  58. package/src/components/diagnose/investigationEvidence/adapters/posture.ts +29 -1
  59. package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +42 -1
  60. package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +29 -2
  61. package/src/components/diagnose/investigationEvidence/adapters/testdata/crossplane-paused-get-resource.json +28 -0
  62. package/src/components/diagnose/investigationEvidence/bodies/index.tsx +2 -0
  63. package/src/components/diagnose/investigationEvidence/bodies/metrics.test.tsx +111 -0
  64. package/src/components/diagnose/investigationEvidence/bodies/metrics.tsx +67 -16
  65. package/src/components/diagnose/investigationEvidence/bodies/workload.tsx +5 -1
  66. package/src/components/diagnose/investigationEvidence/builder.ts +3 -1
  67. package/src/components/diagnose/investigationEvidence/cardParts.tsx +7 -2
  68. package/src/components/diagnose/investigationEvidence/excerpt.test.ts +18 -5
  69. package/src/components/diagnose/investigationEvidence/excerpt.ts +22 -11
  70. package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
  71. package/src/components/diagnose/investigationEvidence/index.ts +1 -1
  72. package/src/components/diagnose/investigationEvidence/navigation.tsx +2 -0
  73. package/src/components/diagnose/investigationEvidence/observations.ts +7 -3
  74. package/src/components/diagnose/investigationEvidence/projection.test.ts +57 -3
  75. package/src/components/diagnose/investigationEvidence/types.ts +2 -0
  76. package/src/components/diagnose/investigationEvidencePartition.ts +6 -1
  77. package/src/components/diagnose/investigationEvidencePresentation.test.ts +36 -2
  78. package/src/components/diagnose/investigationEvidencePresentation.ts +33 -8
  79. package/src/components/diagnose/investigationFocus.test.ts +271 -0
  80. package/src/components/diagnose/investigationFocus.ts +132 -0
  81. package/src/components/diagnose/parts.test.tsx +20 -0
  82. package/src/components/diagnose/questionSuggestions.test.ts +111 -0
  83. package/src/components/diagnose/questionSuggestions.ts +150 -0
  84. package/src/components/diagnose/storyParts.test.tsx +66 -0
  85. package/src/components/diagnose/target.test.ts +143 -2
  86. package/src/components/diagnose/target.ts +109 -7
  87. package/src/components/diagnose/testdata/story-runs.json +474 -0
  88. package/src/components/diagnose/verdictText.test.tsx +87 -0
  89. package/src/components/diagnose/verdictText.ts +68 -0
  90. package/src/components/helm/ChartBrowser.tsx +4 -4
  91. package/src/components/helm/HelmReleaseDrawer.tsx +6 -2
  92. package/src/components/helm/HelmView.tsx +34 -23
  93. package/src/components/helm/InstallWizard.tsx +6 -2
  94. package/src/components/helm/ValuesViewer.test.tsx +1 -0
  95. package/src/components/helm/ValuesViewer.tsx +4 -2
  96. package/src/components/home/ClusterHealthCard.tsx +40 -59
  97. package/src/components/home/HomeAgentBlock.test.tsx +113 -0
  98. package/src/components/home/HomeAgentBlock.tsx +94 -0
  99. package/src/components/home/HomeView.tsx +5 -6
  100. package/src/components/home/MCPSetupDialog.test.tsx +27 -2
  101. package/src/components/home/MCPSetupDialog.tsx +14 -2
  102. package/src/components/home/RadarVersionLine.test.tsx +0 -14
  103. package/src/components/home/RadarVersionLine.tsx +3 -28
  104. package/src/components/home/mcpToolCatalog.ts +29 -2
  105. package/src/components/issues/IssuesPane.render.test.tsx +5 -5
  106. package/src/components/nav/PrimaryNavRail.tsx +34 -2
  107. package/src/components/product-hunt/ProductHuntNotice.render.test.tsx +120 -0
  108. package/src/components/product-hunt/ProductHuntNotice.test.ts +121 -0
  109. package/src/components/product-hunt/ProductHuntNotice.tsx +202 -0
  110. package/src/components/product-hunt/launchWindow.ts +78 -0
  111. package/src/components/product-hunt/useProductHuntRailEntry.test.tsx +76 -0
  112. package/src/components/product-hunt/useProductHuntRailEntry.ts +27 -0
  113. package/src/components/resources/CompositeRenderer.tsx +4 -0
  114. package/src/components/resources/ResourcesView.tsx +1 -1
  115. package/src/components/settings/LocalConnectionSettings.tsx +1 -0
  116. package/src/components/ui/Omnibar.investigate.test.tsx +105 -0
  117. package/src/components/ui/Omnibar.tsx +47 -3
  118. package/src/components/ui/RadarOmnibar.test.tsx +19 -0
  119. package/src/components/ui/RadarOmnibar.tsx +12 -0
  120. package/src/components/ui/SearchSyntaxHelp.test.tsx +39 -0
  121. package/src/components/ui/SearchSyntaxHelp.tsx +23 -2
  122. package/src/components/ui/UpdateNotification.test.tsx +2 -0
  123. package/src/components/ui/UpdateNotification.tsx +32 -5
  124. package/src/components/usage-data/UsageDataPrompt.tsx +19 -1
  125. package/src/components/whats-new/WhatsNewDialog.test.tsx +3 -3
  126. package/src/components/whats-new/releaseNotes.ts +60 -1
  127. package/src/components/workload/WorkloadView.tsx +10 -4
  128. package/src/components/workspace/layout.tsx +2 -1
  129. package/src/contexts/CapabilitiesContext.tsx +1 -0
  130. package/src/hooks/useAgentSignin.test.tsx +190 -0
  131. package/src/hooks/useAgentSignin.ts +160 -0
  132. package/src/hooks/useApproveAfterSignin.test.tsx +108 -0
  133. package/src/hooks/useGitOpsWriteGuard.test.tsx +126 -2
  134. package/src/hooks/useGitOpsWriteGuard.ts +25 -3
  135. package/src/hooks/useResolvedGitOpsOwner.ts +14 -9
  136. package/src/index.css +85 -0
@@ -5,18 +5,25 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
5
5
  import { SetImageDialog, canConfirmGitOpsWrite, setImageSelectionKey, type WorkloadImageInventory } from '@skyhook-io/k8s-ui'
6
6
  import { afterEach, expect, it, vi } from 'vitest'
7
7
  import { useGitOpsWriteGuard, type GitOpsWriteGuardState } from './useGitOpsWriteGuard'
8
+ import { findInheritedGitOpsLookupRef } from './useResolvedGitOpsOwner'
8
9
 
9
10
  const mocks = vi.hoisted(() => ({
10
11
  applications: { data: undefined as unknown[] | undefined, isPending: true, isError: false },
11
12
  inherited: { data: undefined as unknown, isPending: false, isError: false },
12
13
  target: { data: undefined as unknown, relationships: undefined as unknown, isLoading: false, isError: false },
14
+ ownerObject: undefined as unknown,
15
+ resourceRead: vi.fn(),
16
+ resourceList: vi.fn(),
13
17
  evidence: vi.fn(),
14
18
  evidenceUnsupported: false,
15
19
  }))
16
20
  vi.mock('../api/client', () => ({
17
- useResource: (kind: string) => (kind === 'deployments' ? mocks.target : { data: undefined, isLoading: false, isError: false }),
21
+ useResource: (...args: unknown[]) => {
22
+ mocks.resourceRead(...args)
23
+ return args[0] === 'deployments' ? mocks.target : { data: args[0] ? mocks.ownerObject : undefined, isLoading: false, isError: false }
24
+ },
18
25
  useResourceWithRelationships: () => mocks.inherited,
19
- useResources: () => mocks.applications,
26
+ useResources: (...args: unknown[]) => { mocks.resourceList(...args); return mocks.applications },
20
27
  useRadarFeature: () => ({
21
28
  guard: async (fn: () => unknown) => {
22
29
  if (!mocks.evidenceUnsupported) return fn()
@@ -36,6 +43,9 @@ afterEach(() => {
36
43
  mocks.inherited = { data: undefined, isPending: false, isError: false }
37
44
  mocks.target = { data: undefined, relationships: undefined, isLoading: false, isError: false }
38
45
  mocks.evidence.mockReset()
46
+ mocks.ownerObject = undefined
47
+ mocks.resourceRead.mockReset()
48
+ mocks.resourceList.mockReset()
39
49
  })
40
50
 
41
51
  it.each(['resolved', 'failed', 'empty', 'ambiguous'])('waits for Argo Application namespace lookup before handling %s ownership', async (outcome) => {
@@ -455,3 +465,117 @@ it("doesn't hold Update for a host that reports the selection without judging it
455
465
  host.remove()
456
466
  }
457
467
  })
468
+
469
+ const managerApp = { kind: 'Application', group: 'argoproj.io', namespace: 'argocd', name: 'server-app' }
470
+ const managerAnswer: import('@skyhook-io/k8s-ui').ManagerAnswer = { state: 'listed', lead: managerApp, direct: { object: deployment, recorders: [managerApp] } }
471
+
472
+ it.each(['disagree', 'shared', 'claimed'] as const)('fetches evidence for %s without a lead', async state => {
473
+ const manager = { ...managerAnswer, state, lead: undefined, direct: { object: deployment, recorders: state === 'claimed' ? [] : state === 'shared' ? [managerApp, { ...managerApp, name: 'second-recorder' }] : [managerApp], claims: [{ manager: { ...managerApp, name: 'claim' }, source: 'argo-instance-label' as const, check: 'omitted' as const }, ...(state === 'claimed' ? [{ manager: managerApp, source: 'argo-instance-label' as const, check: 'omitted' as const }] : [])] } }
474
+ mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: null, manager, policy: null, paths: [] })
475
+ const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager } }, writes: replicas })
476
+ try {
477
+ await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
478
+ expect(mocks.evidence).toHaveBeenCalledTimes(1)
479
+ expect(mocks.evidence.mock.calls[0][0].owner).toBeUndefined()
480
+ expect(h.ref.state!.guard?.requiresAck).toBe(true)
481
+ } finally { await h.cleanup() }
482
+ })
483
+
484
+ it('fetches via evidence and names the parent without acknowledgment', async () => {
485
+ const manager = { ...managerAnswer, direct: { object: pod }, via: managerAnswer.direct }
486
+ mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: managerApp, manager, policy: null, paths: [] })
487
+ const h = await renderGuard({ target: pod, resource: {}, relationships: { ownership: { children: { complete: true }, manager } }, writes: replicas })
488
+ try {
489
+ await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
490
+ expect(mocks.evidence).toHaveBeenCalledTimes(1)
491
+ expect(h.ref.state!.ownership.inheritedLookupRef).toBeNull()
492
+ expect(h.ref.state!.guard?.level).toBe('info')
493
+ expect(h.ref.state!.guard?.requiresAck).toBe(false)
494
+ expect(h.ref.state!.guard?.summary).toContain('Deployment prod/web')
495
+ } finally { await h.cleanup() }
496
+ })
497
+
498
+ it.each(['none', 'unknown', 'disagree', 'shared', 'claimed', 'listed'] as const)('adopts the server %s answer over a conflicting client lead', async state => {
499
+ const serverManager = { ...managerAnswer, state, lead: state === 'listed' ? managerApp : undefined, direct: { object: deployment } }
500
+ mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: managerApp, manager: serverManager, policy: null, paths: [] })
501
+ const clientManager = { ...managerAnswer, lead: { ...managerApp, name: 'stale-client' } }
502
+ const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager: clientManager } }, writes: replicas })
503
+ try {
504
+ await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
505
+ expect(h.ref.state!.ownership.manager).toEqual(serverManager)
506
+ expect(h.ref.state!.guard?.owner?.name ?? null).toBe(state === 'listed' ? 'server-app' : null)
507
+ expect(h.ref.state!.guard?.summary).not.toContain('stale-client')
508
+ if (state === 'none' || state === 'unknown') expect(h.ref.state!.guard?.level).toBe('none')
509
+ } finally { await h.cleanup() }
510
+ })
511
+
512
+ // A live answer naming another manager doesn't inherit the cached one's
513
+ // verification or status: a link to it would rest on a check of the old one.
514
+ it("doesn't carry the cached manager's verification to a different live manager", async () => {
515
+ mocks.ownerObject = { status: { sync: { status: 'Synced' }, health: { status: 'Healthy' } } }
516
+ const other = { ...managerApp, name: 'live-app' }
517
+ const live = { state: 'claimed' as const, lead: other, direct: { object: deployment, claims: [{ manager: other, source: 'argo-tracking-id' as const, check: 'missing' as const }] } }
518
+ mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: other, manager: live, policy: null, paths: [] })
519
+ const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager: managerAnswer } }, writes: replicas })
520
+ try {
521
+ await act(async () => vi.waitFor(() => expect(h.ref.state!.ownership.owner?.name).toBe('live-app')))
522
+ expect(h.ref.state!.ownership.ownerVerified).toBe(false)
523
+ expect(h.ref.state!.ownership.ownerStatus).toBeNull()
524
+ } finally { await h.cleanup() }
525
+ })
526
+
527
+ // An object adopted since the cache saw it has a manager the cache doesn't.
528
+ it('checks a cached none against the live object', async () => {
529
+ const cachedNone = { state: 'none' as const, direct: { object: deployment } }
530
+ mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: managerApp, manager: managerAnswer, policy: null, paths: [] })
531
+ const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager: cachedNone } }, writes: replicas })
532
+ try {
533
+ await act(async () => vi.waitFor(() => expect(mocks.evidence).toHaveBeenCalled()))
534
+ await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.owner?.name).toBe('server-app')))
535
+ } finally { await h.cleanup() }
536
+ })
537
+
538
+ it('does not guess an Argo namespace or inherit through the browser with an answer', async () => {
539
+ const unresolved = { ...managerAnswer, state: 'claimed' as const, lead: { ...managerApp, namespace: '' } }
540
+ mocks.applications.data = [{ metadata: { name: managerApp.name, namespace: 'guessed' } }]
541
+ mocks.inherited = { data: { resource: {}, relationships: { managedBy: [managerApp] } }, isPending: false, isError: false }
542
+ mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: unresolved.lead, policy: null, paths: [] })
543
+ const h = await renderGuard({ target: pod, resource: {}, relationships: { ...podRelationships, ownership: { children: { complete: true }, manager: unresolved } }, writes: replicas })
544
+ try {
545
+ await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
546
+ expect(h.ref.state!.ownership.owner?.namespace).toBe('')
547
+ expect(h.ref.state!.ownership.ownerMatchedByName).toBe(false)
548
+ expect(h.ref.state!.ownership.inheritedLookupRef).toBeNull()
549
+ expect(mocks.evidence.mock.calls[0][0].owner.namespace).toBe('')
550
+ } finally { await h.cleanup() }
551
+ })
552
+
553
+
554
+ it('still fetches the lead for sync and health without listing namesakes', async () => {
555
+ mocks.ownerObject = { status: { sync: { status: 'Synced' }, health: { status: 'Healthy' } } }
556
+ mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: managerApp, manager: managerAnswer, policy: null, paths: [] })
557
+ const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager: managerAnswer } }, writes: replicas })
558
+ try {
559
+ await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
560
+ expect(mocks.resourceRead).toHaveBeenCalledWith('applications', 'argocd', 'server-app', 'argoproj.io', expect.objectContaining({ enabled: true }))
561
+ expect(mocks.resourceList).toHaveBeenCalledWith('applications', undefined, 'argoproj.io', expect.objectContaining({ enabled: false }))
562
+ expect(h.ref.state!.ownership.ownerStatus).toMatchObject({ sync: 'Synced', health: 'Healthy' })
563
+ } finally { await h.cleanup() }
564
+ })
565
+
566
+
567
+ it.each(['agree', 'listed', 'claimed', 'disagree', 'shared', 'unknown', 'none'] as const)('image prefetch skips browser inheritance for %s answers', state => {
568
+ expect(findInheritedGitOpsLookupRef({ ...podRelationships, ownership: { children: { complete: true }, manager: { state, direct: { object: pod } } } }, null, pod)).toBeNull()
569
+ })
570
+
571
+
572
+ it.each(['cycle', 'truncated'] as const)('fetches evidence for a %s chain without a stop object', async chainEnd => {
573
+ const manager = { state: 'unknown' as const, direct: { object: deployment }, chainEnd }
574
+ mocks.evidence.mockResolvedValue({ uid: 'u', resourceVersion: '1', owner: null, manager, policy: null, paths: [] })
575
+ const h = await renderGuard({ target: deployment, resource: {}, relationships: { ownership: { children: { complete: true }, manager } }, writes: replicas })
576
+ try {
577
+ await act(async () => vi.waitFor(() => expect(h.ref.state!.guard?.pending).toBe(false)))
578
+ expect(mocks.evidence).toHaveBeenCalledTimes(1)
579
+ expect(h.ref.state!.guard?.level).toBe('may-revert')
580
+ } finally { await h.cleanup() }
581
+ })
@@ -3,6 +3,8 @@ import { useQuery } from '@tanstack/react-query'
3
3
  import {
4
4
  evaluateGitOpsWriteGuard,
5
5
  gitOpsWriteEvidencePaths,
6
+ gitOpsOwnerFromRef,
7
+ managerChoices,
6
8
  type GitOpsWrite,
7
9
  type GitOpsWriteEvidence,
8
10
  type GitOpsWriteGuard,
@@ -81,6 +83,10 @@ export function useGitOpsWriteGuard({
81
83
  const targetLookupFailed = needsTarget && targetQuery.isError
82
84
  const lookupPending = targetLookupPending || ownership.lookupPending
83
85
  const managed = Boolean(ownership.owner || ownership.helmOwner)
86
+ const manager = ownership.manager
87
+ // The server answers from the live object, so any cached answer is checked:
88
+ // an object adopted since the cache last saw it has a manager it doesn't.
89
+ const needsManagerEvidence = Boolean(manager)
84
90
 
85
91
  const writesKey = JSON.stringify(writes)
86
92
  const requestedPathsKey = requestedPaths ? JSON.stringify(requestedPaths) : ''
@@ -99,12 +105,12 @@ export function useGitOpsWriteGuard({
99
105
  }, [ownership.owner, ownership.helmOwner])
100
106
  // An Argo owner without a namespace is still asked about: the server finds
101
107
  // the Application whose status lists the object.
102
- const canFetchEvidence = managed && !lookupPending && !targetLookupFailed && !ownership.lookupError
108
+ const canFetchEvidence = (managed || needsManagerEvidence) && !lookupPending && !targetLookupFailed && !ownership.lookupError
103
109
 
104
110
  const evidenceFeature = useRadarFeature('gitopsWriteEvidence')
105
111
  const evidenceQuery = useQuery({
106
112
  // The API base identifies the cluster when a host switches it (Radar Hub).
107
- queryKey: ['gitops-write-evidence', getApiBase(), target.kind, target.group, target.namespace, target.name, paths, ownerRef, ...evidenceFeature.gatedKey],
113
+ queryKey: ['gitops-write-evidence', getApiBase(), target.kind, target.group, target.namespace, target.name, paths, ownerRef, manager, ...evidenceFeature.gatedKey],
108
114
  queryFn: () =>
109
115
  evidenceFeature.guard(() =>
110
116
  fetchGitOpsWriteEvidence({
@@ -122,7 +128,7 @@ export function useGitOpsWriteGuard({
122
128
  })
123
129
 
124
130
  const targetRelationshipsMissing = needsTarget && targetQuery.data != null && targetQuery.relationships == null
125
- const unresolvedDeclaredManager = Boolean(declaredManager) && !managed && !lookupPending
131
+ const unresolvedDeclaredManager = !manager && Boolean(declaredManager) && !managed && !lookupPending
126
132
  const unknownOwner = "so it can't tell whether a GitOps tool or Helm manages it."
127
133
  const ownershipError = targetLookupFailed
128
134
  ? `Radar couldn't read this resource, ${unknownOwner}`
@@ -143,6 +149,20 @@ export function useGitOpsWriteGuard({
143
149
  // namespace, and the browser's namespace view may hide them; take the
144
150
  // Application the server confirmed.
145
151
  const confirmedOwnership = useMemo<ResolvedGitOpsOwner>(() => {
152
+ if (evidence?.manager) {
153
+ const answer = evidence.manager
154
+ const owner = answer.lead ? gitOpsOwnerFromRef(answer.lead) : null
155
+ const helmOwner = answer.lead?.kind === 'HelmRelease' && !answer.lead.group ? { namespace: answer.lead.namespace, name: answer.lead.name } : null
156
+ const same = (a: typeof owner, b: typeof owner) => Boolean(a && b && a.kind === b.kind && a.namespace === b.namespace && a.name === b.name)
157
+ if (same(owner, ownership.owner)) {
158
+ return { ...ownership, manager: answer, owner, rawOwner: owner, helmOwner, ownerMatchedByName: false }
159
+ }
160
+ // The live answer names another manager: what was read and verified
161
+ // for the cached one doesn't carry over. The server found it when its
162
+ // list names the object or a claim read it.
163
+ const found = Boolean(answer.lead && owner?.namespace && managerChoices(answer).find(c => c.ref.kind === answer.lead!.kind && c.ref.group === answer.lead!.group && c.ref.namespace === answer.lead!.namespace && c.ref.name === answer.lead!.name)?.found)
164
+ return { ...ownership, manager: answer, owner, rawOwner: owner, helmOwner, ownerMatchedByName: false, ownerObject: undefined, ownerStatus: null, ownerVerified: found }
165
+ }
146
166
  const owner = ownership.owner
147
167
  const namespace = evidence?.ownerTracksTarget ? evidence.owner?.namespace : undefined
148
168
  if (!owner || owner.namespace || !namespace) return ownership
@@ -154,6 +174,7 @@ export function useGitOpsWriteGuard({
154
174
  enabled
155
175
  ? evaluateGitOpsWriteGuard({
156
176
  target,
177
+ manager,
157
178
  owner: confirmedOwnership.owner,
158
179
  helmRelease: ownership.helmOwner,
159
180
  // A refetch counts as pending: an earlier verdict may no longer hold.
@@ -177,6 +198,7 @@ export function useGitOpsWriteGuard({
177
198
  target.name,
178
199
  confirmedOwnership.owner,
179
200
  ownership.helmOwner,
201
+ manager,
180
202
  lookupPending,
181
203
  canFetchEvidence,
182
204
  evidenceQuery.isPending,
@@ -2,6 +2,7 @@ import { useMemo } from 'react'
2
2
  import {
3
3
  getGitOpsResourceStatus,
4
4
  gitOpsOwnerFromRelationships,
5
+ type ManagerAnswer,
5
6
  type GitOpsOwnerRef,
6
7
  type GitOpsStatus,
7
8
  type HelmOwnerRef,
@@ -11,6 +12,7 @@ import { kindToPluralWithGroup } from '../utils/navigation'
11
12
  import { useResource, useResourceWithRelationships, useResources } from '../api/client'
12
13
 
13
14
  export interface ResolvedGitOpsOwner {
15
+ manager?: ManagerAnswer
14
16
  /** GitOps owner, with an Argo Application's namespace filled in when the
15
17
  * tracking label omitted it and exactly one Application matches. */
16
18
  owner: GitOpsOwnerRef | null
@@ -60,6 +62,7 @@ export function useResolvedGitOpsOwner({
60
62
  /** Keeps these reads apart from the shared resource cache (see useResource). */
61
63
  cacheScope?: string
62
64
  }): ResolvedGitOpsOwner {
65
+ const manager = enabled ? relationships?.ownership?.manager : undefined
63
66
  const active = enabled && Boolean(relationships)
64
67
  const relationshipGitopsOwner = useMemo(
65
68
  () => (active ? gitOpsOwnerFromRelationships(relationships) : null),
@@ -67,10 +70,10 @@ export function useResolvedGitOpsOwner({
67
70
  )
68
71
  const inheritedLookupRef = useMemo(
69
72
  () =>
70
- active
73
+ active && !manager
71
74
  ? findInheritedGitOpsLookupRef(relationships, relationshipGitopsOwner, { kind, namespace, name, group })
72
75
  : null,
73
- [active, relationships, relationshipGitopsOwner, kind, namespace, name, group],
76
+ [active, manager, relationships, relationshipGitopsOwner, kind, namespace, name, group],
74
77
  )
75
78
  const inherited = useResourceWithRelationships<any>(
76
79
  inheritedLookupRef ? kindToPluralWithGroup(inheritedLookupRef.kind, inheritedLookupRef.group ?? '') : '',
@@ -103,13 +106,13 @@ export function useResolvedGitOpsOwner({
103
106
  const helmOwner = relationshipHelmOwner ?? inheritedHelmOwner
104
107
  const helmSourceResource = relationshipHelmOwner ? resource : inherited.data?.resource
105
108
 
106
- const shouldResolveArgoNamespace = rawOwner?.tool === 'argocd' && !rawOwner.namespace
109
+ const shouldResolveArgoNamespace = !manager && rawOwner?.tool === 'argocd' && !rawOwner.namespace
107
110
  const argoQuery = useResources<any>('applications', undefined, 'argoproj.io', {
108
111
  enabled: shouldResolveArgoNamespace,
109
112
  cacheScope,
110
113
  })
111
114
  const argoApplications = argoQuery.data
112
- const owner = useMemo(() => resolveGitOpsOwner(rawOwner, argoApplications), [rawOwner, argoApplications])
115
+ const owner = useMemo(() => manager ? rawOwner : resolveGitOpsOwner(rawOwner, argoApplications), [manager, rawOwner, argoApplications])
113
116
 
114
117
  const ownerGroup = owner ? gitOpsOwnerGroup(owner) : ''
115
118
  const shouldFetchOwner = Boolean(owner?.namespace)
@@ -124,12 +127,13 @@ export function useResolvedGitOpsOwner({
124
127
 
125
128
  const ownerStatus = useMemo(() => deriveGitOpsOwnerStatus(owner, ownerObject), [owner, ownerObject])
126
129
  const ownerSource = useMemo(
127
- () => describeGitOpsOwnerSource(rawOwner, gitOpsSourceResource),
128
- [rawOwner, gitOpsSourceResource],
130
+ () => manager ? null : describeGitOpsOwnerSource(rawOwner, gitOpsSourceResource),
131
+ [manager, rawOwner, gitOpsSourceResource],
129
132
  )
130
- const helmSource = useMemo(() => describeHelmOwnerSource(helmOwner, helmSourceResource), [helmOwner, helmSourceResource])
133
+ const helmSource = useMemo(() => manager ? null : describeHelmOwnerSource(helmOwner, helmSourceResource), [manager, helmOwner, helmSourceResource])
131
134
 
132
135
  return {
136
+ manager,
133
137
  owner,
134
138
  rawOwner,
135
139
  ownerObject,
@@ -173,7 +177,7 @@ export function findInheritedGitOpsLookupRef(
173
177
  directOwner: GitOpsOwnerRef | null,
174
178
  current: ResourceRef,
175
179
  ): ResourceRef | null {
176
- if (directOwner) return null
180
+ if (relationships?.ownership?.manager || directOwner) return null
177
181
  const inheritedManagerRefs = (relationships?.managedBy ?? []).filter(
178
182
  (ref) => !gitOpsOwnerFromRelationships({ managedBy: [ref] }) && !isNativeHelmManager(ref),
179
183
  )
@@ -188,7 +192,8 @@ export function nativeHelmOwnerFromRelationships(
188
192
  relationships: Relationships | undefined,
189
193
  fallbackNamespace: string,
190
194
  ): HelmOwnerRef | null {
191
- const ref = relationships?.managedBy?.[0]
195
+ const answer = relationships?.ownership?.manager
196
+ const ref = answer ? answer.lead : relationships?.managedBy?.[0]
192
197
  if (!ref || !isNativeHelmManager(ref)) return null
193
198
  return {
194
199
  namespace: ref.namespace || fallbackNamespace,
package/src/index.css CHANGED
@@ -419,6 +419,91 @@ body {
419
419
  }
420
420
  }
421
421
 
422
+ /* Product Hunt launch card: a green light travels around the border and spills
423
+ a soft glow outward, brightening and fading on a cycle longer than the lap so
424
+ the brightest point lands somewhere new each time; the rocket drifts gently
425
+ while the card is open. --launch-angle is registered so the conic gradient
426
+ itself rotates; browsers without @property show the light standing still. */
427
+ @property --launch-angle {
428
+ syntax: "<angle>";
429
+ initial-value: 0deg;
430
+ inherits: false;
431
+ }
432
+ @keyframes launch-border-spin {
433
+ to {
434
+ --launch-angle: 360deg;
435
+ }
436
+ }
437
+ @keyframes launch-border-fade {
438
+ 0%,
439
+ 100% {
440
+ opacity: 0.15;
441
+ }
442
+ 50% {
443
+ opacity: 1;
444
+ }
445
+ }
446
+ .launch-border {
447
+ /* A deeper green on light surfaces, where the paler one washes out. */
448
+ --launch-glow: 5, 150, 105;
449
+ }
450
+ .dark .launch-border {
451
+ --launch-glow: 52, 211, 153;
452
+ }
453
+ .launch-border::before,
454
+ .launch-border::after {
455
+ content: "";
456
+ position: absolute;
457
+ pointer-events: none;
458
+ border-radius: inherit;
459
+ background: conic-gradient(
460
+ from var(--launch-angle),
461
+ transparent 0deg,
462
+ rgba(var(--launch-glow), 0) 30deg,
463
+ rgba(var(--launch-glow), 0.95) 80deg,
464
+ rgba(var(--launch-glow), 0) 130deg,
465
+ transparent 360deg
466
+ );
467
+ animation:
468
+ launch-border-spin 5s linear infinite,
469
+ launch-border-fade 6.85s ease-in-out infinite;
470
+ }
471
+ /* The ring: the gradient masked down to a 1.5px border on top of the card. */
472
+ .launch-border::before {
473
+ inset: -1px;
474
+ padding: 1.5px;
475
+ z-index: 1;
476
+ -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
477
+ -webkit-mask-composite: xor;
478
+ mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
479
+ mask-composite: exclude;
480
+ }
481
+ /* The glow: the same gradient blurred behind the card, so light spills outward. */
482
+ .launch-border::after {
483
+ inset: -4px;
484
+ z-index: -1;
485
+ filter: blur(12px);
486
+ }
487
+ @keyframes launch-rocket {
488
+ 0%,
489
+ 100% {
490
+ transform: translate(0, 0) rotate(0deg);
491
+ }
492
+ 50% {
493
+ transform: translate(1.5px, -2.5px) rotate(-6deg);
494
+ }
495
+ }
496
+ .animate-launch-rocket {
497
+ animation: launch-rocket 3s ease-in-out infinite;
498
+ }
499
+ @media (prefers-reduced-motion: reduce) {
500
+ .launch-border::before,
501
+ .launch-border::after,
502
+ .animate-launch-rocket {
503
+ animation: none;
504
+ }
505
+ }
506
+
422
507
  /* Gentle colorize when syntax-highlighted code swaps in over plain text — opacity
423
508
  only (no transform → no layout shift) and floored at 0.5 so it never blanks. */
424
509
  @keyframes code-colorize {