You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate org-related findMissingArtifact lookups in packages/apex-lsp-vscode-extension to the production Org Metadata Catalog exposed by @salesforce/vscode-services.
The immediate goal is to stop the Apex language-server client from owning duplicate org discovery, Tooling queries, and remote Apex source storage where the released catalog can provide those responsibilities. The migration must preserve the existing parser-owned candidate selection, missing-artifact wire protocol, workspace-first behavior, org-switch isolation, and graceful degradation.
Production API baseline
@salesforce/vscode-services@67.13.3 is the first production release whose SalesforceVSCodeServicesApi.services exposes OrgMetadataCatalog, its dependency in prebuiltServicesDependencies, OrgMetadataCatalogChangePubSub, and ORG_METADATA_SCHEME.
The released catalog surface is currently:
getChildren(reference?, options?)
getEntries(references, options?)
resolveComponents(references)
The proposed findComponents(...) and describeSObjects(...) operations are not present in 67.13.3.
Batch exact candidates through OrgMetadataCatalog.getEntries(...).
Preserve candidate order and select the first matching component. Prefer workspaceUri when the entry is in the workspace; otherwise open its catalog documentUri.
Synchronize sf-org-metadata: Apex class and trigger documents with the language server.
On the catalog path, remove direct client Tooling queries and stop materializing Apex class/trigger source in OrgArtifactFileSystem.
Retain an explicitly transitional capability/version fallback for older Salesforce Services releases. Record whether catalog or legacy resolution handled the request.
Phase 2: catalog-owned sObject descriptions
Continue using MetadataDescribeService.describeCustomObject until Salesforce Services exposes a catalog-owned, batch-oriented description operation such as describeSObjects(names).
When available:
Switch org sObject lookup to the catalog operation.
Keep Apex-specific adaptation, definition targets, and wire-size enforcement in this repository.
Remove the direct public MetadataDescribeService dependency from the supported path.
Options considered
A. Use only the released 67.13.3 catalog now
Use getEntries and catalog documents for Apex classes/triggers.
Keep direct describe for sObjects.
Fastest way to remove duplicate source discovery/storage, but it is intentionally partial.
getEntries may acquire a complete metadata-type inventory and does not encapsulate workspace-first document selection as a dedicated finder contract would.
B. Wait for findComponents and describeSObjects
Produces the cleanest one-step migration and clearer miss/error semantics.
Delays consuming a production catalog that already handles Apex source inventory, workspace correlation, stable documents, caching, persistence, and org isolation.
C. Phased hybrid migration — recommended
Delivers value from the production API now.
Keeps the compatibility boundary narrow.
Avoids inventing a client-side sObject catalog API that Services does not yet expose.
Leaves a direct path to the upstream finder/describe contracts when they are published.
Acceptance criteria
The client detects catalog capability and uses it when available.
Exact Apex class and trigger candidates come only from parser/symbol-derived missing-artifact data; no raw-source semantic heuristics are introduced.
Workspace-only, org-only, and both-present Apex classes and triggers resolve with deterministic workspace-first behavior.
Org-only source opens through sf-org-metadata: and synchronizes with the language server.
Namespaced and unqualified Apex class/trigger candidates retain existing semantic ordering.
Missing, protected, authorization-failed, no-active-org, and request-failed outcomes preserve current suppression/degradation behavior.
Active-org changes cannot commit stale results or leak documents from the previous org.
Concurrent and duplicate requests remain coalesced/bounded.
Direct Tooling SOQL and client-owned Apex/trigger VFS storage are not used on the catalog path.
Existing sObject semantic payloads and definition navigation remain unchanged while the temporary describe path remains.
Telemetry distinguishes catalog versus legacy resolution without recording org, namespace, component, object, or field names.
Unit/integration coverage includes catalog capability fallback and the existing missing-artifact scenarios.
The minimum supported salesforcedx-vscode-services version and fallback removal condition are documented.
Upstream/package prerequisite to verify
The published @salesforce/vscode-services@67.13.3 tarball contains only 11 files, and out/index.d.ts re-exports SalesforceVSCodeServicesApi from ../../salesforcedx-vscode-services/out/src/index, which is not included in that tarball. Before implementation, verify that a clean external consumer can resolve the catalog types. If not, open/fix the upstream packaging issue or temporarily maintain the existing narrow local interface without importing unpublished internals.
Non-goals
Changing the language-server missing-artifact wire protocol.
Moving Apex-specific candidate ordering or semantic adaptation into Salesforce Services.
Writing automatically resolved org source into the user workspace.
Permanently maintaining two discovery/storage implementations.
Summary
Canonical work item: W-23971749
Migrate org-related
findMissingArtifactlookups inpackages/apex-lsp-vscode-extensionto the production Org Metadata Catalog exposed by@salesforce/vscode-services.The immediate goal is to stop the Apex language-server client from owning duplicate org discovery, Tooling queries, and remote Apex source storage where the released catalog can provide those responsibilities. The migration must preserve the existing parser-owned candidate selection, missing-artifact wire protocol, workspace-first behavior, org-switch isolation, and graceful degradation.
Production API baseline
@salesforce/vscode-services@67.13.3is the first production release whoseSalesforceVSCodeServicesApi.servicesexposesOrgMetadataCatalog, its dependency inprebuiltServicesDependencies,OrgMetadataCatalogChangePubSub, andORG_METADATA_SCHEME.getChildren(reference?, options?)getEntries(references, options?)resolveComponents(references)findComponents(...)anddescribeSObjects(...)operations are not present in67.13.3.Current Apex LS client behavior
handleFindMissingArtifactis workspace-first and currently composes multiple Salesforce Services APIs:ComponentSetServiceConnectionServiceapex-org-artifact:documentComponentSetServiceConnectionServiceapex-org-artifact:documentComponentSetServiceplus local metadata adaptationMetadataDescribeService.describeCustomObjectRelevant implementation:
src/missing-artifact-handler.tssrc/services/org-artifact-adapter.tssrc/services/org-artifact-fs.tssrc/services/workspace-component-set-adapter.tssrc/sobjects/org-sobject-adapter.tsRecommended delivery approach
Use a phased hybrid migration.
Phase 1: released catalog path for Apex classes and triggers
api.services.OrgMetadataCatalogand provide effects withprebuiltServicesDependencies.{ type: 'ApexClass' | 'ApexTrigger', fullName }references.OrgMetadataCatalog.getEntries(...).workspaceUriwhen the entry is in the workspace; otherwise open its catalogdocumentUri.sf-org-metadata:Apex class and trigger documents with the language server.OrgArtifactFileSystem.Phase 2: catalog-owned sObject descriptions
Continue using
MetadataDescribeService.describeCustomObjectuntil Salesforce Services exposes a catalog-owned, batch-oriented description operation such asdescribeSObjects(names).When available:
MetadataDescribeServicedependency from the supported path.Options considered
A. Use only the released
67.13.3catalog nowgetEntriesand catalog documents for Apex classes/triggers.getEntriesmay acquire a complete metadata-type inventory and does not encapsulate workspace-first document selection as a dedicated finder contract would.B. Wait for
findComponentsanddescribeSObjectsC. Phased hybrid migration — recommended
Acceptance criteria
sf-org-metadata:and synchronizes with the language server.salesforcedx-vscode-servicesversion and fallback removal condition are documented.Upstream/package prerequisite to verify
The published
@salesforce/vscode-services@67.13.3tarball contains only 11 files, andout/index.d.tsre-exportsSalesforceVSCodeServicesApifrom../../salesforcedx-vscode-services/out/src/index, which is not included in that tarball. Before implementation, verify that a clean external consumer can resolve the catalog types. If not, open/fix the upstream packaging issue or temporarily maintain the existing narrow local interface without importing unpublished internals.Non-goals