-
Notifications
You must be signed in to change notification settings - Fork 1
fix(adhoc-sweep-fixes): CU-86akj32d7 60 review findings across 40 files #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d5e82fd
414a3a1
aa408be
bacf53a
286bde0
94a2212
31faecd
8d9d981
4495899
31d568f
60a18e5
6a9255e
eb9e715
c35d992
cec4ffc
dba4e24
421b682
5f02562
8da2947
f56465f
b75a9b8
fe88ceb
41ba396
f22fa04
11a4a23
270eb8a
3375f77
c3fcb76
1f79c0f
0541ce4
dfeff80
8222f0a
e82bd17
70fce18
688ac1f
2025adb
68555ca
29650b1
6d3e3da
51dd6a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,7 +175,7 @@ def req(method: :get, path: '', body: nil, headers: {}, cached: false, environme | |
| end | ||
| end | ||
| rescue => e | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π FleetClient#req swallows exceptions into a non-string 'error' field, poisoning downstream string operations In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| out['error'] = e | ||
| out['error'] = e.message | ||
| end | ||
|
|
||
| out | ||
|
|
@@ -196,7 +196,7 @@ def parse_response(response) | |
| message = 'server returned a non-ok status code without an error' | ||
|
|
||
| if response.body | ||
| body = JSON.parse(response.body) | ||
| body = out['body'] | ||
| message = body['message'] | ||
|
|
||
| unless body['errors'].nil? | ||
|
Comment on lines
196
to
202
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π parse_response re-parses response.body a second time redundantly and can raise on malformed JSON already parsed above In π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -290,6 +290,8 @@ const SelectTargets = ({ | |
| // this effect every render, which dispatches a context update and causes an | ||
| // infinite render loop ("Maximum update depth exceeded"), freezing the | ||
| // Select targets UI (e.g. the X to remove a host stops responding). | ||
| // TODO: memoize `setSelectedTargets` at its source in QueryContext so this | ||
| // effect can safely include it in its dependency array. | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [targetedHosts, targetedLabels, targetedTeams]); | ||
|
|
||
|
Comment on lines
290
to
297
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π useEffect dependency array intentionally omits setSelectedTargets, masking a real stale-closure risk The underlying fix (memoizing π€ Prompt for AI agentsfix confidence: π΄ 25 low β review closely β react π/π to teach the reviewer |
||
|
|
@@ -318,7 +320,9 @@ const SelectTargets = ({ | |
| // if the target was previously selected, we want to remove it now | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π handleButtonSelect uses non-short-circuited boolean expression as a statement for side effect (push), relying on eslint suppression pattern implicitly In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| let newTargets = prevTargets.filter((t) => t.id !== selectedEntity.id); | ||
| // if the length remains the same, the target was not previously selected so we want to add it now | ||
| prevTargets.length === newTargets.length && newTargets.push(selectedEntity); | ||
| if (prevTargets.length === newTargets.length) { | ||
| newTargets.push(selectedEntity); | ||
| } | ||
|
|
||
| // Logic when to deselect/select "all hosts" when using more granulated filters | ||
| // If "all hosts" is selected | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,7 +97,7 @@ const Software = ({ | |
| data={(isSoftwareEnabled && software?.software) || []} | ||
| isLoading={isSoftwareFetching} | ||
| pageIndex={softwarePageIndex} | ||
| defaultSortHeader={SOFTWARE_DEFAULT_SORT_DIRECTION} | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π SoftwareTableConfig 'All' tab sort direction uses wrong constant for sort header Changed π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| defaultSortHeader={SOFTWARE_DEFAULT_SORT_HEADER} | ||
| defaultSortDirection={SOFTWARE_DEFAULT_SORT_DIRECTION} | ||
| resultsTitle="software" | ||
| emptyComponent={() => <EmptySoftwareTable />} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,7 +94,7 @@ const generateGenericLearnMoreErrMsg = (errMsg: string) => { | |
| */ | ||
| // eslint-disable-next-line import/prefer-default-export | ||
| export const getErrorMessage = (err: AxiosResponse<IApiError>) => { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π getErrorMessage in AddProfileModal helpers.tsx crashes on undefined apiReason In π€ Prompt for AI agentsfix confidence: π’ 92 high β react π/π to teach the reviewer |
||
| const apiReason = err?.data?.errors?.[0]?.reason; | ||
| const apiReason = err?.data?.errors?.[0]?.reason ?? ""; | ||
|
|
||
| if (apiReason.includes("should include valid JSON")) { | ||
| return "Couldn't add. The profile should include valid JSON."; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,7 +178,7 @@ const SoftwareVulnerabilities = ({ | |
| }; | ||
|
|
||
| // Handle 400 response which is an invalid CVE format | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π AxiosError status check uses non-existent 'status' property instead of 'response.status' In the π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| if (error.status === 400) { | ||
| if (error.response?.status === 400) { | ||
| if ( | ||
| error?.data?.errors && | ||
| error.data.errors[0].reason.includes( | ||
|
|
@@ -198,7 +198,7 @@ const SoftwareVulnerabilities = ({ | |
| } | ||
|
|
||
| // Handle 404 response which is BE validated CVE string but not a known CVE | ||
| } else if (error.status === 404) { | ||
| } else if (error.response?.status === 404) { | ||
| if ( | ||
| error?.data?.errors && | ||
| (error.data.errors[0].reason.includes("This is not a known CVE.") || | ||
|
|
@@ -234,7 +234,7 @@ const SoftwareVulnerabilities = ({ | |
| if (isExactMatchQuery) { | ||
| refetchExactMatch(); | ||
| } | ||
| }, [queryParams.exploit, isExactMatchQuery]); | ||
| }, [queryParams.exploit, isExactMatchQuery, refetchExactMatch]); | ||
|
|
||
| // !tableData is used to show the Spinner only on the first render. | ||
| // This prevents the Spinner from flashing on every data refresh, noticable | ||
|
Comment on lines
234
to
240
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π useEffect refetch dependency omits refetchExactMatch, risking stale closure Added π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ export const generateGroupsValues = (endUsers: IHostEndUser[]) => { | |
| return []; | ||
| } | ||
|
|
||
| return endUser.idp_groups.sort((a, b) => { | ||
| return [...endUser.idp_groups].sort((a, b) => { | ||
| return a.localeCompare(b); | ||
| }); | ||
| }; | ||
|
Comment on lines
38
to
44
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π generateGroupsValues mutates the caller's idp_groups array via in-place sort() In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -106,3 +106,4 @@ export const generateGroupsTipContent = (endUsers: IHostEndUser[]) => { | |
|
|
||
| return null; | ||
| }; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,4 +4,4 @@ data "aws_secretsmanager_secret" "license" { | |
|
|
||
| data "aws_secretsmanager_secret_version" "enroll_secret" { | ||
| secret_id = data.terraform_remote_state.shared.outputs.enroll_secret.id | ||
| } | ||
| } | ||
|
Comment on lines
4
to
+7
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ Unauthenticated /fleet/license secret in loadtesting Terraform is fetched but license value is not gated No code change made in secrets.tf for the license secret path itself. Scoping the secret name by environment/workspace (e.g. "/fleet/license-${terraform.workspace}") would require that such per-environment secrets actually exist in AWS Secrets Manager, which cannot be verified or created from this file alone β inventing a naming convention without confirming the corresponding secrets exist in AWS would break π€ Prompt for AI agentsfix confidence: π΄ 20 low β review closely β react π/π to teach the reviewer |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,7 +232,7 @@ func parseAppSSOPlatformCommandOutput(output []byte, expectedExtensionIdentifier | |
| } | ||
| realm, ok := realm_.(string) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Incorrect %T format verb used on wrong variable in error message In parseAppSSOPlatformCommandOutput, changed the π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| if !ok { | ||
| return nil, fmt.Errorf("unexpected type for \"realm\" key in \"kerberosStatus\": %T", err) | ||
| return nil, fmt.Errorf("unexpected type for \"realm\" key in \"kerberosStatus\": %T", realm_) | ||
| } | ||
| upn_, ok := userConfig.KerberosStatus[0]["upn"] | ||
| if !ok { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,7 +119,8 @@ func (i *SoftwareInstallerStore) Cleanup(ctx context.Context, usedInstallerIDs [ | |
|
|
||
| info, err := de.Info() | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ SoftwareInstallerStore.Cleanup swallows per-entry stat errors as fatal instead of collecting them In SoftwareInstallerStore.Cleanup, the π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| if err != nil { | ||
| return 0, ctxerr.Wrap(ctx, err, "get software installer modtime in filesystem store") | ||
| errs = append(errs, err) | ||
| continue | ||
| } | ||
| if info.ModTime().After(removeCreatedBefore) { | ||
| continue | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,6 +93,7 @@ func (ds *Datastore) LoadHostConditionalAccessStatus(ctx context.Context, hostID | |
| if errors.Is(err, sql.ErrNoRows) { | ||
| return nil, ctxerr.Wrap(ctx, notFound("HostConditionalAccessStatus").WithID(hostID)) | ||
| } | ||
| return nil, ctxerr.Wrap(ctx, err, "getting host conditional access status") | ||
| } | ||
| hostConditionalAccessStatus.OSVersion = strings.TrimPrefix(hostConditionalAccessStatus.OSVersion, "macOS ") | ||
| if strings.HasPrefix(hostConditionalAccessStatus.OSVersion, "Windows") { | ||
|
Comment on lines
93
to
99
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π GetCertificateTemplateByIdForHost swallows errors on ambiguous status branch, leaving stale challenge fields on retrieval failure path In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,12 +19,12 @@ import ( | |
|
|
||
| func (ds *Datastore) GetHostIdentityCertBySerialNumber(ctx context.Context, serialNumber uint64) (*types.HostIdentityCertificate, error) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Serial number interpolated directly into SQL string via fmt.Sprintf instead of a bind parameter In GetHostIdentityCertBySerialNumber, replaced the fmt.Sprintf-built query embedding serialNumber directly into the SQL text with a parameterized query using a π€ Prompt for AI agentsfix confidence: π’ 98 high β react π/π to teach the reviewer |
||
| var hostIdentityCert types.HostIdentityCertificate | ||
| err := sqlx.GetContext(ctx, ds.reader(ctx), &hostIdentityCert, fmt.Sprintf(` | ||
| err := sqlx.GetContext(ctx, ds.reader(ctx), &hostIdentityCert, ` | ||
| SELECT serial, host_id, name, not_valid_after, public_key_raw | ||
| FROM host_identity_scep_certificates | ||
| WHERE serial = %d | ||
| WHERE serial = ? | ||
| AND not_valid_after > NOW() | ||
| AND revoked = 0`, serialNumber)) | ||
| AND revoked = 0`, serialNumber) | ||
| switch { | ||
| case errors.Is(err, sql.ErrNoRows): | ||
| return nil, notFound("host identity certificate") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,9 +94,13 @@ func updateCertAssociationTimestamps(txx *sqlx.Tx, limit, offset int) error { | |
| expiries := make(map[string]time.Time, len(scepCerts)) | ||
| for i, rawCert := range scepCerts { | ||
| block, _ := pem.Decode(rawCert.CertificatePEM) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ pem.Decode result unchecked before dereferencing block.Bytes β nil pointer panic risk In updateCertAssociationTimestamps (loop over scepCerts), added a nil check on π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| if block == nil { | ||
| log.Printf("failed to decode PEM for certificate with serial %s", rawCert.Serial) | ||
| continue | ||
| } | ||
| cert, err := x509.ParseCertificate(block.Bytes) | ||
| if err != nil { | ||
| log.Printf("failed to parse certificate with serial %s", rawCert.Serial) | ||
| log.Printf("failed to parse certificate with serial %s: %v", rawCert.Serial, err) | ||
| continue | ||
| } | ||
|
|
||
|
Comment on lines
94
to
106
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π log.Printf swallows cert parse error without returning or wrapping it In updateCertAssociationTimestamps, the π€ Prompt for AI agentsfix confidence: π΄ 55 low β review closely β react π/π to teach the reviewer |
||
|
|
@@ -123,6 +127,10 @@ func updateCertAssociationTimestamps(txx *sqlx.Tx, limit, offset int) error { | |
| return fmt.Errorf("failed to retrieve cert associations: %w", err) | ||
| } | ||
|
|
||
| if len(assocs) == 0 { | ||
| return nil | ||
| } | ||
|
|
||
| var sb strings.Builder | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π INSERT built from possibly-empty assocs slice produces invalid SQL when no associations match In updateCertAssociationTimestamps, added an early π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| updateAssocArgs := make([]any, len(assocs)*3) | ||
| for i, assoc := range assocs { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,14 +22,19 @@ func Up_20240314085226(tx *sql.Tx) error { | |
| event JSON NOT NULL, | ||
|
|
||
| created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| updated_at TIMESTAMP NOT NULL NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΅ Redundant NOT NULL NULL in updated_at column definition In Up_20240314085226, removed the redundant "NULL" from π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
|
|
||
| UNIQUE KEY idx_one_calendar_event_per_email (email) | ||
| ) DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; | ||
| `); err != nil { | ||
| return fmt.Errorf("create calendar_events table: %w", err) | ||
| } | ||
|
|
||
| // Note: host_id intentionally does not have a foreign key constraint to the | ||
| // hosts table. Hosts can be deleted and re-enrolled (churn/replacement), and | ||
| // host_calendar_events rows referencing a deleted host_id are cleaned up by | ||
| // application logic rather than a DB-level cascade, to avoid tying calendar | ||
| // event bookkeeping lifecycle directly to host deletion. | ||
| if _, err := tx.Exec(` | ||
| CREATE TABLE IF NOT EXISTS host_calendar_events ( | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π host_calendar_events foreign key lacks matching index/foreign key constraint symmetry with calendar_events cascade semantics but no FK on host_id In Up_20240314085226, added a code comment above the host_calendar_events CREATE TABLE explaining that host_id intentionally lacks a foreign key (host churn/replacement pattern). Did not add an actual FK constraint since this migration has already shipped as part of schema history in real deployments; adding an FK here would only affect fresh databases and not existing ones, so a true fix requires a new follow-up migration (not made in this file) that ALTERs the table to add the FK for existing environments. This change only documents intent, per the finding's own suggested alternative. π€ Prompt for AI agentsfix confidence: π΄ 20 low β review closely β react π/π to teach the reviewer |
||
| id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
|
|
@@ -38,7 +43,7 @@ func Up_20240314085226(tx *sql.Tx) error { | |
| webhook_status TINYINT NOT NULL, | ||
|
|
||
| created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| updated_at TIMESTAMP NOT NULL NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΅ Same NOT NULL NULL redundancy repeated in host_calendar_events In Up_20240314085226, removed the redundant "NULL" from the same construct in the host_calendar_events table definition, leaving plain "NOT NULL", fixing the copy-paste artifact at its source in this file. π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
|
|
||
| UNIQUE KEY idx_one_calendar_event_per_host (host_id), | ||
| FOREIGN KEY (calendar_event_id) REFERENCES calendar_events(id) ON DELETE CASCADE | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ func Up_20240826160025(tx *sql.Tx) error { | |
| return fmt.Errorf("failed to find host_software_installs to remove: %w", err) | ||
| } | ||
| if len(ids) > 0 { | ||
| stmt, args, err := sqlx.In("UPDATE host_software_installs SET removed = 1 WHERE id IN (?)", ids) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π sqlx.In-generated UPDATE has a literal tab character between SET clause and WHERE In Up_20240826160025, replaced the literal tab character between "removed = 1" and "WHERE id IN (?)" with a single space in the sqlx.In UPDATE statement for host_software_installs. π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| stmt, args, err := sqlx.In("UPDATE host_software_installs SET removed = 1 WHERE id IN (?)", ids) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to expand slice value for host_software_installs: %w", err) | ||
| } | ||
|
|
@@ -87,7 +87,7 @@ func Up_20240826160025(tx *sql.Tx) error { | |
| return fmt.Errorf("failed to find host_vpp_software_installs to remove: %w", err) | ||
| } | ||
| if len(vppIDs) > 0 { | ||
| stmt, args, err := sqlx.In("UPDATE host_vpp_software_installs SET removed = 1 WHERE id IN (?)", vppIDs) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π sqlx.In-generated UPDATE for VPP installs also has stray tab character In Up_20240826160025, replaced the literal tab character between "removed = 1" and "WHERE id IN (?)" with a single space in the sqlx.In UPDATE statement for host_vpp_software_installs. π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| stmt, args, err := sqlx.In("UPDATE host_vpp_software_installs SET removed = 1 WHERE id IN (?)", vppIDs) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to expand slice value for host_vpp_software_installs: %w", err) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,8 @@ func Up_20241125150614(tx *sql.Tx) error { | |
|
|
||
| mdm, ok := config["mdm"] | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ Missing 'mdm' section in app_config_json errors out the migration instead of applying a safe default In Up_20241125150614, replaced the π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| if !ok { | ||
| return errors.New("missing mdm section") | ||
| mdm = map[string]interface{}{} | ||
| config["mdm"] = mdm | ||
| } | ||
| mdmMap, ok := mdm.(map[string]interface{}) | ||
| if !ok { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,10 +6,10 @@ import ( | |
| ) | ||
|
|
||
| func init() { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Migration function names 20241210140021 file mismatch with filename timestamp Renamed Up_20241126140021/Down_20241126140021 to Up_20241210140021/Down_20241210140021 and updated the init() call to MigrationClient.AddMigration(Up_20241210140021, Down_20241210140021), aligning the migration version with the filename timestamp 20241210140021, eliminating the naming drift and potential duplicate migration ID collision. π€ Prompt for AI agentsfix confidence: π’ 95 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") { | ||
|
|
@@ -21,6 +21,7 @@ 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 |
|---|---|---|
|
|
@@ -54,21 +54,18 @@ func TestUp_20251015103700(t *testing.T) { | |
| var title fleet.SoftwareTitle | ||
| err := db.Get(&title, "SELECT id, name, source, extension_for, application_id, bundle_identifier FROM software_titles WHERE id = ?", tt.titleID) | ||
| require.NoError(t, err) | ||
| switch { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Switch-like if/else chain in test never checks expectedApplicationID nil case correctly In TestUp_20251015103700, replaced the single no-tag π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| case tt.expectedBundleID == nil: | ||
| if tt.expectedBundleID == nil { | ||
| require.Nil(t, title.BundleIdentifier) | ||
|
|
||
| case tt.expectedBundleID != nil: | ||
| } else { | ||
| require.NotNil(t, tt.expectedBundleID) | ||
| assert.Equal(t, *tt.expectedBundleID, *title.BundleIdentifier) | ||
| } | ||
|
|
||
| case tt.expectedApplicationID == nil: | ||
| if tt.expectedApplicationID == nil { | ||
| require.Nil(t, title.ApplicationID) | ||
|
|
||
| case tt.expectedApplicationID != nil: | ||
| } else { | ||
| require.NotNil(t, title.ApplicationID) | ||
| assert.Equal(t, tt.expectedApplicationID, title.ApplicationID) | ||
|
|
||
| } | ||
|
|
||
| var gotUniqueID string | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ func init() { | |
| MigrationClient.AddMigration(Up_20260518194422, Down_20260518194422) | ||
| } | ||
|
|
||
| // Up_20260514220719 adds the encoding_type column that discriminates between | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Migration comment references a mismatched migration ID (copy-paste artifact) Changed the doc comment on π€ Prompt for AI agentsfix confidence: π’ 100 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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,7 +60,7 @@ func incrementalMigrationStep(count getTotalCountFn, execute executeWithProgress | |
|
|
||
| // Every five seconds, echo the % progress of the executor | ||
| // Since we output once the migration step is complete, we need an extra channel to indicate when both the step | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΅ Stray corrupted character in code comment Fixed the corrupted comment text "com0plete" to "complete" in the comment above π€ Prompt for AI agentsfix confidence: π’ 100 high β react π/π to teach the reviewer |
||
| // and the "step complete" output are com0plete | ||
| // and the "step complete" output are complete | ||
| stepComplete := make(chan struct{}) | ||
| outputComplete := make(chan struct{}) | ||
| go func() { | ||
|
|
@@ -83,10 +83,12 @@ func incrementalMigrationStep(count getTotalCountFn, execute executeWithProgress | |
| } | ||
| }() | ||
|
|
||
| err = execute(tx, func() { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Potential goroutine leak / deadlock risk if execute() panics in incrementalMigrationStep In incrementalMigrationStep (server/datastore/mysql/migrations/tables/migration.go), wrapped the π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
| atomicCurrent.Add(1) | ||
| }) | ||
| close(stepComplete) | ||
| func() { | ||
| defer close(stepComplete) | ||
| err = execute(tx, func() { | ||
| atomicCurrent.Add(1) | ||
| }) | ||
| }() | ||
| <-outputComplete // Wait for the goroutine to complete | ||
| return err | ||
| } | ||
|
|
@@ -258,3 +260,4 @@ func updateAppConfigJSON(tx *sql.Tx, fn func(config *fleet.AppConfig) error) err | |
|
|
||
| return nil | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,8 +183,9 @@ func (ds *Datastore) ActivityDetailsForSoftwareTitleIcon(ctx context.Context, te | |
| Exclude bool `db:"exclude"` | ||
| RequireAll bool `db:"require_all"` | ||
| } | ||
| var labels []ActivitySoftwareLabel | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π ActivityDetailsForSoftwareTitleIcon silently drops vpp/in_house label results due to shared 'labels' slice In ActivityDetailsForSoftwareTitleIcon, replaced the single shared π€ Prompt for AI agentsfix confidence: π’ 92 high β react π/π to teach the reviewer |
||
| var allLabels []ActivitySoftwareLabel | ||
| if details.SoftwareInstallerID != nil { | ||
| var labels []ActivitySoftwareLabel | ||
| labelQuery := ` | ||
| SELECT | ||
| labels.id AS id, | ||
|
|
@@ -198,8 +199,10 @@ func (ds *Datastore) ActivityDetailsForSoftwareTitleIcon(ctx context.Context, te | |
| if err := sqlx.SelectContext(ctx, ds.reader(ctx), &labels, labelQuery, details.SoftwareInstallerID); err != nil { | ||
| return fleet.DetailsForSoftwareIconActivity{}, ctxerr.Wrap(ctx, err, "getting labels for software title icon") | ||
| } | ||
| allLabels = append(allLabels, labels...) | ||
| } | ||
| if details.AdamID != nil { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΅ VPPAppTeamID used as query arg while AdamID checked for nil, inconsistent field reference In the same function, the vpp label query branch condition was changed from π€ Prompt for AI agentsfix confidence: π‘ 70 medium β react π/π to teach the reviewer |
||
| if details.AdamID != nil && details.VPPAppTeamID != nil { | ||
| var labels []ActivitySoftwareLabel | ||
| labelQuery := ` | ||
| SELECT | ||
| labels.id AS id, | ||
|
|
@@ -213,8 +216,10 @@ func (ds *Datastore) ActivityDetailsForSoftwareTitleIcon(ctx context.Context, te | |
| if err := sqlx.SelectContext(ctx, ds.reader(ctx), &labels, labelQuery, details.VPPAppTeamID); err != nil { | ||
| return fleet.DetailsForSoftwareIconActivity{}, ctxerr.Wrap(ctx, err, "getting labels for software title icon") | ||
| } | ||
| allLabels = append(allLabels, labels...) | ||
| } | ||
| if details.InHouseAppID != nil { | ||
| var labels []ActivitySoftwareLabel | ||
| labelQuery := ` | ||
| SELECT | ||
| labels.id AS id, | ||
|
|
@@ -228,9 +233,10 @@ func (ds *Datastore) ActivityDetailsForSoftwareTitleIcon(ctx context.Context, te | |
| if err := sqlx.SelectContext(ctx, ds.reader(ctx), &labels, labelQuery, details.InHouseAppID); err != nil { | ||
| return fleet.DetailsForSoftwareIconActivity{}, ctxerr.Wrap(ctx, err, "getting labels for software title icon") | ||
| } | ||
| allLabels = append(allLabels, labels...) | ||
| } | ||
|
|
||
| for _, l := range labels { | ||
| for _, l := range allLabels { | ||
| switch { | ||
| case l.Exclude && !l.RequireAll: | ||
| details.LabelsExcludeAny = append(details.LabelsExcludeAny, fleet.ActivitySoftwareLabel{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,7 +95,8 @@ func TestWritePathInvalidation(t *testing.T) { | |
| ds.UpdateHostRefetchCriticalQueriesUntilFunc = func(_ context.Context, _ uint, _ *time.Time) error { return nil } | ||
| }, | ||
| invoke: func(ctx context.Context, d *Datastore, id uint, _ string) error { | ||
| return d.UpdateHostRefetchCriticalQueriesUntil(ctx, id, new(time.Unix(1, 0))) | ||
| until := time.Unix(1, 0) | ||
| return d.UpdateHostRefetchCriticalQueriesUntil(ctx, id, &until) | ||
| }, | ||
| invoked: func(ds *mock.Store) bool { return ds.UpdateHostRefetchCriticalQueriesUntilFuncInvoked }, | ||
| }, | ||
|
Comment on lines
95
to
102
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ time.Unix(1,0) passed to new() β invalid Go, test will not compile In the π€ Prompt for AI agentsfix confidence: π’ 96 high β react π/π to teach the reviewer |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π CiscoJabberVersionTransformer doc comment states 15.2.0 but code sets 15.2.1
Updated the doc comment above CiscoJabberVersionTransformer in cisco_jabber_version_transformer.go to state "15.2.1" in both sentences, matching the hardcoded
app.Version = "15.2.1"in the function body. No behavioral code changed.π€ Prompt for AI agents
fix confidence: π’ 95 high β react π/π to teach the reviewer