InMemoryFormPersistenceService is JS-only, so no JVM unit spec can use it #50
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/support#50
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
InMemoryFormPersistenceServicelives in the js source set only:So the published
iw-support-forms_3(JVM) jar carries noimpl/InMemory*class at all, whileiw-support-forms_sjs1_3does. Verified byunzip -lon both jars at version0.1.23from a consuming project, and byfdover this repo's own tree.Why it is a problem
A JVM unit spec that needs a
FormPersistenceServicecollaborator cannot construct one, even though the service is a pure in-memory stand-in with no platform-specific behaviour. Every JVM consumer has to hand-roll the same stub.Two such stubs already exist in one downstream project (medeca-modul-poptavky) —
CaseSummaryServiceSpec.scalaandPodejOpravuDokumentaceValidationSpec.scala:43-51— each aget/putpair over a fixed value, written only because the shared implementation is unreachable from the JVM.The absence is also silent in the worst way: the class is visible in the API docs and in the sources, so the natural first move is to import it, and the failure arrives as an unresolved name with no hint that a platform is the reason.
Why it looks like an oversight rather than a decision
The implementation has nothing JS-specific in it — it is a
Ref[Map[FormIdent, SavedForm]]and two ZIO methods:FormPersistenceService, the trait it implements, is already informs/shared/src/main/scala/works/iterative/forms/service/, andforms/shared/.../service/impl/already exists as a directory.Proposed fix
Move the file from
forms/js/src/main/scala/...toforms/shared/src/main/scala/...— same package, same content. It should cross-build unchanged.If there is a reason it was deliberately kept off the JVM, that reason is worth a comment in the file, because the current arrangement reads as an accident.