Skip to content

Switch prod II instance to the Phase-2 handshake protocol (same as beta) - #63

Merged
aterga merged 2 commits into
mainfrom
claude/prod-ii-handshake-protocol-cnailp
Jul 16, 2026
Merged

aterga merged 2 commits into
mainfrom
claude/prod-ii-handshake-protocol-cnailp

Conversation

@aterga

@aterga aterga commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

What

Flip the production II instance's default connect protocol from v1 (fetched key) to the Phase-2 registration-delegation handshake, so prod now matches beta.

Why

Beta already defaults to the new registration-delegation handshake; this brings production in line. The deploy config (deploy/native/mcp-poc.service) does not set MCP_REGISTRATION_DELEGATION_PROD, so the code default is authoritative — the switch is a one-line default change from false to true, plus the docs/tests that asserted the old default.

Changes

  • src/identities.rs — IiInstance::prod() now defaults registration_delegation to env_flag("MCP_REGISTRATION_DELEGATION_PROD", true). Operators can still fall back to v1 with MCP_REGISTRATION_DELEGATION_PROD=0. Updated the prod() and IiInstance::registration_delegation doc comments (and corrected the stale provisional regkey/flow param name to the reconciled registration_key). The instance_defaults_are_valid test now asserts prod defaults to the new protocol.
  • src/auth.rs — module docs and the per-instance test comments no longer describe prod as pinned to v1.
  • README.md — the Phase-2 section documents prod on by default, same as beta.

Safety

Enabling Phase 2 for an instance is outbound-compatible with v1: it only adds the registration_key param to the II link and turns on the pinned callback page + redeem routes, while every v1 handler (the callback POSTs, /oauth/finish) stays live. A production II frontend that has not yet shipped the new flow ignores the extra param and completes v1 unchanged. /version continues to report registration_delegation: { beta, prod } so operators can confirm the running protocol per instance.

Testing

  • cargo test: 124 passing.
  • cargo clippy --all-targets: no new warnings (pre-existing warnings only, in files this change does not touch).

🤖 Generated with Claude Code

https://claude.ai/code/session_01VDK8zySPze2LZKqZxCB7Dc


Generated by Claude Code

Flip the production instance's default connect protocol from v1 (fetched
key) to the Phase-2 registration-delegation flow, matching beta. The deploy
config does not set MCP_REGISTRATION_DELEGATION_PROD, so the code default is
authoritative: change it from false to true.

- identities.rs: prod() now defaults registration_delegation to
  env_flag("MCP_REGISTRATION_DELEGATION_PROD", true); operators can fall
  back to v1 with MCP_REGISTRATION_DELEGATION_PROD=0. Doc comments on prod()
  and the IiInstance::registration_delegation field updated (and the stale
  provisional regkey/flow param name corrected to registration_key). The
  instance_defaults_are_valid test now asserts prod defaults to the new
  protocol.
- auth.rs: module docs and the per-instance test comments no longer describe
  prod as pinned to v1.
- README.md: the Phase-2 section documents prod on by default, same as beta.

Enabling stays outbound-compatible with v1 — it only adds the
registration_key param to the II link and turns on the pinned callback +
redeem routes, while every v1 handler stays live — so a production II
frontend that has not yet shipped the new flow still completes v1 unchanged.

cargo test: 124 passing; no new build/clippy warnings.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VDK8zySPze2LZKqZxCB7Dc
@aterga
aterga requested a review from Copilot July 16, 2026 20:17
@aterga
aterga marked this pull request as ready for review July 16, 2026 20:18

Copilot AI left a comment

Copy link
Copy Markdown

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 switches the production Internet Identity (II) instance to default to the Phase-2 registration-delegation handshake (matching beta), with corresponding updates to documentation and default-behavior tests.

Changes:

  • Flip IiInstance::prod() default for registration_delegation to true (with env override MCP_REGISTRATION_DELEGATION_PROD=0 to fall back to v1).
  • Update Phase-2 documentation in src/auth.rs and README.md to reflect prod’s new default.
  • Update the instance-defaults test to assert prod uses the Phase-2 protocol by default.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/identities.rs Changes prod instance default to Phase 2 and updates related doc comments + default assertions.
src/auth.rs Updates Phase-2 module/test comments to reflect prod being Phase 2 by default.
README.md Updates public docs to describe prod as Phase 2 on by default and how to disable via env var.

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

Comment thread src/auth.rs Resolved
In auth_callbacks_declares_link_callbacks_verbatim, registration_delegation
was derived from oauth_prefix (prefix.is_empty()), coupling the protocol
flag to an unrelated value — confusing now that prod also defaults to Phase
2, and brittle if prefixes change or instances are added. Pass the flag
explicitly to the `make` helper so the test's intent (cover one v1 and one
v2 instance) is clear and independent of the prefix. Behavior is unchanged:
the allow-list document is prefix-derived, and the per-instance link
assertions already call ii_mcp_url_v2/ii_mcp_url explicitly.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VDK8zySPze2LZKqZxCB7Dc
Copilot AI review requested due to automatic review settings July 16, 2026 20:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@aterga
aterga merged commit dd4ca41 into main Jul 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants