Skip to content

refactor(canvas): migrate Hub connection modules to TypeScript - #53

Merged
lukasoppermann merged 9 commits into
mainfrom
lukasoppermann-canvas-typescript-hub-connection
Oct 22, 2026
Merged

lukasoppermann merged 9 commits into
mainfrom
lukasoppermann-canvas-typescript-hub-connection

Conversation

@lukasoppermann

Copy link
Copy Markdown
Contributor

Why

The canvas extension is moving its authored Node code to strict TypeScript while keeping its installable JavaScript runtime. This is layer 3 of that migration, built on #52, and covers the Hub connection without changing the user flow.

What changes

Adds TypeScript sources for the Hub client, origin validation and selection, private credentials, repository discovery, connection coordination, and learnings hook. External JSON is checked before use, and client responses retain unknown field values for consuming workflows to validate. The client exports reusable connection, request, status, and recall types.

Commits generated sibling .mjs modules and keeps existing JavaScript imports and the extension.mjs entry point. Approval, renewal, request timing, and prompt-data minimization retain their existing flow. Adds focused malformed-data coverage and updates the contributor guide. Publishing, review workflows, local servers, SDK registration, and browser UI remain outside this layer.

lukasoppermann and others added 3 commits October 21, 2026 14:25
Convert remote branch lookup to strict TypeScript while retaining its generated JavaScript runtime. Include migrated modules in lint, type checks, and plugin freshness checks.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9d7306a9-9831-4c78-89e7-3c5b581c895e
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1aff284a-77f1-4bcf-8245-e30889a2f392
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2e9f29a3-a43f-469a-a5aa-8318559d915a

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.

🟡 Changes recommended

Pending approvals with a null refresh token become unreadable, blocking connection completion.

1 open issue
What changed in this PR

Continues the canvas extension’s strict TypeScript migration for Hub connections while preserving its installable JavaScript runtime.

Changes:

  • Adds typed Hub clients, connection coordination, discovery, origin handling, and learnings hooks.
  • Strengthens external-data checks and adds malformed-data coverage.
  • Commits generated runtime modules and updates contributor guidance.
File Description
hub/​docs/​prototype-canvas.md Documents migration boundaries and validation contracts.
.github/​extensions/​replica-prototype/​read-hub-object/​index.mts Adds an unknown-object reader.
.github/​extensions/​replica-prototype/​read-hub-object/​index.mjs Generated object-reader runtime.
.github/​extensions/​replica-prototype/​read-hub-error/​index.mts Adds typed error normalization.
.github/​extensions/​replica-prototype/​read-hub-error/​index.mjs Generated error-reader runtime.
.github/​extensions/​replica-prototype/​parse-hub-url/​index.mts Migrates URL validation to TypeScript.
.github/​extensions/​replica-prototype/​parse-hub-url/​index.mjs Refreshes generated URL parser.
.github/​extensions/​replica-prototype/​normalize-selected-hub-origin/​index.mts Types manual origin normalization.
.github/​extensions/​replica-prototype/​normalize-selected-hub-origin/​index.mjs Refreshes generated selection normalizer.
.github/​extensions/​replica-prototype/​normalize-hub-origin/​index.mts Types strict origin normalization.
.github/​extensions/​replica-prototype/​normalize-hub-origin/​index.mjs Updates generated origin normalizer.
.github/​extensions/​replica-prototype/​invalid-hub-origin/​index.mts Types origin errors and status metadata.
.github/​extensions/​replica-prototype/​discover-hub/​index.test.mjs Covers malformed GitHub responses.
.github/​extensions/​replica-prototype/​discover-hub/​index.mts Types discovery and cached-data checks.
.github/​extensions/​replica-prototype/​discover-hub/​index.mjs Updates generated discovery runtime.
.github/​extensions/​replica-prototype/​create-learnings-hook/​index.mts Types recall validation and session tracking.
.github/​extensions/​replica-prototype/​create-learnings-hook/​index.mjs Updates generated learnings hook.
.github/​extensions/​replica-prototype/​create-hub-origin-store/​index.test.mjs Covers malformed saved selections.
.github/​extensions/​replica-prototype/​create-hub-origin-store/​index.mts Types origin storage and validation.
.github/​extensions/​replica-prototype/​create-hub-origin-store/​index.mjs Updates generated origin store.
.github/​extensions/​replica-prototype/​create-hub-connection/​index.mts Types connection selection and coordination.
.github/​extensions/​replica-prototype/​create-hub-connection/​index.mjs Updates generated connection coordinator.
.github/​extensions/​replica-prototype/​create-hub-client/​stored-credentials.test.mjs Covers malformed credentials and connection identities.
.github/​extensions/​replica-prototype/​create-hub-client/​index.mts Adds typed client contracts and boundary checks.
.github/​extensions/​replica-prototype/​create-hub-client/​index.mjs Updates generated Hub client.

Review effort: Max

@lukasoppermann
lukasoppermann added this pull request to stack #58 October 21, 2026 13:49
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 2e9f29a3-a43f-469a-a5aa-8318559d915a
Base automatically changed from lukasoppermann-canvas-typescript-infrastructure to main October 22, 2026 06:14
lukasoppermann and others added 2 commits October 22, 2026 08:14
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2e9f29a3-a43f-469a-a5aa-8318559d915a
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 2e9f29a3-a43f-469a-a5aa-8318559d915a
@lukasoppermann
lukasoppermann force-pushed the lukasoppermann-canvas-typescript-hub-connection branch from 80d9a74 to 552b466 Compare October 22, 2026 06:14
…-hub-connection' into lukasoppermann-canvas-typescript-hub-connection
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2e9f29a3-a43f-469a-a5aa-8318559d915a
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2e9f29a3-a43f-469a-a5aa-8318559d915a
@lukasoppermann
lukasoppermann merged commit 49958cb into main Oct 22, 2026
40 checks passed
@lukasoppermann
lukasoppermann deleted the lukasoppermann-canvas-typescript-hub-connection branch October 22, 2026 17:03
lukasoppermann added a commit that referenced this pull request Oct 22, 2026
<!-- Use a conventional commit-style title, such as "fix(hub): retain
prototype history". -->

## Why

<!-- Explain the problem and why this change matters in a short,
plain-English paragraph. Link the issue when applicable. -->

This is layer 4 of the canvas extension TypeScript migration, following
#53. Publication and status orchestration need checked contracts before
the remaining review and server modules can migrate.

## What changes

<!-- Describe what becomes different for a first-time reader. Explain
necessary terms. Include accurate Mermaid diagrams when they clarify the
proposal, using before/after diagrams when helpful. Add screenshots for
meaningful UI changes. -->
<!-- Omit validation sections, checklists, and routine test/CI summaries
such as "CI is green" or "tests passed". Mention only known verification
gaps that affect the change, not disclaimers about drafting this
description. -->

Move publication targets, preferences, preparation, requests, results,
prototype state refresh, repository status, and working-tree checks to
strict TypeScript. Keep generated sibling JavaScript files and existing
import URLs so installed plugins need no compiler or loader. Publishing
permissions, target matching, request deduplication, and workflow
evidence stay unchanged.

Check saved publication fields at their consuming boundary without
replacing unrelated fields or legacy requests. Export the contracts from
their owning modules, retain unknown external fields until checked, add
runtime coverage for malformed saved state and external responses, and
update the contributor guide. Review, sharing, local servers, and SDK
registration remain for later layers.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9d7306a9-9831-4c78-89e7-3c5b581c895e
Copilot-Session: 1aff284a-77f1-4bcf-8245-e30889a2f392
Copilot-Session: 2e9f29a3-a43f-469a-a5aa-8318559d915a
Copilot-Session: dbbad477-1ff0-4721-b2a8-01308dc63448
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