Skip to content

feat(integriq): build sources-route-distance-and-rdw-lookup - #3595

Merged
rubenvdlinde merged 15 commits into
developmentfrom
quality/build-sources-route-distance-and-rdw-lookup
Nov 17, 2026
Merged

rubenvdlinde merged 15 commits into
developmentfrom
quality/build-sources-route-distance-and-rdw-lookup

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Builds openspec/changes/sources-route-distance-and-rdw-lookup.

Tasks done

  • Task 1, connection call command: ConnectionCallRequestedEvent + ConnectionCallRequestedListener over a new ConnectionCallService. Finds the app's declared app_connection row, calls the linked source through CallServiceInterface::call() with the source's own credential, and answers status, body (decoded JSON or raw text) and sourceSlug. Refuses not-declared, not-linked (with the connection's title), invalid (method other than GET/POST, a path that leaves the source's location, non-scalar query values) and call-failed; never throws to the caller.
  • Task 2, route distance: RouteDistanceRequestedEvent + listener over RouteDistanceService. Places both postcodes through PDOK, asks the linked planner (OpenRouteService or TomTom, chosen by configuration.routeProvider, else the slug), answers distanceKmOneWay (one decimal), routeProvider, fromMunicipality, toMunicipality. Refuses unknown-postcode (naming it), unsupported-mode, unsupported-provider, geocoder-unavailable, no-route.
  • Task 3, templates: dormant rdw-open-data (no credential), route-planner-openrouteservice and route-planner-tomtom (credential by credentialRef), with catalogue categories Government registers and Geo / Maps.
  • Task 4, docs: docs/features/connection-calls.md lists both events, their fields and refusal codes. No new user-visible backend strings, so no l10n keys.
  • Listeners are registered in EventListenerBindings::registerSiblingRequestListeners(), with the other sibling-request commands.

Tasks left, and why

  • Task 2 test: the live run with an OpenRouteService key on a dev instance (needs a key and a live instance).
  • Task 4 test: the docs build (not run here).
  • Verification: openspec validate --strict and composer check:strict (not available in this environment; phpcs and phpstan were run on every touched lib file instead, both clean).

Tests added

  • ConnectionCallServiceTest (10 tests): the RDW plate lookup against a recorded RDW answer through the real event and listener, not-linked, not-declared, a gone source, .. refused before anything is read, every way out of the location, POST JSON body, call failure, listener failure.
  • RouteDistanceServiceTest (11 tests): 2611 AB to 3011 AD by car is 15.8 km on OpenRouteService (recorded answer), TomTom e-bike, 0000 XX and an unplaceable postcode are unknown-postcode, PDOK unanswered, unsupported mode and provider, not linked, planner error, postcode normalisation.
  • CatalogRegistryServiceTest: the three templates in their categories.
  • Updated recorded fixtures: application-registration-order.json (two new listener registrations) and the CatalogRegistrySeedGoldenTest hashes; the old hashes still match with the three new templates removed, so the change is only the additions.

Suite

Unit suite before: 8493 tests, 2 errors, 3 failures (inherited). After: 8515 tests, 2 errors, 3 failures, the same ones.


Generated by Claude Code

A sibling app calls a connection it declared through
ConnectionCallRequestedEvent, and asks the road distance between two
postcodes through RouteDistanceRequestedEvent. Adds dormant source
templates for RDW open data, OpenRouteService and TomTom.

Assisted-by: ClaudeCode:claude-opus-5-5
…ookup [skip ci]

Keeps both sides' sibling listeners (connection call and route distance
from this branch, form submission registration and service fetch from
development) in EventListenerBindings and the registration-order fixture,
and re-pins the catalog seed golden hashes to the merged seed.

Assisted-by: ClaudeCode:claude-opus-5-5
…ookup [skip ci]

The seed golden hashes cover both sides' seed changes.

Assisted-by: ClaudeCode:claude-opus-5-5
…s to hold the maintainability floor [skip ci]

RouteDistanceService::distance (61 lines, McCabe 10) becomes planner,
places and routeMeters; place, metersOf, linkedSource and requestRefusal
lose their extra branches to small helpers with the same outcomes, the path
check unchanged. The two command events share their answer half through the
CommandAnswer trait, so their public methods stay as they were. Against
development: duplication 3.80 = 3.80, unit_size 3.55 = 3.55, unit_complexity
3.89 -> 3.91, module_coupling 5.03 -> 5.04.

Assisted-by: ClaudeCode:claude-opus-5-5
…ookup [skip ci]

Assisted-by: ClaudeCode:claude-opus-5-5
…ookup [skip ci]

Assisted-by: ClaudeCode:claude-opus-5-5
…ookup [skip ci]

Assisted-by: ClaudeCode:claude-opus-5-5
…s to hold the maintainability floor [skip ci]

call(), linkedSource(), distance() and the two request listeners' handle()
each split into named steps (validSource, callSource, answer, sourceOf,
routeBetween, distanceAnswer, answerFor, ask); refusal reasons move into a
local before the call. Behaviour unchanged. unit_size on the tree merged with
development is 3.59 (development 3.58); no property below development.

Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
…ookup [skip ci]

Assisted-by: ClaudeCode:claude-opus-5-5
…ces beside their listeners [skip ci]

Both services are only reached from their event listeners; placing them in lib/EventListener (as ExchangeRateService already is) keeps the code inside one component and restores the maintainability floor (3.56 after merge). No behaviour change.

Assisted-by: ClaudeCode:claude-opus-5-5
…ookup [skip ci]

Both sides changed the seeded catalogue; the golden hashes are recomputed
from the merged tree.

Assisted-by: ClaudeCode:claude-opus-5-5
…ookup [skip ci]

Seed golden hashes recomputed on the merged tree: both sides changed
the seed catalogue.

Assisted-by: ClaudeCode
@rubenvdlinde
rubenvdlinde merged commit b6103d3 into development Nov 17, 2026
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