Skip to content

Add Flow Analyzer engine package - #511

Open
antoinesfdc wants to merge 4 commits into
forcedotcom:devfrom
antoinesfdc:flowanalyzer-engine
Open

antoinesfdc wants to merge 4 commits into
forcedotcom:devfrom
antoinesfdc:flowanalyzer-engine

Conversation

@antoinesfdc

Copy link
Copy Markdown

Adds the code-analyzer-flowanalyzer-engine package. The engine collects Flow metadata files from the workspace, bundles them into a metadata archive, authenticates and sends them to the Flow Analyzer API, and maps the returned findings back to locations in the flow files.

Includes config, auth service, API client, file collector, archive builder, location mapper, plugin/engine wiring, and unit tests.

Adds the code-analyzer-flowanalyzer-engine package. The engine collects Flow
metadata files from the workspace, bundles them into a metadata archive,
authenticates and sends them to the Flow Analyzer API, and maps the returned
findings back to locations in the flow files.

Includes config, auth service, API client, file collector, archive builder,
location mapper, plugin/engine wiring, and unit tests.
Replaces the sample flow fixture with a real flow metadata file and updates
the file collector and engine tests to match (new size limits, get_Account
element, recordLookups type). Removes the unused sample-flow/notes.txt fixture
and updates package-lock.json to register the new workspace package.
@git2gus

git2gus Bot commented Oct 21, 2026

Copy link
Copy Markdown

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! It looks like @antoinesfdc is an internal user so signing the CLA is not required. However, we need to confirm this.

}

private async requestJson<T>(method: 'GET' | 'POST', resourcePath: string, body?: unknown): Promise<T> {
const version = this.authService.getApiVersion() || this.apiVersion;

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.

[P1] Honor the configured API version

FlowAnalyzerAuthService.getApiVersion() always returns a truthy connection version (and even falls back to 64.0), so this.apiVersion is never used here. An org authenticated with an older cached connection version will therefore call that older /services/data/vXX.X/... endpoint even though this engine defaults/configures 68.0; the Flow Analyzer endpoint can then 404 and the engine becomes unusable. Please make the engine's configured api_version take precedence (or set that version on the connection during initialization).

const detail = err instanceof Error ? err.message : String(err);
this.emitLogEvent(LogLevel.Error, getMessage('CatalogUnavailable', detail));
this.emitDescribeRulesProgressEvent(100);
return [];

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.

[P1] Propagate catalog failures instead of returning no rules

When authentication or the catalog request fails, this converts the failure into an empty catalog. Core then selects zero flowAnalyzer rules, so runRules() is never invoked and its structured skipped insight is never produced; even an explicit --rule-selector flowAnalyzer invocation can finish successfully with no findings. Throwing here lets Core's existing getAllRulesFor() error path record an uninstantiable engine and surface a critical engine error instead of a false-success scan.

- Always use the configured api_version for Connect requests instead of the
  CLI connection's version, which may predate the Flow Analyzer endpoints.
- Propagate rule catalog failures from describeRules so Core reports the
  engine error instead of silently selecting zero rules.
- Make target_org optional: without it the engine is inactive and offers no
  rules, so scans without --target-org are unaffected. Auth still never falls
  back to the default org.
- Make the package publishable: add it to the publish-package-to-npm workflow
  and to the not-yet-published list in validate-changed-package-versions.js.
An explicitly configured api_version always wins. Otherwise requests use the
target org's API version, but never one older than 68.0 (the first version
exposing the Flow Analyzer endpoints), so older CLI connections still work
and newer orgs (e.g. 69.0) use their own version. Malformed api_version
values are now rejected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants