refactor: retire Lift dispatch layer, migrate all endpoints to Http4s-V400,v310,v300#2801
Merged
simonredfern merged 19 commits intoMay 21, 2026
Merged
Conversation
…UT attribute-definition endpoint Two regressions exposed when the v4.0.0 Lift routes were retired in commit 95db087: 1. answerTransactionRequestChallenge — the Http4s400 implementation was delegating to Http4sLiftWebBridge which now returns 404 (no Lift v4 routes registered). Port the ~280-line Lift logic to native http4s: supports ChallengeAnswerJson400, maker-checker separation, multi-challenge flow (NEXT_CHALLENGE_PENDING), FORWARDED status, and the REJECT answer path for SEPA refund reversal. 2. createOrUpdateTransactionRequestAttributeDefinition — the alias in Http4s400 wrongly pointed to createOrUpdateTransactionAttributeDefinition (/transaction, Transaction category) instead of a dedicated /transaction-request endpoint with TransactionRequest category. Add the proper lazy val, ResourceDoc, and allRoutesWithMiddleware wiring. Remove the incorrect alias. 3. Http4s400.Implementations4_0_0.implementedInApiVersion — expose as an explicit member so ResourceDocsAPIMethods.scala can access it via APIMethods400.Implementations4_0_0. Test fixes (also exposed by the Lift retirement): - frozen_type_meta_data: regenerate snapshot to reflect Http4s400 endpoint names - GetScannedApiVersionsTest: add OBPv4.0.0 to api_enabled_versions so http4s middleware does not 404 v4 requests during the version-filter test - JsonSchemaValidationTest, CounterpartyLimitTest, TransactionRequestTest, VRPConsentRequestTest: replace nameOf(Implementations4_0_0.x) with string literals (the stub object no longer has an inner Implementations4_0_0 class) - APIUtilHeavyTest: rewire to use Http4s400.resourceDocs directly with inline prop filtering instead of relying on OBPAPI4_0_0's Lift-registered routes
… in Http4s400
All 258 v4.0.0 endpoints have been migrated to Http4s400. This commit removes the
17,042-line Lift implementation body, keeping only a thin compatibility shim:
object APIMethods400 { val Implementations4_0_0 = Http4s400.Implementations4_0_0 }
trait APIMethods400 // empty — no Lift routes, no ResourceDocs
The original implementation is preserved as comments (prefixed //) for historical
reference. Callers that previously imported APIMethods400.Implementations4_0_0 still
compile — the re-export provides the same qualified name pointing to the Http4s object.
OBPAPI5_1_0 / OBPAPI6_0_0: the excludeEndpoints lists previously used
nameOf(Implementations4_0_0.xxx) macros which resolved against the Lift inner class.
Replace each with a string literal (the macro just returns the val name as a string)
so the references compile against the empty stub.
…actionRequestAttributeDefinition v4.0.0 now properly registers the transaction-request attribute definition endpoint in Http4s400, which was previously missing from the frozen snapshot.
…excludeEndpoints Replace string literals with nameOf macro calls now that Http4s400.Implementations4_0_0 exposes all the required vals. Add re-export and Http4s400 import to OBPAPI5_1_0 and OBPAPI6_0_0 so the macro resolves correctly.
…tags OBPAPI4_0_0: replace string literals in excludeEndpoints with nameOf(OBPAPI3_1_0.Implementations1_2_1.xxx) and nameOf(OBPAPI3_1_0.Implementations3_1_0.xxx) — resolved via stable singleton path. Test files: restore nameOf(Implementations4_0_0.createTransactionRequestCounterparty) in CounterpartyLimitTest, TransactionRequestTest, VRPConsentRequestTest.
…o Http4s310
getObpConnectorLoopback: returns 400+NotImplemented (mirrors Lift throw).
getMessageDocsSwagger: stub val + ResourceDoc only — real routing handled by
Http4sResourceDocs (wildcard /obp/*/message-docs/{CONNECTOR}/swagger2.0,
wired into Http4sApp before v310Routes). Both vals are required so nameOf
compiles in downstream test files after OBPAPI3_1_0 is migrated.
All 100 v3.1.0 endpoints now live in Http4s310 (wired into Http4sApp). OBPAPI3_1_0 is retained only for resource-doc aggregation: - allResourceDocs = collectResourceDocs(OBPAPI3_0_0.allResourceDocs, Http4s310.resourceDocs) - routes = Nil (Lift dispatch retired) - Re-exports Implementations3_1_0/1_2_1/2_2_0 so callers keep compiling ResourceDocsAPIMethods: add v3.1.0 to the http4s skip filter so the route-class filter does not empty the doc set when routes=Nil.
…orts APIMethods310: replace 6065-line Lift implementation with empty trait stub. object APIMethods310 re-exports Implementations3_1_0 → Http4s310 so SystemViewsTests (which imports APIMethods310.Implementations3_1_0) compiles. OBPAPI5_1_0/OBPAPI6_0_0: add Implementations3_1_0 = Http4s310.Implementations3_1_0 re-export + Http4s310 import so nameOf(Implementations3_1_0.xxx) in their excludeEndpoints continues to compile after the APIMethods310 stub.
Three bugs introduced by the v3.1.0 Lift retirement: 1. NPE in Http4s121.wrappedRoutesV121Services: Scala initialised the val to null before Http4s121.Implementations1_2_1 was ready, so every request reaching the v1.3.0→v1.2.1 bridge threw NullPointerException (no Correlation-Id, status 500). Fixed by making it lazy val. 2. FrozenClassTest (STABLE API contract): the migration merged createConsentSms/createConsentEmail/createConsentImplicit into a single createConsent endpoint, violating the frozen partialFunctionName set. Restored the three original endpoint names as separate ResourceDocs pointing to the same handler. 3. SystemViewsTests: the `if viewIdStr.nonEmpty` guards on getSystemView, deleteSystemView, and updateSystemView were added to fall through to the Lift bridge, which no longer exists for v3.1.0. Removing the guards lets the middleware return 401/403 for empty-viewId requests, matching the test expectations.
…est, loopback auth - Http4sSupport: withUser/withUserDelete/etc now throw RuntimeException(AuthenticatedUserIsRequired) so ErrorResponseConverter resolves to 401 via getCodeByOBPPrefix rather than 500 - ResourceDocMiddleware: case None path now runs best-effort anonymousAccess so cc.user is populated from request credentials even when no ResourceDoc matches (empty segment bypass) - Http4s310 createConsent: use withUserAndBodyCreated (no bank from CC needed) so SCA method check (booleanToFuture 400) fires before bank validation is attempted for invalid SCA methods - Http4s310 getObpConnectorLoopback: change description to userAuthenticationMessage(false) so AuthenticatedUserIsRequired is not auto-added to error list; endpoint is anonymous (returns 400 NotImplemented unconditionally) - CardAttributeTest: use partialFunctionName==nameOf(...) instead of partialFunction==... which always returns null for http4s endpoints
…tch v5.1.0/v6.0.0 cross-refs - OBPAPI3_0_0: drop all APIMethods mixin chain (130→300 + CustomAPIMethods300), set routes=Nil, switch allResourceDocs to collectResourceDocs(OBPAPI2_2_0, Http4s300), add re-export val Implementations3_0_0 = Http4s300.Implementations3_0_0 (18 test files reference it via nameOf(Implementations3_0_0.<endpoint>)) - OBPAPI5_1_0 / OBPAPI6_0_0: drop APIMethods300 + CustomAPIMethods300 mixins and imports; add import Http4s300; add re-export val Implementations3_0_0 = Http4s300.Implementations3_0_0 so nameOf(Implementations3_0_0.getUserByUsername) in excludeEndpoints keeps compiling - ResourceDocsAPIMethods: add v3_0_0 to http4s skip filter (routes=Nil would drop all docs without this bypass) All v3.0.0 endpoints are served by Http4s300 (47 endpoints, 1:1 coverage with APIMethods300). APIMethods300 stub follows in the next commit.
Drop the 2526-line Lift implementation body from APIMethods300.scala — all v3.0.0 endpoints are served by Http4s300. The empty trait stub is retained so existing `with APIMethods300` mixin sites keep compiling. object APIMethods300 re-exports Implementations3_0_0 = Http4s300.Implementations3_0_0 so v3_1_0/ConsentTest and v5_1_0/ConsentObpTest continue to compile. CustomAPIMethods300 is retired to a no-op stub — its only endpoint was null and its resourceDocs buffer was empty (nothing was ever served).
Three v4.0.0 tests (AuthenticationTypeValidationTest, ForceErrorValidationTest, JsonSchemaValidationTest) import OBPAPI3_0_0.Implementations2_2_0 for nameOf(...) Tag construction. The v3.0.0 retirement removed the APIMethods220 mixin that previously provided this val. Add re-export val Implementations2_2_0 = Http4s220.Implementations2_2_0 so these tests keep compiling without modification.
collectResourceDocs sorts descending by version, so v3.0.0 http4s docs now appear first in OBPAPI3_0_0.allResourceDocs — index 0 is no longer a Lift doc. Use OBPAPI2_2_0.allResourceDocs.head instead, which is guaranteed to be a Lift doc until v2.2.0 APIMethods are stubbed.
eb43bf0 to
fc57a5f
Compare
…Lift # Conflicts: # obp-api/src/main/scala/code/api/v4_0_0/APIMethods400.scala
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



No description provided.