Skip to content

Rename mdm profiles updated_at to uploaded_at and remove automatic setting #16425

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

Merged
merged 11 commits into from
Feb 5, 2024

Conversation

mna
Copy link
Member

@mna mna commented Jan 29, 2024

#16051

Checklist for submitter

  • Changes file added for user-visible changes in changes/ or orbit/changes/.
    See Changes files for more information.
  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements)
  • Added/updated tests
  • If database migrations are included, checked table schema to confirm autoupdate
  • For database migrations:
    • Checked schema for all modified table for columns that will auto-update timestamps during migration.
    • Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects.

UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
Labels []ConfigurationProfileLabel `db:"labels" json:"labels,omitempty"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UploadedAt time.Time `db:"uploaded_at" json:"updated_at"` // TODO: should we update the JSON rendering?
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we should, that would be an API breaking change (documented e.g. here: https://fleetdm.com/docs/rest-api/rest-api#default-response61)

Copy link
Contributor

Choose a reason for hiding this comment

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

100% agree with this, I would just leave a comment so a good intended soul doesn't change it later 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 sounds good, I'll remove the TODO and add that note.

@@ -364,7 +364,7 @@ type MDMConfigProfilePayload struct {
Identifier string `json:"identifier,omitempty" db:"identifier"` // only set for macOS
Checksum []byte `json:"checksum,omitempty" db:"checksum"` // only set for macOS
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
UploadedAt time.Time `json:"updated_at" db:"uploaded_at"` // TODO: should we change the JSON rendering?
Copy link
Member Author

Choose a reason for hiding this comment

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

Same here, would be a breaking change.

@@ -37,7 +37,7 @@ type MDMWindowsConfigProfile struct {
SyncML []byte `db:"syncml" json:"-"`
Labels []ConfigurationProfileLabel `db:"labels" json:"labels,omitempty"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
UploadedAt time.Time `db:"uploaded_at" json:"updated_at"` // TODO: should we update the JSON rendering?
Copy link
Member Author

Choose a reason for hiding this comment

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

Same here, would be a breaking change.

@mna mna marked this pull request as ready for review January 29, 2024 21:59
@mna mna requested a review from a team as a code owner January 29, 2024 21:59
Copy link
Contributor

@roperzh roperzh left a comment

Choose a reason for hiding this comment

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

LGTM, I think the only thing to change would be the addition of the w prefix since that's being worked on separately, but maybe you're chatting with Jahziel about this.

UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
Labels []ConfigurationProfileLabel `db:"labels" json:"labels,omitempty"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UploadedAt time.Time `db:"uploaded_at" json:"updated_at"` // TODO: should we update the JSON rendering?
Copy link
Contributor

Choose a reason for hiding this comment

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

100% agree with this, I would just leave a comment so a good intended soul doesn't change it later 😅

Copy link

codecov bot commented Jan 30, 2024

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (9069850) 65.61% compared to head (8985c3c) 65.46%.

Files Patch % Lines
.../tables/20240205095928_AddMdmProfilesUploadedAt.go 66.66% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16425      +/-   ##
==========================================
- Coverage   65.61%   65.46%   -0.15%     
==========================================
  Files        1133     1135       +2     
  Lines       99105    99325     +220     
  Branches     2448     2448              
==========================================
- Hits        65030    65026       -4     
- Misses      29196    29402     +206     
- Partials     4879     4897      +18     
Flag Coverage Δ
backend 66.52% <86.66%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

roperzh
roperzh previously approved these changes Jan 30, 2024
Copy link
Contributor

@roperzh roperzh left a comment

Choose a reason for hiding this comment

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

@mna
Copy link
Member Author

mna commented Feb 5, 2024

The Go test failure is network-related, unrelated to the changes. It could take a while to resolve given we ping an external server, I'll retry once and merge anyway if that's the only failure:

=== RUN   TestVulnerabilityDataStream
    nettest.go:33: network test start: TestVulnerabilityDataStream
    vulnerability_data_stream_test.go:41: 
        	Error Trace:	/home/runner/work/fleet/fleet/cmd/fleetctl/vulnerability_data_stream_test.go:41
        	Error:      	Received unexpected error:
        	            	bzip2 data invalid: bad magic value
        	Test:       	TestVulnerabilityDataStream
    nettest.go:36: network test done: TestVulnerabilityDataStream
--- FAIL: TestVulnerabilityDataStream (96.34s)

@mna mna merged commit 9abb572 into main Feb 5, 2024
@mna mna deleted the mna-16051-mdm-profiles-uploaded-at branch February 5, 2024 15:01
@lukeheath lukeheath added this to the 4.44.1 milestone Feb 13, 2024
@lukeheath lukeheath removed this from the 4.44.1 milestone Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants