Skip to content

[access] refactor(merge): survivorship resolvers and MergeService take their value objects and bundles - #7566

Merged
rubenvdlinde merged 4 commits into
mainfrom
cloud/k18-merge-survivor
Nov 9, 2026
Merged

rubenvdlinde merged 4 commits into
mainfrom
cloud/k18-merge-survivor

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What changed

Interfacing work (SIG unit interfacing, parameter bands > 4 and > 6) on the survivorship and merge path. Lane K18, round 10c.

  • TrustTierResolver::resolveTier() takes the TrustTuple it already built inside (5 → 3 params). applyFreshnessDecay() takes a new SourceFreshness value object holding the decay window, the anchor and the reference instant (5 → 3). hasDecayed() reads the same object. The interface follows.
  • SurvivorshipResolver::resolveGoldenRecord() takes the existing SurvivorshipTrustLookup, which it used to build from four of its arguments (7 → 4). Both callers build the lookup: MergeService and SurvivorshipRecomputeListener.
  • MergeService::__construct (9 → 4 params): the object path and PropertyRbacHandler (the property-read guard) stay as direct parameters. Two autowired final readonly bundles hold the rest: MergeSurvivorshipServices (schema mapper plus the three resolvers) and MergeReportingServices (event dispatcher, audit trail, logger). The typed properties are assigned one at a time, so no method body changes.
  • recomputeSurvivor() (6 → 3) and fieldChoices() (5 → 2) take a MergePair (both objects, the schema and the merge annotation). fieldChoices now reads the payloads and the survivorship block from that pair. Both callers passed exactly those values before: in executeMerge the call comes before any payload changes.

Behaviour is unchanged. Tests changed only where they build these classes or pin the old call shape, and they use the same values. In the listener golden the callback now takes the lookup and still checks the trust engine type.

What ran

On this branch merged with current origin/development, together with the lane's other branch:

  • tests/Unit/Architecture, tests/Unit/Contract, tests/Unit/Kernel, tests/Unit/Service/Rules, ControllerServicesWiringTest, ControllerSessionWiringTest, tests/Unit/Service/{Merge,Survivorship,Object}, tests/Unit/Listener, tests/Unit/Controller: all green.
  • php -l, phpcs (no new findings) and phpstan on the touched files: clean.

Numbers (lane_measure.py, K18)

  • Before: > 4 band 322 LOC, > 6 band 39 LOC.
  • After, with both K18 branches merged: > 4 band 128 (target 137), > 6 band 0 (target 0).
  • This PR covers resolveGoldenRecord (27), recomputeSurvivor (39), fieldChoices (30), resolveTier (23), applyFreshnessDecay (12) and the constructor (12). executeMerge also got 13 lines shorter. executeMerge itself is out of scope: its signature is fixed by Kernel/Contracts/ObjectMergerInterface.

The [access] prefix is there because MergeService holds the property-read refusal and its audit write. Neither moved: the guard is still a direct constructor parameter, and it still runs before any write.

Written with AI assistance (Claude Code).


Generated by Claude Code

…urceFreshness

resolveTier(entityType, attribute, sourceSystem, trustRows, asOf) now takes
the TrustTuple it already built internally; applyFreshnessDecay(tier,
tierOrder, decayDays, anchor, asOf) takes a SourceFreshness (decay window,
anchor, reference instant), which hasDecayed reads too. Behaviour unchanged:
the existing branch goldens pin both methods and pass unedited apart from
the call shape.

Assisted-by: ClaudeCode:claude-opus-5-5
… MergeService bundles its collaborators

SurvivorshipResolver::resolveGoldenRecord(entityType, sourceRecords, config,
trustRows, trustResolver, asOf, overrides) now takes the
SurvivorshipTrustLookup it already built from four of those values. Both
callers (MergeService, SurvivorshipRecomputeListener) build it.

MergeService's nine-argument constructor keeps the object path and the
property-read guard direct and takes two autowired bundles:
MergeSurvivorshipServices (schema lookup + the three resolvers) and
MergeReportingServices (event, audit, log). recomputeSurvivor and
fieldChoices take a MergePair (both objects, schema, merge annotation);
fieldChoices reads the payloads and survivorship block from it, which are
the same values both callers passed before.

Assisted-by: ClaudeCode:claude-opus-5-5
# Conflicts:
#	tests/Unit/Service/Survivorship/SurvivorshipBranchesGoldenTest.php

Copy link
Copy Markdown
Contributor Author

Newman API Test Suite: red, and not caused by this PR.

  • The same check is also red on the current development head (Newman API Test Suite and quality / Integration Tests (Newman) both fail there).
  • The 11 errors and 11 failures in this run are all in classes this PR doesn't touch:
    • JobRunMapperNarrowGoldenTest
    • FileVersioningHandlerGoldenTest (PHP fatal: IVersionManager is declared twice from eval()'d code, which depends on test order)
    • TextExtractionJobsGoldenTest
    • EndpointsControllerAnswersGoldenTest
    • SchemaConfigValidatorsGoldenTest
    • ProcessingLogServiceGoldenTest
    • A18InterfaceBindingsTest (the ObjectRetentionHandler data set)
  • None of these build or call MergeService, SurvivorshipResolver, TrustTierResolver or SurvivorshipRecomputeListener.
  • Locally, on this branch merged with origin/development, these all pass: the architecture, contract and kernel guards, tests/Unit/Service/{Merge,Survivorship}, tests/Unit/Listener and tests/Unit/Controller.

No fix for these failures exists on development yet, so there is nothing to port into this PR. Per the lane brief this PR is finished as opened, so no commits will be added to it.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde changed the base branch from development to main November 9, 2026 06:54

Copy link
Copy Markdown
Contributor Author

Frontend Check (test:l10n) and (test:l10n:parity): red, and not caused by this PR.

This PR changes nothing under src/ or l10n/; the diff is PHP and PHPUnit only.

The two checks fail on catalogue state that this PR inherits from development:

  • test:l10n: 14 keys are used in src/ but missing from l10n/en.js. The repo's CLAUDE.md already records test:l10n as red at HEAD for this reason, and fixing it is its own §6.15 commit.
  • test:l10n:parity: the key "We could not count the objects. Close this window and try again." is missing from de, fr, es and other locales.

No fix for either exists yet, so there is nothing to port into this PR, and adding l10n work would widen it beyond its scope.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Frontend Check (format): red, and not caused by this PR.

prettier --check flags many src/ files that are already on development (for example src/components/cards/RegisterSchemaCard.vue, src/components/rules/*, src/dialogs/avg/*). This PR changes no .js, .ts, .vue, .css or .scss file; its diff is PHP and PHPUnit only.

No formatting fix for those files exists yet, so there is nothing to port into this PR, and reformatting them here would widen it.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

PHP Quality (phpstan), (psalm), (phpcs) and Vue Quality (eslint): red, and not caused by this PR.

None of the findings in these checks names a file this PR changes:

  • phpstan reports 24 errors, all in other classes: FileTextExtractionJob, EndpointsController, RegisterStatistics, TaskNotesController, WebhooksController, TenancyIdentityTrait, NotesController, GraphQLService, FlowService, ImportPreviewService, NotesProvider and TaskSequenceService.
  • phpcs flags other files, for example lib/Db/ImportPreviewRow.php, lib/Service/Flow/FlowTokenRouter.php, lib/Service/ContractBindings.php and lib/Db/CaseItem.php.
  • psalm's log names none of the files this PR changes.
  • eslint flags frontend files only (769 problems), and this PR changes no frontend file.

Locally, phpstan (with the repo's phpstan.neon) and phpcs on every file this PR touches report no errors. No fix exists yet for the findings above, and fixing them here would widen this PR well beyond its scope.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Hydra Gates: red, and not caused by this PR.

CI runs the gates over the whole tree (--full, the default), and the 7 failing gates (3, 7, 12, 17, 40, 46, 49) report findings from across the repo. For example, gate-7 reports 113 NoAdminRequired methods.

To check what this PR itself adds, I ran run-hydra-gates.sh --scope-to-diff --base origin/development on this branch. None of those 7 gates fails. The only failure in the scoped run is gate-67 (contract parity between lib/Contract/ and the installed gates package), and this PR does not touch lib/Contract/; that gate passed in CI. I also ran check_spec_anchors.py (gate-46) on every lib/ file this PR changes: 0 unresolved targets.

No fix exists for the tree-wide findings yet, and fixing them here would widen this PR well beyond its scope.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

PHP Quality (phpmd): red, and not caused by this PR.

None of the phpmd findings names a file this PR changes (MergeService, MergePair, MergeSurvivorshipServices, MergeReportingServices, SurvivorshipResolver, TrustTierResolver, SourceFreshness, SurvivorshipRecomputeListener). The findings are spread across the tree, for example lib/Db/MagicMapper/MagicFacetHandler.php MissingImport and lib/Service/Object/ArchiveHandler.php CouplingBetweenObjects.

No fix exists for them yet, so there is nothing to port into this PR.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit 54e841d into main Nov 9, 2026
37 of 49 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 0f6dbd1

Check PHP Vue Security License Tests
lint ✅
phpcs ❌
phpmd ❌
psalm ❌
phpstan ❌
phpmetrics ✅
eslint ❌
stylelint ✅
build ✅
check-specs ✅
test-l10n ❌
test-l10n-parity ❌
format ❌
check-schema-l10n ✅
test-coverage-ratchet ✅
composer ✅ ✅ 168/168
npm ✅ ✅ 641/641
app:check-code ⏭️
info.xml ✅
REUSE ✅
lockfile sync ✅
PHPUnit ❌ cancelled — no verdict
Newman ❌ 1625/1628
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ❌

Quality workflow — 2026-11-09 17:30 UTC

Download the full PDF report from the workflow artifacts.

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