Skip to content

[Updater] Remove job_id from the Service/ApiClient's method signatures#6770

Merged
brrygrdn merged 6 commits intomainfrom
brrygrdn/remove-job-id-from-client-methods
Mar 6, 2023
Merged

[Updater] Remove job_id from the Service/ApiClient's method signatures#6770
brrygrdn merged 6 commits intomainfrom
brrygrdn/remove-job-id-from-client-methods

Conversation

@brrygrdn
Copy link
Copy Markdown
Contributor

@brrygrdn brrygrdn commented Mar 2, 2023

I'm in the process of rewriting the Service/ApiClient's methods to accept a value class rather than a set of arguments so it is easier to slot in a "GroupRule" as a new optional argument without having to modify the whole way up and down the call chain as I iterate on it.

Unfortunately, this means modifying the whole way up and down the call chain one last time! 😅

Since I'm doing this, I'm going to cross off a bit of technical debt - we currently instantiate the ApiClient with the Job's token, but then pass the Job's ID on every method call.

This makes our stubbing and method signatures very verbose and since a token is scoped to a Job ID, it creates the impression the client could be used to reach across jobs within a single context when it can't.

Let's clean this up and consolidate the id/token as a matched credential pair.

Rationale

This is a noisy change so I've pulled it out as a separate PR to fly ahead of the rest of my changes to make it easier to review/test in isolation.

Other changes

As part of this, I've made the opinionated change to rename token to job_token just to avoid confusion between it and any of the credentials we handle in some places.

@brrygrdn
Copy link
Copy Markdown
Contributor Author

brrygrdn commented Mar 2, 2023

Glad to have the smoke tests as they seem to indicate I've missed a few touch points

@brrygrdn brrygrdn force-pushed the brrygrdn/deprecate-end-to-end-cmd branch from 5075f07 to 32f40a5 Compare March 3, 2023 11:17
@brrygrdn brrygrdn force-pushed the brrygrdn/remove-job-id-from-client-methods branch 2 times, most recently from 90d1815 to 83beb94 Compare March 3, 2023 14:04
Base automatically changed from brrygrdn/deprecate-end-to-end-cmd to main March 3, 2023 15:32
@brrygrdn brrygrdn marked this pull request as ready for review March 3, 2023 15:33
@brrygrdn brrygrdn requested a review from a team as a code owner March 3, 2023 15:33
Copy link
Copy Markdown
Contributor

@landongrindheim landongrindheim left a comment

Choose a reason for hiding this comment

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

This makes a lot of sense to me. Great job 🥇

Comment on lines +7 to +16
# Describes a single Dependabot workload within the GitHub-integrated Service
#
# This primarily acts as a value class to hold inputs for various Core objects
# and is an approximate data structure for the 'job description file' used by
# the CLI tool.
#
# See: https://github.com/dependabot/cli#job-description-file
#
# This class should evenually be promoted to common/lib and augmented to
# validate job description files.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm appreciating these class-level comments 😄

@brrygrdn brrygrdn force-pushed the brrygrdn/remove-job-id-from-client-methods branch from 83beb94 to e2c8f85 Compare March 6, 2023 13:33
@brrygrdn brrygrdn merged commit d4d6719 into main Mar 6, 2023
@brrygrdn brrygrdn deleted the brrygrdn/remove-job-id-from-client-methods branch March 6, 2023 14:47
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.

2 participants