Skip to content

test(lana): check Retrieve Log reaches Salesforce Services in VS Code Web - #1161

Merged
lcottercertinia merged 2 commits into
certinia:mainfrom
lukecotter:feat-e2e-services-wiring
Oct 8, 2026
Merged

lcottercertinia merged 2 commits into
certinia:mainfrom
lukecotter:feat-e2e-services-wiring

Conversation

@lukecotter

Copy link
Copy Markdown
Collaborator

📝 PR Overview

CI downloads Salesforce Services for the web e2e tests, but no test used it. The only spec opens a sample log, and lana calls Services only from Retrieve Log. A Services release that broke lana's wiring would pass CI.

This PR adds a web e2e test for that wiring. It also corrects two notes that said the e2e tests cannot load Services from the marketplace.

🛠️ Changes made

  • New spec, retrieveLog.web.spec.ts:
    • It runs Log: Retrieve Apex Log And Show Analysis in VS Code Web, with Services installed and no org.
    • It waits for Error loading logfile: …instanceUrl…. Services' own connection layer gives that error, so only a call that got through lana's wiring gets that far. A failed activation, or a call to a method that Services does not have, fails before it.
    • It uses executeCommandWithCommandPalette and waitForNotification from @salesforce/playwright-vscode-ext.
  • DEVELOPING.md and the headlessServer.ts warning: the e2e browser turns off web security (--disable-web-security in createWebConfig), so it loads Services from the marketplace. Only a normal browser on localhost cannot. The warning is also shorter.

🧩 Type of change (check all applicable)

  • 🐛 Bug fix - something not working as expected
  • ✨ New feature – adds new functionality
  • ♻️ Refactor - internal changes with no user impact
  • ⚡ Performance Improvement
  • 📝 Documentation - README or documentation site changes
  • 🔧 Chore - dev tooling, CI, config
  • 💥 Breaking change

🔗 Related Issues

None.

✅ Tests added?

  • 👍 yes

  • 🙅 no, not needed

  • 🙋 no, I need help

  • Both web specs pass with a local Services copy (the path CI uses) and with the marketplace copy.

  • The new test fails, as it should, when lana calls a renamed Services method.

📚 Docs updated?

  • 🔖 README.md
  • 🔖 CHANGELOG.md
  • 📖 help site
  • 🧪 Marked any pre-release-only features (README 🧪 badge — see RELEASING.md)
  • 🙅 not needed

Anything else we need to know? [optional]

The CI download stays. Without it, each test downloads Services (about 7.6 MB) from the marketplace CDN, because each test gets a new browser and Services activates on *. That added about 1.2 s per test.

Found while writing the test, not fixed here:

  • isSalesforceServicesApi cannot detect a renamed Services method. ApexLogService uses Effect accessors, which return a function for any property name, so its typeof … === 'function' checks always pass. A minimum Services version check would work.
  • When lana calls a method that Services does not have, Retrieve Log shows no message. The command fails with no notification.

@lcottercertinia
lcottercertinia merged commit a8e9686 into certinia:main Oct 8, 2026
9 checks passed
lcottercertinia pushed a commit that referenced this pull request Oct 8, 2026
…API (#1162)

# 📝 PR Overview

Follows #1161. When the installed Salesforce Services did not have a
method that lana calls, **Retrieve Log** did nothing and showed no
message.

There were two causes, and they come from one mechanism:

- Services gives its services as Effect tags with accessors. An accessor
tag answers to any method name. For a method that the service does not
have, the call succeeds with `undefined`.
- lana's API check (`isSalesforceServicesApi`) read the methods from
those tags, so the check always passed.
- `RetrieveLogFile` then read the `undefined` result as "the user closed
the picker", and stopped with no message.

This PR makes the check look at the real service instances in
`prebuiltServicesDependencies`. A Services version without the API now
gets lana's existing message, the same notification as when Services is
not installed:

> The installed Salesforce Services extension does not expose the
required Apex log API. Update it and try again. **[Install or Update
Salesforce Services]**

## 🛠️ Changes made

- **`servicesRuntime.ts`:** `isSalesforceServicesApi` gets each service
from the Effect context by its tag, and checks the methods on that
instance.
- **`servicesRuntime.test.ts`:**
- The test API uses real `Effect.Service` tags with accessors, as
Services does.
- New tests: an instance that does not have a method its tag answers to,
and a context that does not have one of the services.
- **`test/playwright/support/logAnalysis.ts`:** `openLogAnalysis` uses
`executeCommandWithCommandPalette`, as the Retrieve Log spec does.

## 🧩 Type of change (check all applicable)

- [x] 🐛 Bug fix - something not working as expected
- [ ] ✨ New feature – adds new functionality
- [ ] ♻️ Refactor - internal changes with no user impact
- [ ] ⚡ Performance Improvement
- [ ] 📝 Documentation - README or documentation site changes
- [ ] 🔧 Chore - dev tooling, CI, config
- [ ] 💥 Breaking change

## 🔗 Related Issues

Follows #1161.

## ✅ Tests added?

- [x] 👍 yes
- [ ] 🙅 no, not needed
- [ ] 🙋 no, I need help

- The two new unit tests fail with the old check and pass with the new
one. All 338 lana tests pass.
- Both web e2e specs pass with the real Services extension.
- With a method name that Services does not have, the e2e run shows the
"Update it" notification above, and the Retrieve Log spec fails, as it
should.

## 📚 Docs updated?

- [ ] 🔖 README.md
- [ ] 🔖 CHANGELOG.md
- [ ] 📖 help site
- [ ] 🧪 Marked any pre-release-only features (README `🧪` badge — see
[RELEASING.md](../RELEASING.md#-marking-pre-release-only-features))
- [x] 🙅 not needed

## Anything else we need to know? [optional]

- The check covers the four methods that lana calls today.
`salesforceServices.ts` still calls them through the accessor tags. So a
method added later, but not added to the check, would again give
`undefined` and not an error.
- The new check needs the tags and the context to be Effect 3 objects.
If Services moves to Effect 4, lana's own runtime also needs a change.
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