Skip to content

fix(registry): Handle ReplicaVersion conversion errors.#10851

Merged
daniel-wong-dfinity-org-twin merged 2 commits into
masterfrom
do-not-ignore-ReplicaVersion-conversion-error-daniel-wong
Jul 21, 2026
Merged

fix(registry): Handle ReplicaVersion conversion errors.#10851
daniel-wong-dfinity-org-twin merged 2 commits into
masterfrom
do-not-ignore-ReplicaVersion-conversion-error-daniel-wong

Conversation

@daniel-wong-dfinity-org-twin

@daniel-wong-dfinity-org-twin daniel-wong-dfinity-org-twin commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Originally, problems were swept under the rug: if ReplicaVersion::try_from returned Err, it would be treated the same as if there were no SubnetRecord at all.

Since replica_version_id is validated, this wouldn't change behavior. This just makes the code more defensive.

👈 Previous PR | Next PR 👉

@daniel-wong-dfinity-org-twin
daniel-wong-dfinity-org-twin requested a review from a team as a code owner July 21, 2026 12:59
@github-actions github-actions Bot added the fix label Jul 21, 2026
@zeropath-ai

zeropath-ai Bot commented Jul 21, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 09ba52a.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/registry/helpers/src/subnet.rs
    Implement enhanced error handling for replica_version_id parsing and add tests for illegal characters in ReplicaVersion parsing

@daniel-wong-dfinity-org-twin daniel-wong-dfinity-org-twin changed the title fix(registry): Handle ReplicaVersion conversion errors. DO NOT MERGE target branch is not master fix(registry): Handle ReplicaVersion conversion errors. Jul 21, 2026
@daniel-wong-dfinity-org-twin
daniel-wong-dfinity-org-twin force-pushed the do-not-ignore-ReplicaVersion-conversion-error-daniel-wong branch from 4d5a24f to 8ccaebc Compare July 21, 2026 13:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes SubnetRegistry::get_replica_version fail loudly (with DecodeError) when a replica_version_id string cannot be converted into a ReplicaVersion, instead of silently treating the subnet as if it had no record.

Changes:

  • Document an additional DecodeError case for invalid replica version IDs.
  • Replace ReplicaVersion::try_from(...).ok() with explicit error propagation and contextual error messages for invalid replica_version_id values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rs/registry/helpers/src/subnet.rs
Base automatically changed from update-replica_version_id-readers-daniel-wong to master July 21, 2026 14:58
@daniel-wong-dfinity-org-twin
daniel-wong-dfinity-org-twin requested a review from a team as a code owner July 21, 2026 14:58
github-actions[bot]

This comment was marked as resolved.

@daniel-wong-dfinity-org-twin
daniel-wong-dfinity-org-twin force-pushed the do-not-ignore-ReplicaVersion-conversion-error-daniel-wong branch from 6a33c38 to 09ba52a Compare July 21, 2026 18:02
@daniel-wong-dfinity-org-twin daniel-wong-dfinity-org-twin changed the title DO NOT MERGE target branch is not master fix(registry): Handle ReplicaVersion conversion errors. fix(registry): Handle ReplicaVersion conversion errors. Jul 21, 2026
@daniel-wong-dfinity-org-twin
daniel-wong-dfinity-org-twin added this pull request to the merge queue Jul 21, 2026
pull Bot pushed a commit to mikeyhodl/ic that referenced this pull request Jul 21, 2026
When determining what replica version an engine is supposed to run (and
it doesn't explicitly specify one).

# Future Work

Orchestrator does not use this. That will be fixed in an imminent PR.

# References

[👈 Previous PR][prev] | [Next PR 👉][next]

[prev]: dfinity#10787
[next]: dfinity#10851

---------

Co-authored-by: Daniel Wong <daniel.wong@dfinity.org>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Merged via the queue into master with commit 19a3d01 Jul 21, 2026
40 of 41 checks passed
@daniel-wong-dfinity-org-twin
daniel-wong-dfinity-org-twin deleted the do-not-ignore-ReplicaVersion-conversion-error-daniel-wong branch July 21, 2026 19:25
pull Bot pushed a commit to bit-cook/ic that referenced this pull request Jul 22, 2026
…a thin wrapper... (dfinity#10857)

... around the `get_replica_version` (same name) method of
`RegistryClient`.

This builds on [PR 10840], where we started to become aware of
`StandardEngineReplicaVersionRecord`.

[PR 10840]: dfinity#10840

[👈 Previous PR][prev]

[prev]: dfinity#10851

---------

Co-authored-by: Daniel Wong <daniel.wong@dfinity.org>
Co-authored-by: IDX GitHub Automation <infra+github-automation@dfinity.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants