Feature flag clean up - #15724
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1a6a8b36-7e4a-47d4-a954-c9adae92e08e
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1a6a8b36-7e4a-47d4-a954-c9adae92e08e
Contributor
There was a problem hiding this comment.
Pull request overview
Applies the default three-day cooldown when jobs omit cooldown configuration while preserving opt-outs and security-update bypasses.
Changes:
- Makes
Job#cooldownalways return cooldown options. - Simplifies cooldown telemetry handling.
- Updates tests for default propagation.
Show a summary per file
| File | Description |
|---|---|
updater/lib/dependabot/job.rb |
Builds default cooldown options. |
updater/lib/dependabot/api_client.rb |
Removes obsolete nullable cooldown handling. |
updater/spec/dependabot/job_spec.rb |
Tests implicit cooldown defaults. |
updater/spec/dependabot/api_client_spec.rb |
Updates telemetry nil-case terminology. |
updater/spec/dependabot/updater_spec.rb |
Expects default cooldown propagation. |
updater/spec/dependabot/updater/operations/update_all_versions_spec.rb |
Tests defaults and security bypass behavior. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Medium
kbukum1
previously approved these changes
Jul 30, 2026
The current Dependabot CLI does not implement the hosted record_cooldown_meta endpoint and panics on the unknown output. Keep the default cooldown behavior for CLI jobs while suppressing only the unsupported telemetry request. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51c6fdf3-5ff0-4002-8ab3-b5e86ba6b2ac
Contributor
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (4)
updater/lib/dependabot/job.rb:701
build_cooldownreturns aReleaseCooldownOptionsinitialized with onlydefault_dayswhen cooldown is not configured, but elsewhere (e.g., telemetry) the code readssemver_major_days/minor_days/patch_days. To avoid relying on implicit defaults insideReleaseCooldownOptions, initialize the object with all cooldown periods set todefault_cooldown_days(default/major/minor/patch) when no cooldown config is provided.
unless cooldown
return Dependabot::Package::ReleaseCooldownOptions.new(
default_days: default_cooldown_days
)
end
updater/lib/dependabot/job.rb:42
- This comment is now misleading: the code applies a default cooldown even when the entire cooldown block is not configured (not only when
default-daysis missing). Update the comment to reflect that the default applies when cooldown is absent and/or whendefault-daysis not set.
# Default cooldown period (in days) applied when `default-days` is not configured.
updater/lib/dependabot/api_client.rb:345
- The string literal
\"cli\"is a magic value controlling telemetry behavior. Consider extracting it into a named constant (e.g.,CLI_JOB_ID) or a predicate method (e.g.,cli_mode?) to make the intent clearer and reduce the risk of mismatches if the identifier ever changes.
# The CLI's local API does not implement this hosted-service telemetry endpoint.
return if job.nil? || job_id == "cli"
updater/spec/dependabot/updater/operations/update_all_versions_spec.rb:396
- This new spec only asserts
default_days, but the behavior change (andjob_spec) implies all cooldown periods default (major/minor/patch too). Strengthen the assertion to also checksemver_major_days,semver_minor_days, andsemver_patch_daysso the test will catch regressions where onlydefault_daysis set.
expect(stub_update_checker_class).to have_received(:new).with(
hash_including(
update_cooldown: having_attributes(default_days: Dependabot::Job::DEFAULT_COOLDOWN_DAYS)
)
)
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Low
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1a6a8b36-7e4a-47d4-a954-c9adae92e08e
Contributor
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (5)
updater/lib/dependabot/job.rb:1
- In the
cooldown-nil path, onlydefault_daysis set, but downstream code (e.g., telemetry payload) readssemver_major_days/minor_days/patch_dayswithout nil-handling. To avoid inconsistent defaults between the nil and configured paths, initialize the options with all cooldown periods (default + semver-specific) or centralize construction so both paths produce fully-populatedReleaseCooldownOptions.
updater/spec/dependabot/updater_spec.rb:1 - The helper currently uses a parameter named
update_cooldownbut maps it tocooldown:when building the job, which is confusing and easy to misuse. Consider renaming the helper argument tocooldown(orcooldown_definition) and defaulting it tonilso tests that don’t care about cooldown exercise the real defaulting behavior; tests that need deterministic behavior can explicitly pass{ \"default-days\" => 0 }.
updater/spec/dependabot/updater_spec.rb:1 - The helper currently uses a parameter named
update_cooldownbut maps it tocooldown:when building the job, which is confusing and easy to misuse. Consider renaming the helper argument tocooldown(orcooldown_definition) and defaulting it tonilso tests that don’t care about cooldown exercise the real defaulting behavior; tests that need deterministic behavior can explicitly pass{ \"default-days\" => 0 }.
updater/spec/dependabot/updater_spec.rb:1 - Hard-coding
default_days: 0here couples the spec to a specific fixture/helper default and can conflict with the newly introduced default cooldown behavior (DEFAULT_COOLDOWN_DAYS). If the intent is merely to assert that a cooldown object is passed, prefer matching the type/shape (e.g.,an_instance_of(...)orhaving_attributes(default_days: Dependabot::Job::DEFAULT_COOLDOWN_DAYS)depending on scenario) rather than a specific numeric value.
updater/lib/dependabot/api_client.rb:1 - Using the magic string
\"cli\"as a sentinel for disabling hosted telemetry makes this behavior implicit and harder to maintain. Consider introducing an explicit constructor flag (e.g.,hosted_telemetry: false) or a predicate (e.g.,cli_mode?) and reusing it here, so the decision isn’t tied to a particularjob_idvalue.
- Files reviewed: 65/65 changed files
- Comments generated: 0 new
- Review effort level: Low
Remove unnecessary check for job_id in record_cooldown_meta method.
Contributor
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (5)
updater/lib/dependabot/api_client.rb:1
record_cooldown_metano longer has a guard to prevent sending hosted-service telemetry when running via the Dependabot CLI, but the updated spec expects no request forupdate_job_id/job id\"cli\". Add an explicit early-return (or predicate) to skiprecord_cooldown_metawhen the client is instantiated for CLI runs (e.g., when the update job id is\"cli\", or when a dedicatedhosted?/telemetry_enabled?flag is false).
updater/lib/dependabot/api_client.rb:1record_cooldown_metano longer has a guard to prevent sending hosted-service telemetry when running via the Dependabot CLI, but the updated spec expects no request forupdate_job_id/job id\"cli\". Add an explicit early-return (or predicate) to skiprecord_cooldown_metawhen the client is instantiated for CLI runs (e.g., when the update job id is\"cli\", or when a dedicatedhosted?/telemetry_enabled?flag is false).
updater/lib/dependabot/job.rb:1- When cooldown is not configured,
build_cooldownconstructsReleaseCooldownOptionswith onlydefault_days. However, the updatedjob_specasserts thatsemver_major_days,semver_minor_days, andsemver_patch_daysalso default toDEFAULT_COOLDOWN_DAYS. Update the non-configured branch to populate those semver fields explicitly (or construct via the sameto_optionspathway) so the object is fully defaulted and consistent with expectations.
updater/spec/dependabot/updater_spec.rb:1 - The helper parameter is named
update_cooldownbut is passed intoDependabot::Jobascooldown. Renaming the parameter tocooldown(and adjusting call sites) would make the helper align withDependabot::Job’s API and reduce confusion betweencooldownvsupdate_cooldownterminology.
updater/spec/dependabot/updater_spec.rb:1 - The helper parameter is named
update_cooldownbut is passed intoDependabot::Jobascooldown. Renaming the parameter tocooldown(and adjusting call sites) would make the helper align withDependabot::Job’s API and reduce confusion betweencooldownvsupdate_cooldownterminology.
- Files reviewed: 65/65 changed files
- Comments generated: 0 new
- Review effort level: Low
Contributor
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (4)
updater/lib/dependabot/api_client.rb:1
- The new spec expects
record_cooldown_metato not send hosted-service telemetry when running via the CLI, but the implementation now only skips whenjobis nil. As written, a CLI-initialized client will still POST cooldown telemetry whenever a job is present. Add an explicit guard for the CLI case (e.g., based on the update job id / mode passed into the client) sorecord_cooldown_metabecomes a no-op for CLI runs.
updater/lib/dependabot/job.rb:1 - When cooldown is not configured,
build_cooldownonly setsdefault_daysand relies onReleaseCooldownOptionsto implicitly populatesemver_*_days. Given the specs assert all semver cooldown periods default toDEFAULT_COOLDOWN_DAYS, it's more robust to setsemver_major_days,semver_minor_days, andsemver_patch_daysexplicitly here (or centralize the defaulting insideReleaseCooldownOptions) to avoid coupling to initializer defaults.
updater/spec/dependabot/updater_spec.rb:1 - In this helper, the keyword argument is named
update_cooldownbut it is passed through ascooldown:. Renaming the helper parameter tocooldown(orcooldown_definition) would make the intent clearer and reduce confusion now that the production attribute iscooldownrather thanupdate_cooldown.
updater/spec/dependabot/updater_spec.rb:1 - In this helper, the keyword argument is named
update_cooldownbut it is passed through ascooldown:. Renaming the helper parameter tocooldown(orcooldown_definition) would make the intent clearer and reduce confusion now that the production attribute iscooldownrather thanupdate_cooldown.
- Files reviewed: 65/65 changed files
- Comments generated: 0 new
- Review effort level: Low
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1a6a8b36-7e4a-47d4-a954-c9adae92e08e
Copilot stopped reviewing on behalf of
v-robaiken due to an error
July 30, 2026 16:55
Contributor
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (3)
updater/lib/dependabot/job.rb:1
- When cooldown is not configured, this builds
ReleaseCooldownOptionswith onlydefault_daysset. That makes the behavior ofsemver_major_days/minor_days/patch_daysdepend onReleaseCooldownOptions' internal defaults, which is less explicit and can be brittle if that class changes. Consider initializing all cooldown periods here (default + semver major/minor/patch) todefault_cooldown_daysso the fallback behavior is fully defined inJob.
updater/spec/dependabot/updater_spec.rb:1 - The helper argument is named
update_cooldown, but the production attribute appears to becooldown(and the helper later passes it ascooldown:). Renaming this helper parameter tocooldown(and updating call sites) would reduce confusion and better align with the rest of the codebase terminology.
updater/lib/dependabot/api_client.rb:1 - Using the magic string
\"cli\"as a sentinel for skipping telemetry makes this behavior harder to discover and easier to break if the identifier changes. Consider extracting this into a constant (e.g.,CLI_JOB_ID = \"cli\") or a predicate (e.g.,cli?) so the decision is centralized and self-documenting.
- Files reviewed: 65/65 changed files
- Comments generated: 0 new
- Review effort level: Low
kbukum1
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are you trying to accomplish?
Make the documented three-day cooldown apply when a version-update job has no
cooldownblock. Currently,Job#build_cooldownreturnsnilfor an absent block, so update checkers receive no cooldown and can select releases published less than three days ago.This change constructs the default three-day cooldown when configuration is absent, while preserving an explicit
default-days: 0opt-out and the existing security-update bypass. It also removes obsolete nil handling from cooldown telemetry now that version-update jobs always have effective cooldown options.Anything you want to highlight for special attention from reviewers?
The default is applied in Core rather than synthesizing a
cooldownblock in the API job payload. This keeps explicit configuration parsing unchanged and ensures CLI/local jobs receive the same default behavior. Security update paths continue passingnilto update checkers, so security fixes are not delayed.How will you know you've accomplished your goal?
Checklist