fix(plugins): harden JAR checksum and guard registry reads#82
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
ChangesPluginRegistryService synchronization
JAR upload checksum ordering
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
P3: compute the upload checksum from the persisted file instead of the multipart stream, so the stored digest matches the bytes that load-time integrity verification re-checks. P5: synchronize getPlugins/getPlugin/getPluginBySource on the pluginsByJobName monitor (matching getRegisteredJobNames) so reads no longer race with concurrent register/unregister mutations; getPlugins now returns an immutable snapshot. Add JarUploadServiceTest covering the checksum invariant (first test for the service).
ee0e267 to
526196d
Compare

PR-A — Plugin engine hygiene (P3 + P5)
First slice of the plugin-engine backbone backlog (deep-dive audit, executable view "La vida de un JAR"). Two small, verified, self-contained fixes.
P3 — checksum reflects the persisted artifact
JarUploadServicecomputed the SHA-256 from the multipart stream before writing to disk. Now it computes it from the stored file (ChecksumUtil.computeSha256(storedPath)), so the persisted digest matches the exact bytes that load-time integrity verification re-checks. Defensive hardening — removes a latent stream-vs-disk divergence rather than fixing a live bug.P5 — guard concurrent registry reads
getPlugins,getPlugin, andgetPluginBySourcereadpluginsByJobNamewithout holding the monitor, racing withregisterDynamicPlugin/unregisterDynamicPlugin(which already synchronize). They now take thepluginsByJobNamemonitor — matching the existinggetRegisteredJobNamespattern.getPluginsreturns an immutable snapshot; the DB lookup ingetPluginBySourcestays outside the lock.Tests
JarUploadServiceTest(the service had zero coverage) locks the P3 invariant: persisted checksum == digest of the bytes on disk, using a real in-memory JAR.Out of scope (deferred)
classloaderRefs) — the audit flagged it as a "dead map to remove", but it is write-only scaffolding for classloader cleanup that P2/PR-C implements. Removing it now would churnregisterDynamicPlugin's signature + its call sites and PR-C would re-add it properly typed. Folded into PR-C.Follow-ups
Summary by CodeRabbit
Bug Fixes
Tests