The change below is in a service that stores working drafts and returns a snapshot for the UI. After the fix, some requests started producing unexpectedly changing results between calls.
DraftRegistry must store one draft per draftId.draftId must replace the old entry, not create duplicates.snapshot() must return an independent copy of the data that cannot be used to modify the registry's internal state.registry.register(new Draft("d-1", Map.of("title", "A")));
d-1 again with new fields and check the snapshot size.snapshot() must not affect subsequent responses.draftId.javac/java without additional frameworksUse line comments to explain the problem, its impact, the fix and how to test it.