Fix CID conflicts - #79
Conversation
There was a problem hiding this comment.
Code Review
This pull request resolves MiXCR failures and CIDConflictError by introducing deterministic JSON resource construction and unique template hashes. It adds a canonical-json library to ensure stable CIDs through key-sorted encoding and refactors the reference library routing into a dedicated field. Feedback points out that main.tpl.tengo should use the new canonicalJson.jsonResource for the custom reference library to maintain consistency and ensure CID stability.
| checksumVersion: 1 | ||
| }] | ||
| referenceLibrary = string(json.encode(library)) | ||
| referenceLibrary = smart.createJsonResource(library) |
There was a problem hiding this comment.
To ensure stable CIDs for the custom reference library, you should use canonicalJson.jsonResource here as well. The library object (defined on line 108) contains maps (e.g., anchorPoints), and using smart.createJsonResource (which uses standard json.encode) will result in non-deterministic byte sequences due to random map iteration order in Tengo/Go. This is consistent with the fixes applied to other params resources in this PR.
referenceLibrary = canonicalJson.jsonResource(library)
No description provided.