Repository navigation
Conversation
79ddab9 to
5dbfd53
Compare
Aman-Mittal
left a comment
There was a problem hiding this comment.
Reviewed the whole diff against develop at feb1ba4. The refactor itself is behaviour-preserving on every path that executes today, and all 94 checks are green — blocked is the review gate, not a failure. Comments inline; summarising what I think needs an answer before this lands, since eight more PRs stack on it.
Config, worth fixing here
application.properties:905hasFINERACT_COMMAND_PROCESSORS_SERVLET_HEADER_ENABLED(singular) where the test properties and the description say..._SERVLET_HEADERS_ENABLED. The provider file wins at runtime, so the documented switch doesn't exist.- The old hook property and env var names shipped in 1.16.0 and 1.16.1, and the new dispatcher is live on released endpoints. An operator who had set
FINERACT_COMMAND_PROCESSORS_AUDIT_ERROR=falsegets the hook back silently. A nested fallback or an upgrade note would cover it. CommandPropertiesdeclares the three core hookstruewhile their@ConditionalOnPropertyhas nomatchIfMissing, so an unset property means the hook isn't registered. The javadoc you added toAuditCommandPropertiesdescribes this exact trap, and the audit hooks did getmatchIfMissing.
Contract questions the stack depends on
skipExecution/skipHookshave no tests — 12 grep hits, all production. Given steps 7-9 build on them, coverage in all three dispatchers seems worth having now.AuditCommandHookErrorguards onskipExecution;AuditCommandHookBeforedoesn't. On a replay that means a second row under the same idempotency key, and sinceidempotency_keycarries only a plain index, the symptom isfindOneByIdempotencyKeythrowingIncorrectResultSizeDataAccessExceptionfrom then on rather than a constraint error.checkRequestInstanceByKeyreadsgetResponse(). Unused today, so nothing catches it; steps 6-9 will.ctxis created outside the returnedSupplier, so it's now single-use. Every caller invokes it once, so it's latent — but it's an unstated constraint onCommandDispatcher.
Checked, no action needed — @Builder.Default does survive Lombok's no-args constructor (verified on 1.18.46), so the new properties.getTimeout() can't NPE; the four removed CommandStore methods had no callers on develop; @InheritInverseConfiguration resolves unambiguously to the single-source map(Command<?>); the @Retry fallback signature tracks correctly; hooks.adoc includes the interfaces by line range so the docs follow the signature change; and dropping the unused CommandMapper from TemplateDomainServiceImpl is a genuine cleanup. On the disruptor change — publishing in finally is the right idiom and shouldn't be "fixed" into the try, since an unpublished claimed sequence stalls the ring buffer permanently; the new comment explaining why the future is handed back before publication is the kind of thing I wish more of this module had.
Nothing here is an objection to the approach — handing hooks a context instead of positional arguments is clearly the right shape, and splitting #6871 into nine reviewable steps made this reviewable at all.
Aman-Mittal
left a comment
There was a problem hiding this comment.
Some comments from my side
Command hooks now receive a CommandContext - the command, its response, its error and its state - instead of separate arguments, so a before hook can mark a command as handled (skipExecution) and have the dispatcher return a response it supplied, and can stop the remaining hooks (skipHooks). The synchronous, async and disruptor dispatchers all honour it; the disruptor dispatcher hands each command a fresh future before publishing its slot. Each command module gets constants for its properties, and the hook switches move under the module they belong to (fineract.command.audit.hook-*-enabled, fineract.command.hook-*-enabled). The audit module reports at startup which of its hooks are on. The JDBC store is renamed to its Jdbc*/Json* types and stores a CommandContext. The webhook command hooks are adapted to the new hook interface. Step 1 of 9 of FINERACT-2485. Co-authored-by: Aleksandar Vidakovic <aleks@apache.org>
5dbfd53 to
fee7367
Compare
|
Re-reviewed on What I verified:
The new tests are the ones I asked for plus two I had not thought of: Two points you answered rather than changed, both reasonably, recorded here so they are not re-litigated later: keeping the startup failure when audit is on with no CI is green on this head, 95 checks. Nothing further from me on this step. |
Step 1 of 9 of FINERACT-2485 — splitting #6871 into reviewable pieces. Merge in step order.
Based on
develop; this is the first step.What this step does
Command hooks receive a
CommandContext(command, response, error, state) instead of separate arguments. A before hook can mark the command as handled (skipExecution) so the dispatcher returns a response the hook supplied, and can stop the remaining hooks (skipHooks). The synchronous, async and disruptor dispatchers all honour it; the disruptor dispatcher also hands each command a fresh future before publishing its slot.fineract.command.audit.hook-pre|post|error-enabled,fineract.command.hook-servlet-headers|timestamp|username-enabled.AuditCommandPropertyCheck).JdbcCommandRepository,JdbcCommandMapper,JsonCommandMapper) and the store takes aCommandContext.CommandStoreis reduced tostore(CommandContext): its lookups had no callers, and step 5 adds the ones idempotency uses.fineract-core) are adapted to the new interface.Behaviour is otherwise unchanged: the idempotency key header is still read and recorded, as on
develop.This carries the hook and module refactoring from #6231 by Aleksandar Vidakovic (credited as co-author).
Upgrade notes
fineract.command.hooks.*tofineract.command.audit.hook-pre|post|error-enabledandfineract.command.hook-servlet-headers|timestamp|username-enabled. The environment variables get an_ENABLEDsuffix, e.g.FINERACT_COMMAND_PROCESSORS_AUDIT_POST→FINERACT_COMMAND_PROCESSORS_AUDIT_POST_ENABLED, and..._SERVLET_HEADER_PRE→..._SERVLET_HEADERS_ENABLED. The 1.16.x variables are still read as a fallback when the new one is unset. Setting the old property names directly no longer has any effect. All hooks default to enabled.fineract-command-audit.fineract.command.audit.enabledand the three audit hook switches default totrue(matchIfMissing = true), and so do the three core hooks.fineract-providersets these explicitly, so a Fineract deployment is unaffected. An application that embedsfineract-command-auditwithout setting the property now audits, and needs aCommandStorebean (e.g.fineract-command-jdbc) orfineract.command.audit.enabled=falseto start.Verified
fineract-command,-jdbc,-audit,-async,-disruptorbuilds with tests;fineract-corewebhook hook tests;fineract-providercommand and template tests; checkstyle and spotless. Not verified on a running Fineract instance.Stack
Umbrella and history: #6871.