fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Improve team activities: Surface team_id and team_name to policy and query activities

Open RachelElysia opened this issue 8 months ago • 3 comments

Gong snippet: TODO March 31, 2025, Software Design Review, 18 minutes in - @noahtalerman @eugkuo chat about use case for having this addition but not wanting to blow up scope on a different feature ticket

Problem

When adding, editing, and deleting a policy (also a query), we are not surfacing the team information for those activities in the activity API or activity feed UI. See screenshot:

Image

We do surface the team_id and team_name for adding, editing, and deleting software. See screenshot:

Image

What have you tried?

Potential solutions

  • [ ] Add team_id and team_name to the activity details for add/edit/delete policy
  • [ ] Surface the team name in the UI for policy activities similar to surfacing the team name in the software activities
  • [ ] Add team_id and team_name to the activity details for add/edit/delete query
  • [ ] Surface the team name in the UI for query activities similar to surfacing the team name in the software activities

What is the expected workflow as a result of your proposal?

When looking at the global activity on the dashboard, I can clearly see if a policy (or query) has been edited for a specific team or if it was a global policy (or query).

RachelElysia avatar Mar 31 '25 15:03 RachelElysia

related to #25499 , so the software team may want to take this

mostlikelee avatar Mar 31 '25 16:03 mostlikelee

related to https://github.com/fleetdm/fleet/issues/25499 , so the software team may want to take this

@mostlikelee Speaking of this, didn't someone file a ticket about updating activity things on our last call? I'm not sure where that ticket is to link it.

cc @noahtalerman

eugkuo avatar Apr 01 '25 12:04 eugkuo

Hi team, This issue looks beginner-friendly — I’d love to take it up as my first contribution to Fleet.

I’ve gone through the context and the linked issues. The goal is clear:

  • Add team_id and team_name to the activity API responses for policy and query actions
  • Surface this information in the activity feed UI, similar to how it’s done for software activities Could you please assign this issue to me? 🙏

drvcodenta avatar Apr 05 '25 16:04 drvcodenta

Hey @drvcodenta! Please feel free to open a PR when you get the chance.

We added this feature request to Feature fest to weigh it for prioritization. Heads up that this feature request has to be prioritized at the next feature fest to merge in your PR: https://fleetdm.com/handbook/company/product-groups#criteria-for-prioritization

If it's prioritized, we'll assign a member of the Fleet team to the feature request. They'll be responsible for helping merge in your PR.

noahtalerman avatar Apr 08 '25 13:04 noahtalerman

Gong snippet: TODO March 31, 2025, Software Design Review, 18 minutes in - @noahtalerman @eugkuo chat about use case for having this addition but not wanting to blow up scope on a different feature ticket

Problem

When adding, editing, and deleting a policy (also a query), we are not surfacing the team information for those activities in the activity API or activity feed UI. See screenshot:

Image

We do surface the team_id and team_name for adding, editing, and deleting software. See screenshot:

Image

What have you tried?

Potential solutions

  • [ ] Add team_id and team_name to the activity details for add/edit/delete policy
  • [ ] Surface the team name in the UI for policy activities similar to surfacing the team name in the software activities
  • [ ] Add team_id and team_name to the activity details for add/edit/delete query
  • [ ] Surface the team name in the UI for query activities similar to surfacing the team name in the software activities

What is the expected workflow as a result of your proposal?

When looking at the global activity on the dashboard, I can clearly see if a policy (or query) has been edited for a specific team or if it was a global policy (or query).

noahtalerman avatar Apr 08 '25 21:04 noahtalerman

Hi, While working on this issue, I noticed that editing a global policy doesn't create any activity log (no ActivityTypeEditedPolicy is generated and there is no function defined for that purpose in the global_policies). I wanted to know if there is a philosophical reason behind this gap? Or is it likely just an oversight?

drvcodenta avatar Apr 14 '25 13:04 drvcodenta

@drvcodenta super appreciate you jumping on this ticket!!!

I just added, edited, and deleted a "All teams" (global) policy in the UI and got these activities:

    {
      "created_at": "2025-04-15T18:41:10.419719Z",
      "id": 836,
      "actor_full_name": "Rachel",
      "actor_id": 1,
      "actor_gravatar": "",
      "actor_email": "***",
      "type": "deleted_policy",
      "details": {
        "policy_id": 74,
        "policy_name": "Edit policy"
      },
      "fleet_initiated": false
    },
    {
      "created_at": "2025-04-15T18:41:02.559709Z",
      "id": 835,
      "actor_full_name": "Rachel",
      "actor_id": 1,
      "actor_gravatar": "",
      "actor_email": "***",
      "type": "edited_policy",
      "details": {
        "policy_id": 74,
        "policy_name": "Edit policy"
      },
      "fleet_initiated": false
    },
    {
      "created_at": "2025-04-15T18:40:57.950179Z",
      "id": 834,
      "actor_full_name": "Rachel",
      "actor_id": 1,
      "actor_gravatar": "",
      "actor_email": "***",
      "type": "created_policy",
      "details": {
        "policy_id": 74,
        "policy_name": "Add policy"
      },
      "fleet_initiated": false
    },

Are you not seeing the same on your end?

RachelElysia avatar Apr 15 '25 18:04 RachelElysia

Interesting!! Yes, I actually don't see any log of the activity when I edit an "All teams"(global) policy on my End Idk why it's causing this weird Behaviour🤔 I also checked for ActivityTypeEditedPolicy inside global_policy.go --> I didn't find any function, so I thought maybe it was intentionally left out for some reason. For reference, here's the process I followed to edit an all teams policy

https://github.com/user-attachments/assets/dc83e140-5606-4b9b-b101-943046cf7a02

drvcodenta avatar Apr 16 '25 08:04 drvcodenta

@drvcodenta thanks for the detailed screenrecording!! That is so weird!!! I'll take a look again later today, and get back to ya

RachelElysia avatar Apr 16 '25 14:04 RachelElysia

@RachelElysia I have submitted a patch that solves the issue except for the case of activity type edited policy in all Teams. I’ve attached a screenshot with a sample output for reference. Please let me know if any changes are needed!

drvcodenta avatar Apr 20 '25 05:04 drvcodenta

I was planning to add the function for activity type edited policy in all teams myself but since it's actually working in your case, i decided to not add it as it may add some unnecessary code.

drvcodenta avatar Apr 20 '25 07:04 drvcodenta

QA notes:

Completed a test pass with All teams, No team, and specific team and only one outstanding issue remains: Editing a policy that is available on All teams does not include "globally" copy

@drvcodenta for vis

Once this issue is resolved, I'll move it to Ready for Release

Checklist:

Queries:

  • [x] Adding a query - Specific team
  • [x] Adding a query - All Teams
  • [x] Editing a query - Specific team
  • [x] Editing a query - All Teams
  • [x] Deleting a query - Specific team
  • [x] Deleting a query - All Teams
Image

Policies:

  • [x] Adding a policy - Specific team
  • [x] Adding a policy - No Team
  • [x] Adding a policy - All Teams
  • [x] Editing a policy - Specific team
  • [x] Editing a policy - No Team
  • [ ] Editing a policy - All Teams
  • [x] Deleting a policy - Specific team
  • [x] Deleting a policy - No Team
  • [x] Deleting a policy - All Teams
Image

AndreyKizimenko avatar Aug 18 '25 18:08 AndreyKizimenko

Thanks for confirming. I had noticed this earlier too, I’ll put up a follow-up PR to handle the “All teams” edit case.

drvcodenta avatar Aug 21 '25 05:08 drvcodenta

Confirmed that this is now resolved on the latest RC. Moving to Ready for release. Thanks everyone!

AndreyKizimenko avatar Sep 02 '25 15:09 AndreyKizimenko

@noahtalerman Flagging this as a non-user story that was included in the release.

lukeheath avatar Sep 09 '25 00:09 lukeheath

In cloud's glass city, Teams and policies align, Fleet's clarity shines.

fleet-release avatar Sep 11 '25 21:09 fleet-release