FIX: Copy the owid in the FodId constructor, not just fromOwid#170
Merged
Merged
Conversation
Jamesr51d
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the 51Did reader (#166), addressing a review point from Eugene on the PHP port (pipeline-php-did#2) and propagating the fix for cross-port consistency (per the review guidelines).
Problem
FodId.fromOwidalready copies the owid, but the public constructornew FodId(owidInstance)still aliased the caller's instance (this._owid = owidInstance). An owid instance is mutable, sonew FodId(o)followed by mutatingoreintroduced exactly the cached-hashvs live-payloaddesync thatfromOwidwas fixed to prevent. Java already avoids this (its constructor is private andOwidisfinal); Node and Python shared the gap.Fix
Copy the owid in the constructor (re-parse from its base64), so every construction path is decoupled from the caller's instance:
fromOwidnow simply delegates to the constructor (single copy site).Test
Adds a
constructor is decoupled from the source owidtest (mirrors the existingfromOwiddecouple test, but via the public constructor). Full suite: 33/33 pass.