Incorrect upgrade order
I am not sure if this is actually a pkg issue or a port issue, but I'm leaning towards pkg because the dependency does seem to be correctly recorded.
Note the following upgrade transcript:
# pkg upgrade
Updating production repository catalogue...
Fetching meta.conf: 100% 179 B 0.2kB/s 00:01
Fetching data.pkg: 100% 225 KiB 230.1kB/s 00:01
Processing entries: 100%
production repository update completed. 640 packages processed.
All repositories are up to date.
Checking for upgrades (9 candidates): 100%
Processing candidates (9 candidates): 100%
The following 9 package(s) will be affected (of 0 checked):
Installed packages to be UPGRADED:
augeas: 1.14.0_3 -> 1.14.0_4 [production]
bash: 5.3_1 -> 5.3.3_1 [production]
liburcu: 0.15.1 -> 0.15.3 [production]
puppet8: 8.10.0 -> 8.10.0_1 [production]
rsync: 3.4.1_2 -> 3.4.1_3 [production]
ruby: 3.3.8,1 -> 3.3.9,1 [production]
ruby33-gems: 3.6.9 -> 3.7.1 [production]
rubygem-json: 2.12.2 -> 2.13.0 [production]
rubygem-thor: 1.3.2 -> 1.4.0_1 [production]
Number of packages to be upgraded: 9
15 MiB to be downloaded.
Proceed with this action? [y/N]: y
[1/9] Fetching ruby33-gems-3.7.1.pkg: 100% 652 KiB 667.4kB/s 00:01
[2/9] Fetching ruby-3.3.9,1.pkg: 100% 10 MiB 10.3MB/s 00:01
[3/9] Fetching rsync-3.4.1_3.pkg: 100% 415 KiB 424.9kB/s 00:01
[4/9] Fetching liburcu-0.15.3.pkg: 100% 170 KiB 174.3kB/s 00:01
[5/9] Fetching augeas-1.14.0_4.pkg: 100% 747 KiB 765.4kB/s 00:01
[6/9] Fetching rubygem-json-2.13.0.pkg: 100% 64 KiB 65.7kB/s 00:01
[7/9] Fetching puppet8-8.10.0_1.pkg: 100% 1 MiB 1.3MB/s 00:01
[8/9] Fetching rubygem-thor-1.4.0_1.pkg: 100% 48 KiB 49.0kB/s 00:01
[9/9] Fetching bash-5.3.3_1.pkg: 100% 2 MiB 2.0MB/s 00:01
Checking integrity... done (0 conflicting)
[1/14] Deinstalling puppet8-8.10.0...
[1/14] Deleting files for puppet8-8.10.0: 100%
[2/14] Deinstalling rubygem-json-2.12.2...
[2/14] Deleting files for rubygem-json-2.12.2: 100%
[3/14] Deinstalling rubygem-thor-1.3.2...
[3/14] Deleting files for rubygem-thor-1.3.2: 100%
[4/14] Deinstalling ruby33-gems-3.6.9...
[4/14] Deleting files for ruby33-gems-3.6.9: 100%
[5/14] Deinstalling ruby-3.3.8,1...
[5/14] Deleting files for ruby-3.3.8,1: 100%
[6/14] Upgrading augeas from 1.14.0_3 to 1.14.0_4...
[6/14] Extracting augeas-1.14.0_4: 100%
[7/14] Upgrading bash from 5.3_1 to 5.3.3_1...
[7/14] Extracting bash-5.3.3_1: 100%
[8/14] Upgrading liburcu from 0.15.1 to 0.15.3...
[8/14] Extracting liburcu-0.15.3: 100%
[9/14] Upgrading rsync from 3.4.1_2 to 3.4.1_3...
[9/14] Extracting rsync-3.4.1_3: 100%
[10/14] Installing ruby-3.3.9,1...
[10/14] Extracting ruby-3.3.9,1: 100%
[11/14] Installing puppet8-8.10.0_1...
===> Creating groups
Using existing group 'puppet'
===> Creating users
Using existing user 'puppet'
[11/14] Extracting puppet8-8.10.0_1: 100%
[12/14] Installing ruby33-gems-3.7.1...
[12/14] Extracting ruby33-gems-3.7.1: 100%
[13/14] Installing rubygem-json-2.13.0...
[13/14] Extracting rubygem-json-2.13.0: 100%
[14/14] Installing rubygem-thor-1.4.0_1...
[14/14] Extracting rubygem-thor-1.4.0_1: 100%
puppet8 depends on rubygem-facter, which is not updated, but rubygem-facter depends on rubygem-thor, which is. (The PORTREVISION of rubygem-thor has been manually bumped in our repository to force the upgrade.) This transitive dependency should have caused rubygem-thor to be upgraded before puppet8 (this matters much more when HANDLE_RC_SCRIPTS is true, because puppet will fail to restart when rubygem-thor is absent -- not seen here because the puppet agent is not enabled on this machine).
Since the dependency graph seems to be correct in the package database, I think this is a defect in the upgrade solver.
https://github.com/freebsd/pkg/pull/2488 would likely solve this.