Skip to content

(CAT-2946) Fix the Puppet 8 nightly raising puppet floor to 8.17 - #403

Closed
gavindidrichsen wants to merge 10 commits into
mainfrom
fix-puppet8-floor-multi-json
Closed

gavindidrichsen wants to merge 10 commits into
mainfrom
fix-puppet8-floor-multi-json

Conversation

@gavindidrichsen

@gavindidrichsen gavindidrichsen commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the nightly spec (ruby 3.2 | puppet ~> 8.0) job, which has failed every night since 2026-10-22 (e.g. run 40248590141).

Two commits:

  1. pdk update to the latest pdk-templates (PDK 4.0.1, template heads/main). Mechanical; touches only managed files (.gitignore, .pdkignore, .puppet-lint.rc, .rubocop.yml, Gemfile, metadata.json).
  2. Raise the Puppet 8 CI floor in ci.yml and nightly.yml from ~> 8.0 to ~> 8.17.

Additional Context

  • Root cause. The job fails while loading the specs: FrozenError: can't modify frozen Hash at puppet-8.16.0/lib/puppet/util/monkey_patches.rb:56 (SSLContext). That is a bug in Puppet 8.16.0 itself, which is fixed in later 8.x. CI should never have resolved 8.16.0. It did because of a Bundler resolution trap: with only puppet ~> 8.0, Bundler picks multi_json 1.21 first; Puppet 8.17+ caps multi_json at <= 1.19.0, so Bundler silently backtracks puppet to 8.16.0, the newest release with no such cap. Same trap as bolt-private PRs #123 and #126, and pdk-templates #662 (ADR 0001).
  • Why two changes. pdk-templates #662 (merged 2026-09-08) adds puppet_floor_version to the template Gemfile, defaulting PUPPET_GEM_VERSION to ~> 8.17. This module was still on template 3.2.0, so it lacked that. The default only applies when PUPPET_GEM_VERSION is unset, and ci.yml/nightly.yml (both unmanaged: true in .sync.yml) set it to ~> 8.0 explicitly, so the pdk update alone would not change CI. Hence the second commit.
  • Reproduction (local, Ruby 3.2.11). Before: bundle install resolves puppet 8.16.0. After pdk update and a new bundle install: puppet 8.22.

Known risks (please check CI)

pdk update replaces the Gemfile and removes two hand edits that were in it:

  • gem "ffi", platforms: [:mswin, :mingw, :x64_mingw] in the system_tests group (commit 4744b3c restored it for Windows). Watch the Windows acceptance job.
  • The Ruby 4.0-only gemsource_facter scoping from the same commit. The template now routes facter through puppetcore on every Ruby, which that commit said crashed require 'facter' on Ruby 3.2. I have not shown whether this still happens with the current facter build.

If either shows up red, the fix is to add them back through .sync.yml (or keep the Gemfile unmanaged) in a follow-up commit on this PR.

Related Issues (if any)

Jira: CAT-2946.

Nightly failures since 2026-10-22; bolt-private #123, #126; pdk-templates #662.

Docs assessment

Read the repo CONTRIBUTING.md and PR template. No documentation change needed: no behaviour change for users of the gem or module, and the CHANGELOG is generated at release prep.

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified. (bundle install resolves puppet 8.22 locally; CI to confirm.)

🤖 Generated with Claude Code

@gavindidrichsen gavindidrichsen changed the title (MAINT) Fix the Puppet 8 nightly: pdk update and raise the CI floor to 8.17 (MAINT) Fix the Puppet 8 nightly raising puppet floor to 8.17 Oct 26, 2026
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.98%. Comparing base (da86617) to head (46227a2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #403      +/-   ##
==========================================
- Coverage   90.77%   88.98%   -1.80%     
==========================================
  Files           6        6              
  Lines        1257      853     -404     
==========================================
- Hits         1141      759     -382     
+ Misses        116       94      -22     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gavindidrichsen gavindidrichsen changed the title (MAINT) Fix the Puppet 8 nightly raising puppet floor to 8.17 (CAT-2946) Fix the Puppet 8 nightly: pdk update and raise the CI floor to 8.17 Oct 26, 2026
@gavindidrichsen gavindidrichsen changed the title (CAT-2946) Fix the Puppet 8 nightly: pdk update and raise the CI floor to 8.17 (CAT-2946) Fix the Puppet 8 nightly raising puppet floor to 8.17 Oct 26, 2026
@jst-cyr

jst-cyr commented Oct 27, 2026

Copy link
Copy Markdown
Member

@gavindidrichsen : Won't raising the Puppet 8 floor to 8.17 mean that it requires the private Puppet Core and there will no longer be any unit tests run on forks?

gavindidrichsen and others added 10 commits October 28, 2026 16:48
Run `pdk update` to move template-ref from tags/3.2.0 to heads/main
(de9a08b). The update is mechanical and touches only the managed files:
.gitignore, .pdkignore, .puppet-lint.rc, .rubocop.yml, Gemfile and
metadata.json.

The part that matters for CI is the Gemfile. pdk-templates PR #662
added puppet_floor_version, which defaults PUPPET_GEM_VERSION to
'~> 8.17' on Ruby 3.1-3.3. Without it Bundler resolves multi_json to
1.21 first, which puppet 8.17+ cannot use, and silently backtracks
puppet to 8.16.0. That backtrack is what breaks the Puppet 8 spec job
(FrozenError in puppet/util/monkey_patches.rb).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Gavin Didrichsen <gavin.didrichsen@gmail.com>
Style/RegexpLiteral rewrote the expected_cim_instance_array_regex
literal from /.../ to %r{...} but left the `}` after 'two' unescaped.
That closes the %r{} early and makes the spec file a syntax error
(Lint/Syntax). Escape the brace so the pattern matches the same text.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The pdk update replaced .rubocop.yml with the template's version, which
no longer inherited .rubocop_todo.yml, so the module's known offences
were reported again. Set include_todos in .sync.yml so the template
renders `inherit_from: .rubocop_todo.yml` (with merged Excludes) instead
of hand-editing a managed file that the next pdk update would overwrite.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The autocorrect in 0db45e4 also rewrote production code.
Style/ClassAndModuleChildren turned `module Pwsh` / `module Util` into
`module Pwsh::Util` and `class Pwsh::WindowsPowerShell`, which raises
`NameError: uninitialized constant Pwsh` at load time. It also changed
behaviour: `return nil` became `return false` in a predicate, and several
`select` blocks became `slice`.

This PR is about the Puppet 8 CI floor, so keep lib/ exactly as on main and
let the rubocop todo file carry any offences there. With lib/ restored, the
unit specs that can run without a pwsh binary pass (231 examples, 0 failures).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
main disabled Style/ClassAndModuleChildren in its hand-edited .rubocop.yml.
The template profile enforces compact style, which is what broke the module
loading in 0db45e4. Disable it with a cop_overrides entry in .sync.yml so the
setting survives the next pdk update.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Apply only the autocorrects rubocop marks safe, in one pass:
Style/RegexpLiteral, Style/TernaryParentheses, Style/TrailingCommaIn*Literal,
Style/SymbolArray, Style/WordArray and Style/BlockDelimiters (37 offences in
lib/pwsh.rb, lib/pwsh/util.rb and the dsc_base_provider). No module or class
structure changes. Every touched file passes `ruby -c`, and the four spec files
that run without a pwsh binary pass (231 examples, 0 failures, 1 pending).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Performance/StringBytesize: `msg.bytes.length` becomes `msg.bytesize`, the same value without building an array.
- Lint/BooleanSymbol: the `:true`/`:false` symbols in format_powershell_value are intentional (Puppet can pass them), so keep them and say so with an inline disable.

Style/HashSlice is not applied: slice calls namevar_attributes once instead of once per entry, which changes the call count a unit test asserts (3 calls expected, 1 made).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Merge repeated `allow(...).to receive` stubs into receive_messages (27 offences).
The unsafe autocorrect put the general stubs after the specific `with` stubs, so
they overrode them and three ps_script_content examples failed. Keep the general
stubs first so the specific ones win. 231 examples, 0 failures, 1 pending.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add Style/HashSlice, Lint/UselessConstantScoping, RSpec/SpecFilePathSuffix and
RSpec/SpecFilePathFormat (14 offences) to .rubocop_todo.yml, each with the reason
it is not changed in this PR. rubocop now reports no offences.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@gavindidrichsen
gavindidrichsen force-pushed the fix-puppet8-floor-multi-json branch from 9852b35 to 46227a2 Compare October 28, 2026 16:49
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