URI handler (1/3): route-map refactor + deep-link constants#1625
Closed
amitjoshi438 wants to merge 1 commit into
Closed
URI handler (1/3): route-map refactor + deep-link constants#1625amitjoshi438 wants to merge 1 commit into
amitjoshi438 wants to merge 1 commit into
Conversation
Convert `UriHandler.handleUri` from an if/else chain into a `ReadonlyMap<string, UriRouteHandler>` built in the constructor. The two existing paths (`/pcfInit`, `/open`) keep identical behavior; unrecognized paths are now ignored for forward compatibility instead of falling through. Add the versioned deep-link contract constants that the Power Pages home page will use to launch VS Code: - reserved paths `/agenticCreate` and `/pacCreate` (registered but not yet wired to any handler) - shared params `region`, `tenantid`, `source`, `agenthost`, `v` - enumerated `SOURCE_VALUES`, `AGENT_HOST_VALUES`, and `CONTRACT_VERSION` Export the `UriHandler` class so dispatch can be covered by an integration test. Adds a pure unit test asserting the constants contract and an integration test asserting each path routes correctly (including the reserved/unknown no-op paths). This change is behavior-preserving and ships dark: no new user-facing behavior. Follow-up PRs extract shared auth/env helpers and add the flag-gated skeleton handlers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
Author
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.
PR 1 of 3 — Phase 0–1 foundation for the Power Pages → VS Code "create" deep links. Behavior-preserving refactor; no user-facing change.
Why
We're adding two new deep links launched from the Power Pages home page that open VS Code into a create experience:
vscode://…/agenticCreate— agentic flow (terminal CLI agent host carrying the Power Pages plugin)vscode://…/pacCreate— PAC CLI flowBefore wiring any of that behavior, this PR lays the routing + contract foundation so the follow-ups stay small and reviewable. Everything in the full effort ships dark (ECS-gated, off by default); this PR alone changes no behavior at all.
What changed
uriHandler/uriHandler.ts— replaced thehandleUriif/elsechain with aReadonlyMap<string, UriRouteHandler>route table built in the constructor and dispatched byuri.path. Unknown paths are a no-op (forward-compatible). Exported theUriHandlerclass so it's unit-addressable./openand/pcfInitdispatch to the exact same code as before.uriHandler/constants/uriConstants.ts— added the versioned, secret-free deep-link contract: new paths (/agenticCreate,/pacCreate), params (region,tenantid,source,agenthost,v), value/version constants (SOURCE_VALUES,AGENT_HOST_VALUES,CONTRACT_VERSION), and the matchingUriPathenum members. No handlers consume the new paths yet.Tests
test/unit/uriConstants.test.ts(new) — pure/no-vscodeunit coverage of the contract constants.test/integration/uriHandler.test.ts(new) — asserts/openand/pcfInitstill route to their handlers and unknown paths are ignored.Design notes
vscode://URL is treated as a versioned contract (v=1) so the Power Pages home page and the extension can evolve independently.Validation
gulp lintclean ·compile-testsclean ·npm test106 passing ·npm run buildOK.Risk / rollout
Effectively zero: no new path is wired to behavior in this PR, and the two existing paths are dispatched identically. New paths become active only in PR 3, behind ECS gates that default off.
Stack (merge in order)
main— router refactor + deep-link constantsCo-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com