Skip to content

refactor(v7): remove 19 duplicate POC endpoints — cascade to v6/v4 twins#2827

Merged
simonredfern merged 3 commits into
OpenBankProject:developfrom
hongwei1:refactor/remove-duplicate-v7-endpoints
Jun 2, 2026
Merged

refactor(v7): remove 19 duplicate POC endpoints — cascade to v6/v4 twins#2827
simonredfern merged 3 commits into
OpenBankProject:developfrom
hongwei1:refactor/remove-duplicate-v7-endpoints

Conversation

@hongwei1
Copy link
Copy Markdown
Contributor

@hongwei1 hongwei1 commented Jun 2, 2026

Http4s700.scala contained 19 endpoints added purely as http4s-migration scaffolding (labelled "// ── POC endpoints — one per EndpointHelper category ──"). Each duplicates an endpoint already defined at a lower version. Per CLAUDE.md, versioning is tech-agnostic: an endpoint belongs at a version only when its signature/behaviour is new there. Removing them lets v700ToV600Bridge cascade each request to wherever the endpoint is genuinely defined (v6 for 18 of 19, v4 for getExplicitCounterpartyById which has no v5/v6 twin).

getBanks was already removed in bd9f8ca. This commit handles the other 19.

Deep static audit (roles / error-lists / auth-helper / query-param parsing / data-flow — axes the original handoff doc admitted it skipped) found 3 of the 19 are not identical to their twins but are incomplete POC versions. Deleting them improves behaviour by cascading to the fuller implementation:

  • getCurrentUser: v7 silently dropped onBehalfOfUser delegation; v6 computes and passes it (Http4s600.scala:205-213).
  • getUsers: v7 lacked sort_by validation (FilterSortByNotAllowedForEndpoint, FilterSortByError, FilterSortDirectionError); v6 enforces it.
  • getExplicitCounterpartyById: v7 used withCounterparty (middleware 404 on missing counterparty); v4 twin uses withView + inline resolution (400). Cascades two hops to Http4s400 (newest shape, no v5/v6 twin).

The 3 kept endpoints (deleteEntitlement / addEntitlement / getUserByUserId) have intentional v7 improvements (204, 409, 404 vs older 200/400) and stay.

Http4s700.scala: 4060 → 3369 lines; resourceDoc count 64 → 45.

Test cleanup (Appendix C):

  • Http4s700RoutesTest: 141 → 86 scenarios. Deleted the 20 behavioural feature blocks that tested removed endpoints at their v7 URLs (anti-pattern). Kept all infrastructure scenarios; repointed 3 fixtures from removed-endpoint URLs to native v7 URLs (/root, deleteEntitlement).
  • ResourceDocMiddlewareEnableDisablePropsTest: repointed versionsOpId from getScannedApiVersions (now removed) to getErrorMessages (public, native v7).

Verified: 258 tests across 8 suites pass (Http4s700RoutesTest 86, ResourceDocsTest 63, Http4sLiftBridgePropertyTest 51, V7ResourceDocsAggregationTest 14, SwaggerDocsTest 12, Http4sServerIntegrationTest 16, ResourceDocMiddlewareEnableDisablePropsTest 10, Http4s700TransactionTest 6). Cascade confirmed: removed-endpoint URLs return correct data with X-OBP-Version-Served: v6.0.0.

hongwei1 added 2 commits June 2, 2026 10:37
Http4s700.scala contained 19 endpoints added purely as http4s-migration
scaffolding (labelled "// ── POC endpoints — one per EndpointHelper category ──").
Each duplicates an endpoint already defined at a lower version. Per CLAUDE.md,
versioning is tech-agnostic: an endpoint belongs at a version only when its
signature/behaviour is new there. Removing them lets v700ToV600Bridge cascade
each request to wherever the endpoint is genuinely defined (v6 for 18 of 19,
v4 for getExplicitCounterpartyById which has no v5/v6 twin).

getBanks was already removed in bd9f8ca. This commit handles the other 19.

Deep static audit (roles / error-lists / auth-helper / query-param parsing /
data-flow — axes the original handoff doc admitted it skipped) found 3 of the
19 are not identical to their twins but are *incomplete* POC versions. Deleting
them improves behaviour by cascading to the fuller implementation:
  - getCurrentUser: v7 silently dropped onBehalfOfUser delegation;
    v6 computes and passes it (Http4s600.scala:205-213).
  - getUsers: v7 lacked sort_by validation (FilterSortByNotAllowedForEndpoint,
    FilterSortByError, FilterSortDirectionError); v6 enforces it.
  - getExplicitCounterpartyById: v7 used withCounterparty (middleware 404 on
    missing counterparty); v4 twin uses withView + inline resolution (400).
    Cascades two hops to Http4s400 (newest shape, no v5/v6 twin).

The 3 kept endpoints (deleteEntitlement / addEntitlement / getUserByUserId)
have intentional v7 improvements (204, 409, 404 vs older 200/400) and stay.

Http4s700.scala: 4060 → 3369 lines; resourceDoc count 64 → 45.

Test cleanup (Appendix C):
  - Http4s700RoutesTest: 141 → 86 scenarios. Deleted the 20 behavioural feature
    blocks that tested removed endpoints at their v7 URLs (anti-pattern). Kept
    all infrastructure scenarios; repointed 3 fixtures from removed-endpoint
    URLs to native v7 URLs (/root, deleteEntitlement).
  - ResourceDocMiddlewareEnableDisablePropsTest: repointed versionsOpId from
    getScannedApiVersions (now removed) to getErrorMessages (public, native v7).

Verified: 258 tests across 8 suites pass (Http4s700RoutesTest 86, ResourceDocsTest
63, Http4sLiftBridgePropertyTest 51, V7ResourceDocsAggregationTest 14, SwaggerDocsTest
12, Http4sServerIntegrationTest 16, ResourceDocMiddlewareEnableDisablePropsTest 10,
Http4s700TransactionTest 6). Cascade confirmed: removed-endpoint URLs return correct
data with X-OBP-Version-Served: v6.0.0.
@hongwei1 hongwei1 force-pushed the refactor/remove-duplicate-v7-endpoints branch from af4e5e8 to 7c8d44b Compare June 2, 2026 09:19
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

@simonredfern simonredfern merged commit 5f54b6f into OpenBankProject:develop Jun 2, 2026
2 checks passed
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