Skip to content

Install TypeScript LSP from a pinned npm lockfile - #79888

Merged
pelikhan merged 7 commits into
mainfrom
pelikhan/reproducible-typescript-lsp-installs
Nov 21, 2026
Merged

pelikhan merged 7 commits into
mainfrom
pelikhan/reproducible-typescript-lsp-installs

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

The generated TypeScript LSP setup uses npm install -g, which does not enforce a lockfile. This is the compiler-side fix for code-scanning alerts 1082, 1083, and 1084.

The compiler now embeds the full SHA-512-verified npm lockfile and emits npm ci in an isolated runner directory. The install honors the runner's npm registry and keeps the language server and TypeScript binaries on PATH. On Windows, the compiler forwards npm settings to the built-in WSL installer without adding them to agent steps.

Compatibility: The experimental built-in lsp.typescript entry now accepts only the bundled server version (4.3.3). To use another version, move the entry to lsp.typescript-custom, install from a checked-in npm lockfile in pre-agent-steps, and point command to the installed executable.

Validation: Focused Go and parser tests and ShellCheck passed. The installed server initialized with TypeScript 5.8.3 in an empty workspace. Windows-specific regression tests cover WSL and Git Bash path conversion and a registry override from an earlier step; no live Windows workflow was run. The original full compile covered all 370 workflows and identified drift in eslint-miner, jsweep, and smoke-copilot. This PR leaves their generated locks unchanged for regeneration after SDK integration. No workflows were dispatched and no alert states were changed.

ADR: ADR-79888: Install TypeScript LSP from a Pinned npm Lockfile

@pelikhan
pelikhan marked this pull request as ready for review November 21, 2026 21:15
Copilot AI adaptive review requested due to automatic review settings November 21, 2026 21:15
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #79888 · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #79888 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

This comment has been minimized.

@github-actions github-actions Bot 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.

Found two blocking issues in the bundled TypeScript LSP install:

  • The embedded npm lockfile omits the language server transitive runtime dependencies, so npm ci cannot reliably produce a working server.
  • The Windows path branch invokes wslpath from a Git Bash step, which is not guaranteed to exist and will fail under set -e.

Static review only; repository tests were not run per review instructions.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

Comment thread pkg/workflow/lsp_typescript.go Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-dc87f0ff-e135-4cd6-975e-af88d6bf0b69","parents":[],"payload":{"id":"ldg-af79d856-d7b1-41ed-b4a6-c508d01e89c9","operation":"append","value":{"finding_count":0,"head_sha":"dc2a0fbd92960c4ff40a53be1a28073bb74465ca","outcome":"aligned"}},"sha":"sha256:056aa4907446dc62e577241e956e08a2e524eeab88a55af18c4b3a6563480a12","timestamp":"2026-11-21T21:22:29.101Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (166 added lines under pkg/, above the 100-line threshold) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/79888-install-typescript-lsp-from-pinned-npm-lockfile.md. Review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch. It was generated from the PR diff.

  2. Complete the missing sections: add context the AI couldn't infer, refine the decision rationale, and list real alternatives you considered.

  3. Resolve the [TODO: verify] markers in the draft (listed below).

  4. Commit the finalized ADR to docs/adr/ on your branch.

  5. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-79888: Install TypeScript LSP from a Pinned npm Lockfile (link unavailable: invalid HTTPS URL)

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

🔍 Evidence and open items

Checked: the PR has no implementation label. pkg/ contributes 166 added lines, and no .design-gate.yml is present. The PR body links no ADR and no closing issue. No file under docs/adr/ references PR #79888 or the TypeScript LSP.

Decision: install the built-in TypeScript language server with npm ci from a compiler-embedded, SHA-512-verified lockfile, replacing npm install -g. Driver: supply-chain integrity (code-scanning alerts 1082–1084). Breaking change: lsp.typescript.version now accepts only 4.3.3.

Open [TODO: verify] items in the draft:

  • Deciders (the draft lists the PR author only).
  • Alternative 2 (resolve versions at install time). The rationale is inferred, not stated in the PR.
  • Alternative 3 (remove the built-in entry). The rationale is inferred, not stated in the PR.
❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say I'll deal with this later. Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

References: §44950599438

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-f9e758cc-fbd9-4d1d-aadf-bd8941966432","parents":[],"payload":{"id":"ldg-f427bc0c-4600-4535-9a41-b323c8920ed5","operation":"append","value":{"finding_count":2,"head_sha":"dc2a0fbd92960c4ff40a53be1a28073bb74465ca","outcome":"findings"}},"sha":"sha256:c0846b95ba59ccb033ea4793c043f459f80bd82e5a1856bf83b2e45f68346548","timestamp":"2026-11-21T21:23:08.962Z","type":"ledger_append","version":1}
History

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

The Windows WSL installer does not forward runner-provided npm registry and credential settings, so installs can fail when only an authenticated mirror is accessible.

3 open issues
1 file not reviewed
  • pkg/workflow/lsp/typescript/package-lock.json: Generated file
What changed in this PR

Replaces gh-aw’s generated global TypeScript LSP install with a lockfile-based install for Copilot workflows, addressing the reported code-scanning concerns.

Changes:

  • Bundles exact TypeScript and language-server versions with SHA-512 integrity metadata and installs them using npm ci.
  • Stages binaries in an isolated runner directory and restores their PATH during Copilot startup.
  • Restricts built-in server version overrides and updates tests, schema descriptions, and migration guidance.
File Description
pkg/​workflow/​lsp/​typescript/​package.json Pins both TypeScript dependencies.
pkg/​workflow/​lsp/​typescript/​package-lock.json Locks package downloads and integrity hashes.
pkg/​workflow/​lsp/​typescript/​.npmrc Configures the bundled npm project’s registry.
pkg/​workflow/​lsp_validation.go Enforces the bundled server version.
pkg/​workflow/​lsp_validation_test.go Tests accepted versions and custom-server migration.
pkg/​workflow/​lsp_typescript.go Embeds npm files and generates isolated installation and PATH setup.
pkg/​workflow/​lsp_manager.go Routes TypeScript through the locked installer and shares npm policy handling.
pkg/​workflow/​lsp_manager_test.go Updates installation and version-override assertions.
pkg/​workflow/​copilot_engine_execution.go Restores the staged LSP PATH before execution.
pkg/​workflow/​copilot_engine_execution_test.go Checks generated PATH restoration.
pkg/​parser/​schemas/​main_workflow_schema.json Clarifies version-override restrictions.
docs/​src/​content/​docs/​reference/​glossary.md Documents locked installation and custom-version migration.
CHANGELOG.md Records the breaking compatibility change.
.github/​aw/​lsp.md Updates installation details and the custom-server example.
.changeset/​lock-typescript-lsp.md Adds major-release notes and migration guidance.

Review effort: Max (adaptive)

Comment thread pkg/workflow/lsp_typescript.go Resolved
Comment thread .github/aw/lsp.md Resolved
Comment thread .github/aw/lsp.md Resolved

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /codebase-design. Requesting changes on one likely Windows break and one dead file. The pinned-lockfile direction is sound.

📋 Key Themes & Highlights

Key Themes

  • Dead artifact: pkg/workflow/lsp/typescript/.npmrc is never embedded or copied, and it commits an internal registry URL.
  • Untested Windows branch: the wslpath path in lsp_typescript.go runs in a shell: bash step with no test coverage.
  • Scope creep: the sort to slices swap in lsp_manager.go is unrelated to this PR.

Positive Highlights

  • ✅ Pinning typescript and typescript-language-server through an embedded lock with npm ci removes the floating npm install -g risk.
  • ✅ The breaking lsp.typescript.version restriction has a clear error message, a major changeset, and tests in lsp_validation_test.go.
  • ✅ The PATH restore is covered by copilot_engine_execution_test.go.

Unverified

  • I could not confirm that [email protected] has zero transitive dependencies or that the lock integrity hashes match the registry. The sandbox rejects the registry TLS certificate. The lock lists no nested packages, so please confirm with npm ci on a clean runner.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread pkg/workflow/lsp/typescript/.npmrc Resolved
Comment thread pkg/workflow/lsp_typescript.go Resolved
Comment thread pkg/workflow/lsp_manager.go Resolved
@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to comment 7069356754: I addressed the Windows path finding, clarified why the npm config is kept for local maintenance, and explained the linter requirement in the sorting thread.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to comment 7069358365: I addressed both inline findings: the Windows installer now supports both path converters, and a clean install confirmed the two-package lockfile is complete.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to comment 7069358401: This status update has no separate change request. I addressed the concrete findings in their inline threads.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to comment 7069359094: No separate change was requested here. The follow-up adds focused coverage for Windows path handling and npm configuration forwarding.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to comment 7069359352: No separate change was requested by this review summary.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to comment 7069360143: I completed the ADR draft from 603cb1d and linked it in the PR body. Its status remains Proposed pending maintainer review.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to comment 7069427936: This is a review history record, not a change request; the ledger is unchanged.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to comment 7069435029: I completed and linked ADR-79888 in the PR body, including the lockfile rationale, alternatives, and migration path. The ADR remains Proposed rather than claiming maintainer approval.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to comment 7069435810: This is a review history record; I left it unchanged and replied to the code-quality findings in their inline threads.

@pelikhan
pelikhan merged commit d278561 into main Nov 21, 2026
91 checks passed
@pelikhan
pelikhan deleted the pelikhan/reproducible-typescript-lsp-installs branch November 21, 2026 23:02
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.

2 participants