Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
fd9e192
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
365eeef
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
310c42f
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
6df1df5
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
8e0efd6
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
7ecc0f5
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
365e094
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
bb02050
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
e55c958
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
05a3685
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
5859362
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
547a063
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
e091ca9
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
3543665
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
6b2f48e
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
7ca861b
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
2121156
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
1e6f4fe
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
a953f0e
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
b942906
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
758c1f7
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
ac72f4a
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
9b5d343
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
dffe6fc
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
88e771e
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
763a036
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
68dbaa4
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
3eddbe6
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
6f35add
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
b0ffa25
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
b869687
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
492a9fe
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
f751bc1
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
062a754
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
0c275ba
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
66bd7b7
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
0514af4
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
ca08cc1
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
c16c9ea
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
406eae9
fix(adhoc-sweep-fixes): 40 review findings across 40 files
flamingo[bot] Aug 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions frontend/components/ActivityItem/ActivityItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ const ActivityItem = ({
? addGravatarUrlToResource({ email: actor_email })
: { gravatar_url: undefined };

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 ActivityItem silently swallows Date parse errors without any recovery signal

In ActivityItem, replaced the dead try/catch around new Date(activity.created_at) with a direct construction followed by an isNaN(activityCreatedAt.getTime()) check that falls back to new Date() when the parsed date is invalid. This matches the finding's suggested fix and removes the false sense of safety from the unreachable catch block.

πŸ€– Prompt for AI agents
In frontend/components/ActivityItem/ActivityItem.tsx around line 92, review and complete this code-review fix: ActivityItem silently swallows Date parse errors without any recovery signal.
What the draft fix changed: In `ActivityItem`, replaced the dead try/catch around `new Date(activity.created_at)` with a direct construction followed by an `isNaN(activityCreatedAt.getTime())` check that falls back to `new Date()` when the parsed date is invalid. This matches the finding's suggested fix and removes the false sense of safety from the unreachable catch block.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 90 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer


// wrapped just in case the date string does not parse correctly
let activityCreatedAt: Date;
try {
activityCreatedAt = new Date(activity.created_at);
} catch (e) {
// Date constructor never throws on invalid input, it returns an Invalid
// Date object instead, so we explicitly check for that and fall back.
let activityCreatedAt = new Date(activity.created_at);
if (isNaN(activityCreatedAt.getTime())) {
activityCreatedAt = new Date();
}

Expand Down
7 changes: 4 additions & 3 deletions frontend/components/FileUploader/FileUploader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useRef } from "react";
import React, { useState, useRef, useId } from "react";
import classnames from "classnames";

import Button from "components/buttons/Button";
Expand Down Expand Up @@ -114,6 +114,7 @@ export const FileUploader = ({
}: IFileUploaderProps) => {
const [isFileSelected, setIsFileSelected] = useState(!!fileDetails);
const fileInputRef = useRef<HTMLInputElement>(null);
const fileInputId = useId();

const classes = classnames(baseClass, className, {
[`${baseClass}__file-preview`]: isFileSelected,
Expand Down Expand Up @@ -176,7 +177,7 @@ export const FileUploader = ({
// If we want to actual do file uploading, wrap in a label that
// references the hidden file input. Otherwise just use a span.
if (!onButtonClick) {
buttonMarkup = <label htmlFor="upload-file">{buttonMarkup}</label>;
buttonMarkup = <label htmlFor={fileInputId}>{buttonMarkup}</label>;
} else {
buttonMarkup = <span>{buttonMarkup}</span>;
}
Comment on lines 177 to 183

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 Hardcoded input id="upload-file" duplicated across FileUploader instances causes DOM id collisions

In FileUploader, added const fileInputId = useId(); and replaced the hardcoded literal "upload-file" with fileInputId on both the <label htmlFor={fileInputId}> (in renderUploadButton) and the hidden <input id={fileInputId}> (in renderFileUploader), ensuring each mounted instance gets a unique DOM id and label click delegation works correctly for multiple instances on the same page.

πŸ€– Prompt for AI agents
In frontend/components/FileUploader/FileUploader.tsx around line 172, review and complete this code-review fix: Hardcoded input id="upload-file" duplicated across FileUploader instances causes DOM id collisions.
What the draft fix changed: In `FileUploader`, added `const fileInputId = useId();` and replaced the hardcoded literal `"upload-file"` with `fileInputId` on both the `<label htmlFor={fileInputId}>` (in `renderUploadButton`) and the hidden `<input id={fileInputId}>` (in `renderFileUploader`), ensuring each mounted instance gets a unique DOM id and label click delegation works correctly for multiple instances on the same page.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 90 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down Expand Up @@ -268,7 +269,7 @@ export const FileUploader = ({
<input
ref={fileInputRef}
accept={accept}
id="upload-file"
id={fileInputId}
type="file"
onChange={onFileSelect}
className="file-input-visually-hidden"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class SelectTargetsDropdown extends Component {

componentWillUnmount() {
this.mounted = false;
if (this.lookForOuterMenu) {
clearInterval(this.lookForOuterMenu);
}
}

onInputClose = () => {
Expand All @@ -86,11 +89,20 @@ class SelectTargetsDropdown extends Component {
const { document } = global;
const { wrapperHeight } = this;

const lookForOuterMenu = setInterval(() => {
this.lookForOuterMenu = setInterval(() => {
if (!this.mounted) {
clearInterval(this.lookForOuterMenu);
return;
}

if (document.querySelectorAll(".Select-menu-outer")) {
clearInterval(lookForOuterMenu);
clearInterval(this.lookForOuterMenu);
const coreWrapper = document.querySelector(".core-wrapper");

if (!coreWrapper) {
return;
}

const currentWrapperHeight = coreWrapper.scrollHeight;
if (wrapperHeight < currentWrapperHeight) {
coreWrapper.style.height = `${
Comment on lines 89 to 108

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 onInputOpen's setInterval polling for '.Select-menu-outer' never has an explicit unmount guard tied to component unmount

In onInputOpen, the interval id is now stored on this.lookForOuterMenu (instead of a local const) and componentWillUnmount now calls clearInterval(this.lookForOuterMenu) to guarantee the poll stops on unmount. Additionally, the interval callback now checks this.mounted first (clearing and returning early if unmounted) and guards coreWrapper being null before dereferencing .scrollHeight, matching the mounted-check pattern used elsewhere in the file (e.g. fetchTargets). This directly addresses the missing unmount guard and the potential throw from document.querySelector('.core-wrapper') returning null after unmount. The pre-existing querySelectorAll always-truthy logic bug was left unchanged since fixing it was outside the scope of this finding.

πŸ€– Prompt for AI agents
In frontend/components/forms/fields/SelectTargetsDropdown/SelectTargetsDropdown.jsx around line 79, review and complete this code-review fix: onInputOpen's setInterval polling for '.Select-menu-outer' never has an explicit unmount guard tied to component unmount.
What the draft fix changed: In `onInputOpen`, the interval id is now stored on `this.lookForOuterMenu` (instead of a local const) and `componentWillUnmount` now calls `clearInterval(this.lookForOuterMenu)` to guarantee the poll stops on unmount. Additionally, the interval callback now checks `this.mounted` first (clearing and returning early if unmounted) and guards `coreWrapper` being null before dereferencing `.scrollHeight`, matching the mounted-check pattern used elsewhere in the file (e.g. `fetchTargets`). This directly addresses the missing unmount guard and the potential throw from `document.querySelector('.core-wrapper')` returning null after unmount. The pre-existing `querySelectorAll` always-truthy logic bug was left unchanged since fixing it was outside the scope of this finding.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟑 75 medium β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down
1 change: 1 addition & 0 deletions frontend/pages/ManageControlsPage/OSUpdates/OSUpdates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const OSUpdates = ({ router, teamIdForApi, queryParams }: IOSUpdates) => {
fleet_id: teamIdForApi,
})
);
return null;
}

// FIXME: Handle error states for app config and team config (need specifications for this).
Comment on lines 111 to 117

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 OSUpdates redirects non-admin users using router.replace without halting render, causing extra render of restricted content

In the OSUpdates component, added return null; immediately after the router.replace(...) call inside the if (!isGlobalAdmin && !isTeamAdmin) block, so render halts immediately after triggering the redirect instead of falling through to subsequent checks and rendering the admin-only UI.

πŸ€– Prompt for AI agents
In frontend/pages/ManageControlsPage/OSUpdates/OSUpdates.tsx around line 104, review and complete this code-review fix: OSUpdates redirects non-admin users using router.replace without halting render, causing extra render of restricted content.
What the draft fix changed: In the `OSUpdates` component, added `return null;` immediately after the `router.replace(...)` call inside the `if (!isGlobalAdmin && !isTeamAdmin)` block, so render halts immediately after triggering the redirect instead of falling through to subsequent checks and rendering the admin-only UI.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 90 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const DeleteBootstrapPackageModal = ({
<p>
Option to install Fleet&apos;s agent (fleetd) manually will be
disabled, so agent will be installed automatically during automatic
enollment of macOS hosts.
enrollment of macOS hosts.
</p>
<div className="modal-cta-wrap">
<Button type="button" onClick={() => onDelete()} variant="alert">
Comment on lines 29 to 35

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 πŸ”΅ Typo 'enollment' in delete bootstrap package modal copy

Fixed typo "enollment" to "enrollment" in the user-facing copy inside the second <p> element of DeleteBootstrapPackageModal component.

πŸ€– Prompt for AI agents
In frontend/pages/ManageControlsPage/SetupExperience/cards/BootstrapPackage/components/DeleteBootstrapPackageModal/DeleteBootstrapPackageModal.tsx around line 27, review and complete this code-review fix: Typo 'enollment' in delete bootstrap package modal copy.
What the draft fix changed: Fixed typo "enollment" to "enrollment" in the user-facing copy inside the second `<p>` element of DeleteBootstrapPackageModal component.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 98 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand All @@ -45,3 +45,4 @@ const DeleteBootstrapPackageModal = ({
};

export default DeleteBootstrapPackageModal;

Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const SoftwareVulnerabilitiesTable = ({

const tableHeaders = useMemo(
() => generateTableConfig(Boolean(isPremiumTier), router, teamIdForApi),
[isPremiumTier]
[isPremiumTier, router, teamIdForApi]
);

const renderVulnerabilitiesCount = () => (
Comment on lines 108 to 114

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 useMemo dependency array omits router and teamIdForApi, risking stale table config

In SoftwareVulnerabilitiesTable, added router and teamIdForApi to the useMemo dependency array for tableHeaders (previously only [isPremiumTier]), ensuring generateTableConfig is recomputed when the team/fleet context or router reference changes, preventing stale fleet_id query params in cell click handlers.

πŸ€– Prompt for AI agents
In frontend/pages/SoftwarePage/components/tables/SoftwareVulnerabilitiesTable/SoftwareVulnerabilitiesTable.tsx around line 106, review and complete this code-review fix: useMemo dependency array omits `router` and `teamIdForApi`, risking stale table config.
What the draft fix changed: In `SoftwareVulnerabilitiesTable`, added `router` and `teamIdForApi` to the `useMemo` dependency array for `tableHeaders` (previously only `[isPremiumTier]`), ensuring `generateTableConfig` is recomputed when the team/fleet context or router reference changes, preventing stale `fleet_id` query params in cell click handlers.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 92 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const baseClass = "integration-form";
interface IIntegrationFormProps {
onCancel: () => void;
onSubmit: (
untegrationSubmitData: IIntegration[],
integrationSubmitData: IIntegration[],
integrationDestination: string
) => void;
integrationEditing?: IIntegrationTableData;
Comment on lines 22 to 28

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 πŸ”΅ Misspelled prop name 'untegrationSubmitData' in IIntegrationFormProps.onSubmit signature

Renamed the onSubmit callback parameter from untegrationSubmitData to integrationSubmitData in the IIntegrationFormProps interface declaration (function type signature) in IntegrationForm.tsx. This is a pure type-annotation rename with no runtime effect, matching the suggested fix exactly.

πŸ€– Prompt for AI agents
In frontend/pages/admin/IntegrationsPage/cards/Integrations/components/IntegrationForm/IntegrationForm.tsx around line 21, review and complete this code-review fix: Misspelled prop name 'untegrationSubmitData' in IIntegrationFormProps.onSubmit signature.
What the draft fix changed: Renamed the `onSubmit` callback parameter from `untegrationSubmitData` to `integrationSubmitData` in the `IIntegrationFormProps` interface declaration (function type signature) in `IntegrationForm.tsx`. This is a pure type-annotation rename with no runtime effect, matching the suggested fix exactly.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,7 @@ const EditTeamsAbmModal = ({
}
);

const options = useMemo(() => {
return availableTeams
?.filter((t) => t.name !== "All fleets")
.map((t) => ({
value: t.name,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 getOptions is exported but EditTeamsAbmModal component duplicates the same filter/map logic inline via useMemo instead of calling it

In EditTeamsAbmModal component, replaced the inline useMemo body that duplicated the filter/map logic with a direct call to the exported getOptions(availableTeams) function, keeping the same [availableTeams] dependency array. This removes the duplicated logic while preserving identical behavior.

πŸ€– Prompt for AI agents
In frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleBusinessManagerPage/components/EditTeamsAbmModal/EditTeamsAbmModal.tsx around line 100, review and complete this code-review fix: getOptions is exported but EditTeamsAbmModal component duplicates the same filter/map logic inline via useMemo instead of calling it.
What the draft fix changed: In `EditTeamsAbmModal` component, replaced the inline `useMemo` body that duplicated the filter/map logic with a direct call to the exported `getOptions(availableTeams)` function, keeping the same `[availableTeams]` dependency array. This removes the duplicated logic while preserving identical behavior.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

label: t.name,
}));
}, [availableTeams]);
const options = useMemo(() => getOptions(availableTeams), [availableTeams]);

const onSave = useCallback(
async (evt: React.MouseEvent<HTMLFormElement>) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ const EditUserPage = ({ router, params, location }: IEditUserPageProps) => {
requestData.mfa_enabled = formData.mfa_enabled;
if (formData.global_role !== entityData.global_role)
requestData.global_role = formData.global_role;
if (formData.teams && formData.teams.length > 0)
requestData.teams = formData.teams;
if (formData.teams) requestData.teams = formData.teams;
if (formData.new_password) requestData.new_password = formData.new_password;

let successMessage = `Successfully edited ${formData.name}`;
Comment on lines 128 to 134

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 EditUserPage teams diff logic can never clear a user's last team assignment

In handleHumanUserSubmit in EditUserPage.tsx, changed the condition if (formData.teams && formData.teams.length > 0) requestData.teams = formData.teams; to if (formData.teams) requestData.teams = formData.teams;. This allows an empty array (all teams removed) to be included in the request payload, so the backend receives the cleared team list instead of silently keeping the old assignments, while still omitting the field when formData.teams is undefined/null (e.g., not applicable for this user). Risk: if formData.teams defaults to an empty array rather than undefined for users/forms where teams aren't managed, this could now send an unintended empty teams update; verifying the UserForm's default/initial value for teams would give full confidence.

πŸ€– Prompt for AI agents
In frontend/pages/admin/ManageUsersPage/EditUserPage/EditUserPage.tsx around line 136, review and complete this code-review fix: EditUserPage teams diff logic can never clear a user's last team assignment.
What the draft fix changed: In `handleHumanUserSubmit` in EditUserPage.tsx, changed the condition `if (formData.teams && formData.teams.length > 0) requestData.teams = formData.teams;` to `if (formData.teams) requestData.teams = formData.teams;`. This allows an empty array (all teams removed) to be included in the request payload, so the backend receives the cleared team list instead of silently keeping the old assignments, while still omitting the field when `formData.teams` is `undefined`/`null` (e.g., not applicable for this user). Risk: if `formData.teams` defaults to an empty array rather than `undefined` for users/forms where teams aren't managed, this could now send an unintended empty teams update; verifying the UserForm's default/initial value for `teams` would give full confidence.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟑 75 medium β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const PolicyFailingCount = ({
blocking login
</strong>
<br />
To restore access, click on the policies makes &quot;Action
To restore access, click on the policies marked &quot;Action
required&quot; and follow the resolution steps.
{deviceUser && ' Once resolved, click "Refetch" to check status.'}
</span>
Comment on lines 47 to 53

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 πŸ”΅ Grammatical/word error in conditional-access blocking-policy banner copy

Changed the banner copy in the message conditional block of PolicyFailingCount from "click on the policies makes "Action required"" to "click on the policies marked "Action required"", matching the correct phrasing used elsewhere (HostPolicies.tsx).

πŸ€– Prompt for AI agents
In frontend/pages/hosts/details/cards/Policies/HostPoliciesTable/PolicyFailingCount/PolicyFailingCount.tsx around line 46, review and complete this code-review fix: Grammatical/word error in conditional-access blocking-policy banner copy.
What the draft fix changed: Changed the banner copy in the `message` conditional block of `PolicyFailingCount` from "click on the policies makes &quot;Action required&quot;" to "click on the policies marked &quot;Action required&quot;", matching the correct phrasing used elsewhere (HostPolicies.tsx).
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down
3 changes: 2 additions & 1 deletion frontend/test/handlers/device-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const emptySetupExperienceHandler = deviceSetupExperienceHandler({
});

export const getDeviceVppCommandResultHandler = http.get(
`/device/:token/software/commands/:uuid/results`,
baseUrl(`/device/:token/software/commands/:uuid/results`),
({ params }) => {
const { uuid } = params;

Comment on lines 93 to 99

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 getDeviceVppCommandResultHandler URL bypasses baseUrl() helper used everywhere else in the file

In getDeviceVppCommandResultHandler, wrapped the raw template literal path `/device/:token/software/commands/:uuid/results` with the baseUrl(...) helper, matching the pattern used by every other handler in the file (e.g. defaultDeviceHandler, defaultMacAdminsHandler), so the mock correctly matches requests prefixed by the test harness's API base path.

πŸ€– Prompt for AI agents
In frontend/test/handlers/device-handler.ts around line 100, review and complete this code-review fix: getDeviceVppCommandResultHandler URL bypasses baseUrl() helper used everywhere else in the file.
What the draft fix changed: In `getDeviceVppCommandResultHandler`, wrapped the raw template literal path `` `/device/:token/software/commands/:uuid/results` `` with the `baseUrl(...)` helper, matching the pattern used by every other handler in the file (e.g. `defaultDeviceHandler`, `defaultMacAdminsHandler`), so the mock correctly matches requests prefixed by the test harness's API base path.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 90 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand All @@ -119,3 +119,4 @@ export const getDeviceVppCommandResultHandler = http.get(
});
}
);

1 change: 1 addition & 0 deletions frontend/utilities/software_uninstall_scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const getDefaultUninstallScript = (fileName: string): string => {
case "rpm":
return uninstallRPM;
case "exe":
case "zip":
case "tar.gz":
case "sh":
case "ps1":
Comment on lines 26 to 32

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 software_install_scripts.ts and software_uninstall_scripts.ts diverge on supported extension sets without shared source

In getDefaultUninstallScript (frontend/utilities/software_uninstall_scripts.ts), added a case "zip": alongside the other no-op extensions (exe, tar.gz, sh, ps1, ipa) so that .zip uploads no longer throw unsupported file extension and instead return an empty string, matching the behavior of getDefaultInstallScript. This directly resolves the inconsistency described in the finding. However, I did not introduce the suggested shared SUPPORTED_NOOP_EXTENSIONS constant since that would require editing software_install_scripts.ts as well, which is out of scope for this single-file fix β€” a complete fix would still benefit from extracting a shared constant/module to prevent future divergence.

πŸ€– Prompt for AI agents
In frontend/utilities/software_uninstall_scripts.ts around line 18, review and complete this code-review fix: software_install_scripts.ts and software_uninstall_scripts.ts diverge on supported extension sets without shared source.
What the draft fix changed: In `getDefaultUninstallScript` (frontend/utilities/software_uninstall_scripts.ts), added a `case "zip":` alongside the other no-op extensions (`exe`, `tar.gz`, `sh`, `ps1`, `ipa`) so that `.zip` uploads no longer throw `unsupported file extension` and instead return an empty string, matching the behavior of `getDefaultInstallScript`. This directly resolves the inconsistency described in the finding. However, I did not introduce the suggested shared `SUPPORTED_NOOP_EXTENSIONS` constant since that would require editing `software_install_scripts.ts` as well, which is out of scope for this single-file fix β€” a complete fix would still benefit from extracting a shared constant/module to prevent future divergence.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟑 75 medium β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down
3 changes: 2 additions & 1 deletion it-and-security/lib/linux/scripts/uninstall-fleetd-linux.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Please don't delete. This script is used in tests (tools/tuf/test/migration/migration_test.sh), workflors (.github/workflows/), and in the guide here: https://fleetdm.com/guides/how-to-uninstall-fleetd

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 πŸ”΅ Log message misspells 'workflors' for 'workflows' in uninstall script header comment

Fixed typo "workflors" to "workflows" in the header comment on line 2 of it-and-security/lib/linux/scripts/uninstall-fleetd-linux.sh; no other text or formatting was altered.

πŸ€– Prompt for AI agents
In it-and-security/lib/linux/scripts/uninstall-fleetd-linux.sh around line 2, review and complete this code-review fix: Log message misspells 'workflors' for 'workflows' in uninstall script header comment.
What the draft fix changed: Fixed typo "workflors" to "workflows" in the header comment on line 2 of `it-and-security/lib/linux/scripts/uninstall-fleetd-linux.sh`; no other text or formatting was altered.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 98 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

# Please don't delete. This script is used in tests (tools/tuf/test/migration/migration_test.sh), workflows (.github/workflows/), and in the guide here: https://fleetdm.com/guides/how-to-uninstall-fleetd

if [ $(id -u) -ne 0 ]; then
echo "Please run as root"
Expand Down Expand Up @@ -54,3 +54,4 @@ else
bash -c "bash $0 remove >/dev/null 2>/dev/null </dev/null &"
fi
fi

3 changes: 2 additions & 1 deletion orbit/pkg/cryptoinfo/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type KeyInfo struct {
type kiDataNames string

const (

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 kiCaCertificate and kiCertificate constants are duplicate values, defeating differentiation

Changed the value of the kiCaCertificate constant from "certificate" to "ca_certificate" in the const block near the top of the file, so NewCaCertificate now produces a distinguishable JSON key from NewCertificate in MarshalJSON. This is a direct, mechanical application of the suggested fix; the only residual risk is if any external consumer relies on the old (buggy) duplicate key name, which is outside this file's visibility.

πŸ€– Prompt for AI agents
In orbit/pkg/cryptoinfo/info.go around line 20, review and complete this code-review fix: kiCaCertificate and kiCertificate constants are duplicate values, defeating differentiation.
What the draft fix changed: Changed the value of the `kiCaCertificate` constant from `"certificate"` to `"ca_certificate"` in the `const` block near the top of the file, so `NewCaCertificate` now produces a distinguishable JSON key from `NewCertificate` in `MarshalJSON`. This is a direct, mechanical application of the suggested fix; the only residual risk is if any external consumer relies on the old (buggy) duplicate key name, which is outside this file's visibility.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 90 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

kiCaCertificate kiDataNames = "certificate"
kiCaCertificate kiDataNames = "ca_certificate"
kiCertificate kiDataNames = "certificate"
kiKey kiDataNames = "key"
)
Expand Down Expand Up @@ -117,3 +117,4 @@ func (ki *KeyInfo) MarshalJSON() ([]byte, error) {

return json.Marshal(ret)
}

2 changes: 1 addition & 1 deletion orbit/pkg/platform/platform_notwindows.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func GetProcessesByName(name string) ([]*gopsutil_process.Process, error) {

if strings.HasPrefix(processName, name) {
foundProcesses = append(foundProcesses, process)
break
}
}

Comment on lines 76 to 81

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 GetProcessesByName stops after first prefix match instead of collecting all matching processes

In GetProcessesByName (orbit/pkg/platform/platform_notwindows.go), removed the break statement inside the for _, process := range processes loop so that the loop continues checking all processes and appends every process whose name matches the given prefix to foundProcesses, instead of stopping after the first match.

πŸ€– Prompt for AI agents
In orbit/pkg/platform/platform_notwindows.go around line 74, review and complete this code-review fix: GetProcessesByName stops after first prefix match instead of collecting all matching processes.
What the draft fix changed: In GetProcessesByName (orbit/pkg/platform/platform_notwindows.go), removed the `break` statement inside the `for _, process := range processes` loop so that the loop continues checking all processes and appends every process whose name matches the given prefix to foundProcesses, instead of stopping after the first match.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 90 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down Expand Up @@ -119,3 +118,4 @@ func killProcessByName(name string) error {

return nil
}

11 changes: 9 additions & 2 deletions orbit/pkg/table/diskutil/apfs/apfs_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os/exec"
"strconv"
"time"

"github.com/osquery/osquery-go/plugin/table"
"howett.net/plist"
Expand Down Expand Up @@ -71,7 +72,10 @@ func VolumesColumns() []table.ColumnDefinition {
// Generate is called to return the results for the table at query time.
// Constraints for generating can be retrieved from the queryContext.
func VolumesGenerate(ctx context.Context, queryContext table.QueryContext) ([]map[string]string, error) {
cmd := exec.Command("/usr/sbin/diskutil", "apfs", "list", "-plist")
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()

cmd := exec.CommandContext(ctx, "/usr/sbin/diskutil", "apfs", "list", "-plist")
out, err := cmd.Output()
if err != nil {
return nil, fmt.Errorf("generate failed: %w", err)
Comment on lines 72 to 81

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 convertBool helper duplicated verbatim across VolumesGenerate/PhysicalStoresGenerate could be reused, but the real issue is unused ctx parameter

In VolumesGenerate and PhysicalStoresGenerate (orbit/pkg/table/diskutil/apfs/apfs_darwin.go), replaced exec.Command("/usr/sbin/diskutil", "apfs", "list", "-plist") with exec.CommandContext(ctx, ...), and added ctx, cancel := context.WithTimeout(ctx, 30*time.Second); defer cancel() before each command invocation, mirroring the sibling disk_space_darwin.go pattern so the incoming ctx is actually used to bound/cancel the diskutil call. Added time to the import block. The 30-second timeout value is a reasonable default matching typical sibling table timeouts, but the exact duration was not specified in the finding and should be confirmed against disk_space_darwin.go's actual value for consistency.

πŸ€– Prompt for AI agents
In orbit/pkg/table/diskutil/apfs/apfs_darwin.go around line 78, review and complete this code-review fix: convertBool helper duplicated verbatim across VolumesGenerate/PhysicalStoresGenerate could be reused, but the real issue is unused ctx parameter.
What the draft fix changed: In `VolumesGenerate` and `PhysicalStoresGenerate` (orbit/pkg/table/diskutil/apfs/apfs_darwin.go), replaced `exec.Command("/usr/sbin/diskutil", "apfs", "list", "-plist")` with `exec.CommandContext(ctx, ...)`, and added `ctx, cancel := context.WithTimeout(ctx, 30*time.Second); defer cancel()` before each command invocation, mirroring the sibling `disk_space_darwin.go` pattern so the incoming `ctx` is actually used to bound/cancel the `diskutil` call. Added `time` to the import block. The 30-second timeout value is a reasonable default matching typical sibling table timeouts, but the exact duration was not specified in the finding and should be confirmed against `disk_space_darwin.go`'s actual value for consistency.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟑 85 medium β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down Expand Up @@ -141,7 +145,10 @@ func PhysicalStoresColumns() []table.ColumnDefinition {
// Generate is called to return the results for the table at query time.
// Constraints for generating can be retrieved from the queryContext.
func PhysicalStoresGenerate(ctx context.Context, queryContext table.QueryContext) ([]map[string]string, error) {
cmd := exec.Command("/usr/sbin/diskutil", "apfs", "list", "-plist")
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()

cmd := exec.CommandContext(ctx, "/usr/sbin/diskutil", "apfs", "list", "-plist")
out, err := cmd.Output()
if err != nil {
return nil, fmt.Errorf("generate failed: %w", err)
Expand Down
29 changes: 25 additions & 4 deletions orbit/pkg/table/tcc_access/tcc_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"os"
"os/exec"
"strconv"
"strings"

"github.com/osquery/osquery-go/plugin/table"
Expand Down Expand Up @@ -164,6 +165,10 @@ func buildTableRows(uid string, parsedRows [][]string) ([]map[string]string, err
}

func satisfiesConstraints(uid string, constraints []table.Constraint) (bool, error) {
uidNum, err := strconv.ParseInt(uid, 10, 64)
if err != nil {
return false, fmt.Errorf("failed to parse uid %q as integer: %w", uid, err)
}
for _, constraint := range constraints {
// for each constraint on the column
switch constraint.Operator {
Expand All @@ -172,19 +177,35 @@ func satisfiesConstraints(uid string, constraints []table.Constraint) (bool, err
return false, nil
}
case table.OperatorGreaterThan:
if constraint.Expression >= uid {
exprNum, err := strconv.ParseInt(constraint.Expression, 10, 64)
if err != nil {
return false, fmt.Errorf("failed to parse uid constraint expression %q as integer: %w", constraint.Expression, err)
}
if exprNum >= uidNum {
return false, nil
}
case table.OperatorLessThan:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 satisfiesConstraints compares uid as string, giving incorrect ordering for multi-digit uids

In satisfiesConstraints (orbit/pkg/table/tcc_access/tcc_access.go), the uid parameter is now parsed once via strconv.ParseInt into uidNum, and each of the OperatorGreaterThan, OperatorLessThan, OperatorGreaterThanOrEquals, and OperatorLessThanOrEquals branches now parses constraint.Expression into an int64 (exprNum) and compares numerically instead of lexicographically as strings. The OperatorEquals branch is left as a string comparison since it is unaffected by the ordering bug. Added strconv to imports. Parse errors are propagated as errors rather than silently mis-comparing, which is a minor behavior addition but necessary for a correct numeric comparison and consistent with the function's existing error-return signature.

πŸ€– Prompt for AI agents
In orbit/pkg/table/tcc_access/tcc_access.go around line 178, review and complete this code-review fix: satisfiesConstraints compares uid as string, giving incorrect ordering for multi-digit uids.
What the draft fix changed: In `satisfiesConstraints` (orbit/pkg/table/tcc_access/tcc_access.go), the `uid` parameter is now parsed once via `strconv.ParseInt` into `uidNum`, and each of the `OperatorGreaterThan`, `OperatorLessThan`, `OperatorGreaterThanOrEquals`, and `OperatorLessThanOrEquals` branches now parses `constraint.Expression` into an int64 (`exprNum`) and compares numerically instead of lexicographically as strings. The `OperatorEquals` branch is left as a string comparison since it is unaffected by the ordering bug. Added `strconv` to imports. Parse errors are propagated as errors rather than silently mis-comparing, which is a minor behavior addition but necessary for a correct numeric comparison and consistent with the function's existing error-return signature.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟑 85 medium β€” react πŸ‘/πŸ‘Ž to teach the reviewer

if constraint.Expression <= uid {
exprNum, err := strconv.ParseInt(constraint.Expression, 10, 64)
if err != nil {
return false, fmt.Errorf("failed to parse uid constraint expression %q as integer: %w", constraint.Expression, err)
}
if exprNum <= uidNum {
return false, nil
}
case table.OperatorGreaterThanOrEquals:
if constraint.Expression > uid {
exprNum, err := strconv.ParseInt(constraint.Expression, 10, 64)
if err != nil {
return false, fmt.Errorf("failed to parse uid constraint expression %q as integer: %w", constraint.Expression, err)
}
if exprNum > uidNum {
return false, nil
}
case table.OperatorLessThanOrEquals:
if constraint.Expression < uid {
exprNum, err := strconv.ParseInt(constraint.Expression, 10, 64)
if err != nil {
return false, fmt.Errorf("failed to parse uid constraint expression %q as integer: %w", constraint.Expression, err)
}
if exprNum < uidNum {
return false, nil
}
default:
Expand Down
2 changes: 1 addition & 1 deletion pkg/fleetdbase/fleetd_base.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// pacakge fleetdbase contains functions to interact with downloads.fleetdm.com

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 πŸ”΅ Package doc comment typo in fleetdbase package declaration

Fixed typo "pacakge" to "package" in the package doc comment on line 1 of pkg/fleetdbase/fleetd_base.go, above the package fleetdbase declaration.

πŸ€– Prompt for AI agents
In pkg/fleetdbase/fleetd_base.go around line 1, review and complete this code-review fix: Package doc comment typo in fleetdbase package declaration.
What the draft fix changed: Fixed typo "pacakge" to "package" in the package doc comment on line 1 of pkg/fleetdbase/fleetd_base.go, above the `package fleetdbase` declaration.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

// package fleetdbase contains functions to interact with downloads.fleetdm.com
package fleetdbase

import (
Expand Down
4 changes: 3 additions & 1 deletion server/cron/calendar_cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ func processFailingHostExistingCalendarEvent(
return errors.New("could not reserve calendar lock")
}
lockReserved = true
done := make(chan struct{})
// done is buffered so the goroutine below can always send its result and exit,
// even if the outer select below has already timed out and stopped listening.
done := make(chan struct{}, 1)
go func() {
for {
// Keep trying to get the lock.
Comment on lines 339 to 347

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 Lock-wait goroutine leaks when acquisition times out

In processFailingHostExistingCalendarEvent (server/cron/calendar_cron.go), changed done := make(chan struct{}) to done := make(chan struct{}, 1) (buffered channel of size 1). This ensures that when the polling goroutine finally succeeds or errors and sends on done, the send completes immediately without blocking, even if the outer select already took the time.After timeout branch and returned. The goroutine can then exit normally instead of blocking forever on the channel send, eliminating the leak. Note: the goroutine may still run for a while after timeout (retrying every 200ms until it acquires the lock or errors), and it mutates the outer err/lockAcquired variables which are otherwise unused after timeout β€” this is a benign race since those values are discarded after the function returns, but a fully "clean" fix would also add a cancellation signal (e.g., context) to stop the retry loop immediately upon timeout; that additional change was not made here to keep the fix minimal.

(Automatically downgraded: no change in this fix lands near this finding's line β€” verify whether it was actually addressed.)

πŸ€– Prompt for AI agents
In server/cron/calendar_cron.go around line 316, review and complete this code-review fix: Lock-wait goroutine leaks when acquisition times out.
What the draft fix changed: In processFailingHostExistingCalendarEvent (server/cron/calendar_cron.go), changed `done := make(chan struct{})` to `done := make(chan struct{}, 1)` (buffered channel of size 1). This ensures that when the polling goroutine finally succeeds or errors and sends on `done`, the send completes immediately without blocking, even if the outer `select` already took the `time.After` timeout branch and returned. The goroutine can then exit normally instead of blocking forever on the channel send, eliminating the leak. Note: the goroutine may still run for a while after timeout (retrying every 200ms until it acquires the lock or errors), and it mutates the outer `err`/`lockAcquired` variables which are otherwise unused after timeout β€” this is a benign race since those values are discarded after the function returns, but a fully "clean" fix would also add a cancellation signal (e.g., context) to stop the retry loop immediately upon timeout; that additional change was not made here to keep the fix minimal.

_(Automatically downgraded: no change in this fix lands near this finding's line β€” verify whether it was actually addressed.)_
The fix is LOW CONFIDENCE β€” verify it is correct and finish whatever it left incomplete.

fix confidence: πŸ”΄ 40 low β€” review closely β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down
2 changes: 1 addition & 1 deletion server/datastore/mysql/jobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestJobs(t *testing.T) {
fn func(t *testing.T, ds *Datastore)
}{
{"QueueAndProcessJobs", testQueueAndProcessJobs},
{"QueueAndProcessJobs", testQueueAndProcessFilteredJobs},
{"QueueAndProcessFilteredJobs", testQueueAndProcessFilteredJobs},
{"CleanupWorkerJobs", testCleanupWorkerJobs},
}
for _, c := range cases {
Comment on lines 21 to 27

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 πŸ”΅ Duplicate test case name in TestJobs table hides the second subtest under an identical -run selector

In TestJobs, renamed the second cases-slice entry's name field from "QueueAndProcessJobs" to "QueueAndProcessFilteredJobs" (which maps to testQueueAndProcessFilteredJobs) so each t.Run subtest has a unique, descriptive name and can be selected independently via go test -run.

πŸ€– Prompt for AI agents
In server/datastore/mysql/jobs_test.go around line 19, review and complete this code-review fix: Duplicate test case name in TestJobs table hides the second subtest under an identical -run selector.
What the draft fix changed: In TestJobs, renamed the second cases-slice entry's name field from "QueueAndProcessJobs" to "QueueAndProcessFilteredJobs" (which maps to testQueueAndProcessFilteredJobs) so each t.Run subtest has a unique, descriptive name and can be selected independently via `go test -run`.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestUp_20220524102918(t *testing.T) {
teamID, err := res.LastInsertId()
require.NoError(t, err)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 policyID is captured from the teams INSERT result, not the policies INSERT result

In TestUp_20220524102918, changed _, err = db.Exec(...) to res, err = db.Exec(...) for the INSERT INTO policies statement, so that the subsequent policyID, err := res.LastInsertId() correctly captures the LastInsertId from the policies insert rather than the stale res from the earlier teams insert.

πŸ€– Prompt for AI agents
In server/datastore/mysql/migrations/tables/20220524102918_CleanupOrphanedPolicyMemberships_test.go around line 18, review and complete this code-review fix: policyID is captured from the teams INSERT result, not the policies INSERT result.
What the draft fix changed: In TestUp_20220524102918, changed `_, err = db.Exec(...)` to `res, err = db.Exec(...)` for the `INSERT INTO policies` statement, so that the subsequent `policyID, err := res.LastInsertId()` correctly captures the LastInsertId from the policies insert rather than the stale `res` from the earlier teams insert.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer


_, err = db.Exec(`
res, err = db.Exec(`
INSERT INTO policies (name, query, description, team_id)
VALUES ('test_policy', "", "", ?)
`, teamID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ func init() {
}

func Up_20240829170023(tx *sql.Tx) error {
// Idempotent migration.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 πŸ”΅ Duplicated/redundant comment line in VPP token teams migration

Removed the duplicated // Idempotent migration. comment line in Up_20240829170023, leaving a single instance directly above the tx.Exec CREATE TABLE call, matching the suggested fix exactly.

πŸ€– Prompt for AI agents
In server/datastore/mysql/migrations/tables/20240829170023_CreateVPPTokenTeamsJoinTable.go around line 13, review and complete this code-review fix: Duplicated/redundant comment line in VPP token teams migration.
What the draft fix changed: Removed the duplicated `// Idempotent migration.` comment line in `Up_20240829170023`, leaving a single instance directly above the `tx.Exec` CREATE TABLE call, matching the suggested fix exactly.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

// Idempotent migration.
_, err := tx.Exec(`
CREATE TABLE IF NOT EXISTS vpp_token_teams (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
)

func init() {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 🟠 Migration file name/date mismatch and reused function-name suffix diverges from filename timestamp

Renamed Up_20241126140021/Down_20241126140021 to Up_20241210140021/Down_20241210140021 in the init() registration call and their function definitions, so the migration version registered in MigrationClient.AddMigration matches the filename timestamp 20241210140021. This assumes 20241210140021 is the intended/correct migration version (matching the filename), which is the safer choice since renaming the file could conflict with existing git history/PR references; if the migration was already applied in any environment under the old function-name version, this would need a corresponding coordinated fix, which is not visible from this single file.

πŸ€– Prompt for AI agents
In server/datastore/mysql/migrations/tables/20241210140021_AddErrorsToCronStatsTable.go around line 8, review and complete this code-review fix: Migration file name/date mismatch and reused function-name suffix diverges from filename timestamp.
What the draft fix changed: Renamed `Up_20241126140021`/`Down_20241126140021` to `Up_20241210140021`/`Down_20241210140021` in the `init()` registration call and their function definitions, so the migration version registered in `MigrationClient.AddMigration` matches the filename timestamp `20241210140021`. This assumes 20241210140021 is the intended/correct migration version (matching the filename), which is the safer choice since renaming the file could conflict with existing git history/PR references; if the migration was already applied in any environment under the old function-name version, this would need a corresponding coordinated fix, which is not visible from this single file.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 90 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

MigrationClient.AddMigration(Up_20241126140021, Down_20241126140021)
MigrationClient.AddMigration(Up_20241210140021, Down_20241210140021)
}

func Up_20241126140021(tx *sql.Tx) error {
func Up_20241210140021(tx *sql.Tx) error {
// Idempotent migration.
// Add columns
if !columnExists(tx, "cron_stats", "errors") {
Expand All @@ -21,6 +21,6 @@ func Up_20241126140021(tx *sql.Tx) error {
return nil
}

func Down_20241126140021(tx *sql.Tx) error {
func Down_20241210140021(tx *sql.Tx) error {
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func Up_20251028140000(tx *sql.Tx) error {
FROM kernel_host_counts khc
JOIN software_cve sc ON sc.software_id = khc.software_id
WHERE khc.hosts_count > 0
GROUP BY khc.team_id, khc.os_version_id, sc.cve, khc.team_id
GROUP BY khc.team_id, khc.os_version_id, sc.cve
ON DUPLICATE KEY UPDATE
source = VALUES(source),
resolved_in_version = VALUES(resolved_in_version),
Comment on lines 61 to 67

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 πŸ”΅ Redundant duplicate column in GROUP BY clause

Removed the duplicate khc.team_id from the GROUP BY clause in the per-team backfill INSERT statement inside Up_20251028140000, changing GROUP BY khc.team_id, khc.os_version_id, sc.cve, khc.team_id to GROUP BY khc.team_id, khc.os_version_id, sc.cve. This is a purely textual, semantically-neutral cleanup as suggested in the finding.

πŸ€– Prompt for AI agents
In server/datastore/mysql/migrations/tables/20251028140000_CreateTableOSVersionVulnerabilities.go around line 68, review and complete this code-review fix: Redundant duplicate column in GROUP BY clause.
What the draft fix changed: Removed the duplicate `khc.team_id` from the `GROUP BY` clause in the per-team backfill INSERT statement inside `Up_20251028140000`, changing `GROUP BY khc.team_id, khc.os_version_id, sc.cve, khc.team_id` to `GROUP BY khc.team_id, khc.os_version_id, sc.cve`. This is a purely textual, semantically-neutral cleanup as suggested in the finding.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func init() {
MigrationClient.AddMigration(Up_20260518194422, Down_20260518194422)
}

// Up_20260514220719 adds the encoding_type column that discriminates between

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🦩 πŸ”΅ Migration function doc comment references wrong migration ID (copy-paste artifact)

Changed the doc comment above Up_20260518194422 from "Up_20260514220719 adds the encoding_type column..." to "Up_20260518194422 adds the encoding_type column...", correcting the copy-paste artifact so the comment references the correct migration function/ID it documents.

πŸ€– Prompt for AI agents
In server/datastore/mysql/migrations/tables/20260518194422_AddEncodingTypeToHostSCDData.go around line 12, review and complete this code-review fix: Migration function doc comment references wrong migration ID (copy-paste artifact).
What the draft fix changed: Changed the doc comment above Up_20260518194422 from "Up_20260514220719 adds the encoding_type column..." to "Up_20260518194422 adds the encoding_type column...", correcting the copy-paste artifact so the comment references the correct migration function/ID it documents.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

// Up_20260518194422 adds the encoding_type column that discriminates between
// the legacy dense bitmap format (encoding_type = 0) and the new roaring
// bitmap format (encoding_type = 1). ALGORITHM=INSTANT is a metadata-only
// change on MySQL 8.0+; existing rows are not rewritten and read back with
Expand All @@ -32,3 +32,4 @@ func Up_20260518194422(tx *sql.Tx) error {
func Down_20260518194422(tx *sql.Tx) error {
return nil
}

Loading