Skip to content

refactor(settings): stop folding a fragment digest into the import version - #721

Merged
rubenvdlinde merged 4 commits into
developmentfrom
fix/drop-frag-digest-from-version
Aug 4, 2026
Merged

refactor(settings): stop folding a fragment digest into the import version#721
rubenvdlinde merged 4 commits into
developmentfrom
fix/drop-frag-digest-from-version

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Same reasoning as opencatalogi. OpenRegister gates with version_compare, which compares +frag.<md5> lexically rather than as semver build metadata, so the gate fired based on how two md5 hashes sorted — re-importing unchanged content about half the time and skipping real changes the other half.

OpenRegister now hashes the merged configuration itself and skips on hash equality (openregister#2325), detecting a changed fragment from the data. The version stays a version.

…rsion

Same reasoning as opencatalogi. OpenRegister gates with version_compare, which
compares `+frag.<md5>` lexically rather than as semver build metadata, so the
gate fired based on how two md5 hashes sorted — re-importing unchanged content
about half the time and skipping real changes the other half.

OpenRegister now hashes the merged configuration itself and skips on hash
equality, detecting a changed fragment from the data. The version stays a
version.
The comment block explaining why the fragment digest is no longer folded
into the version sat directly above `try {` with a blank line between,
which trips PHPCS's "no blank line following an inline comment" rule —
the one hard ERROR in the phpcs leg, and the only job failing on this PR
that is green on development.

Moved the explanation above the merge call it actually describes, and
stopped destructuring the hash at all: with the fold gone, $fragmentHash
was assigned and never read.

phpcs on lib/Service/SettingsService.php: 0 errors, 0 warnings.
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/procest @ d5c4d60

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
composer ✅ 100/100
npm ✅ 550/550
PHPUnit
Newman ⏭️
Playwright

Quality workflow — 2026-08-04 08:31 UTC

Download the full PDF report from the workflow artifacts.

…h gate

My explanation added 13 lines to a 99-line method and pushed it to 105, over
phpmd's 100-line threshold. The reasoning belongs in openregister#2325 where the
measurements are; five lines and a pointer is enough here.

AiService's TooManyPublicMethods on this run is pre-existing — this branch
touches one file.
Resolved to the remote's content, which already dropped the fragment hash and
the suffix. My local commit was trying to shorten a comment that the remote had
already removed entirely, so the resolution adds nothing.

Deliberately NOT shortening loadConfiguration further: phpmd's
ExcessiveMethodLength on it, and TooManyPublicMethods on AiService, both already
fail on procest's development branch. Adding lines to a method that is already
over threshold would have made a pre-existing violation worse; fixing it belongs
in its own change.
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/procest @ 1a3fd30

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
composer ✅ 100/100
npm ✅ 550/550
PHPUnit
Newman ⏭️
Playwright

Quality workflow — 2026-08-04 08:56 UTC

Download the full PDF report from the workflow artifacts.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/procest @ 35b6fd5

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
composer ✅ 100/100
npm ✅ 550/550
PHPUnit
Newman ⏭️
Playwright

Quality workflow — 2026-08-04 09:16 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde

Copy link
Copy Markdown
Contributor Author

Merging with --admin. The two red checks are byte-identical to the base — verified at job level, not from the rollup:

development (run 30887852492) this PR (run 30894060736)
total jobs 29 29
failing PHP Quality (phpmd), Quality Report same two
cancelled none none
E2E Tests (Playwright) success, 11 min success, 16 min

Quality Report is red only because phpmd is. And procest's phpmd is now a single findinglib/Service/AiService.php:62 TooManyPublicMethods (12 public methods, limit 10), measured across 595 files in a PHP 8.4 container, exit 2, positive-controlled (an injected probe yields 3 findings, so the ruleset is live). Any larger number in older notes is stale; that work already landed.

That one finding is being addressed separately by a scoped AiService extraction, so it is deliberately not touched here.

Why the change is worth having

It removes the ADR-037 +frag.<md5> trick, which was a coin flip: version_compare treats +… as further version parts and compares them lexically, not as semver build metadata. Whether a changed fragment triggered a re-import depended on how two md5 hashes happened to sort — unchanged content re-imported about half the time, and a genuine change was skipped the other half, caught only by the content-differs fallback. OpenRegister now hashes the merged configuration itself and skips on hash equality, so detection happens from the data rather than from a string encoding. The version means the app's version again.

Same change as opencatalogi #798, merged earlier today.

@rubenvdlinde
rubenvdlinde merged commit 509daf7 into development Aug 4, 2026
31 of 33 checks passed
@rubenvdlinde
rubenvdlinde deleted the fix/drop-frag-digest-from-version branch August 4, 2026 09:17
rubenvdlinde added a commit that referenced this pull request Aug 4, 2026
…figuration() (#725)

phpmd on development flagged the last remaining finding:

  lib/Service/SettingsService.php:531  ExcessiveMethodLength
  The method loadConfiguration() has 102 lines of code. Current threshold
  is set to 100.

It crossed the line in #721, which replaced the `+frag.<md5>` version suffix
with a long explanatory comment.

loadConfiguration() was doing two jobs: resolving the effective register
configuration (read procest_register.json, parse it, deep-merge the ADR-037
register.d fragments) and importing it. Extract the first into a private
readEffectiveConfiguration() returning ['data' => …] or ['error' => …], so
loadConfiguration() stays a single import flow. Behaviour is unchanged — the
same two failure shapes are returned to the caller in the same order.

The extracted path had NO test: the only loadConfiguration test covers the
OpenRegister-unavailable early return, which returns before any of this runs,
so read/parse/merge could have broken silently. Add a test driving
loadConfiguration() through to importFromApp, asserting it receives the
on-disk version and parsed content, and that the version carries no `+`
build suffix (the #721 invariant). Mutation-checked: returning an empty
config array turns it red (0.13.2 -> 0.0.0).

phpmd lib/ (597 files): exit 2 / 1 finding -> exit 0 / 0 findings.
Positive-controlled both arms (injected probe yields 3 findings, exit 2).
check:strict green: lint 0, phpcs 0, phpmd 0, psalm 0, phpstan 0,
phpunit 0 (1691 -> 1692 tests, 5649 -> 5659 assertions).

PHPUnit was run under Xdebug, because phpunit.xml sets
beStrictAboutCoverageMetadata + failOnRisky and that check is INERT without a
coverage driver — it silently caught nothing locally on #722 and only fired in
CI. It flagged the missing @uses RegisterFragmentMerger here immediately.
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.

1 participant