Skip to content

Fix the January floor of AvoidOldSalesforceApiVersions - #509

Open
dschach wants to merge 1 commit into
forcedotcom:devfrom
dschach:fix/minimum-api-version-formula
Open

dschach wants to merge 1 commit into
forcedotcom:devfrom
dschach:fix/minimum-api-version-formula

Conversation

@dschach

@dschach dschach commented Oct 6, 2026

Copy link
Copy Markdown

Fixes forcedotcom/code-analyzer#2102.

The problem

AvoidOldSalesforceApiVersions reports API versions that are three or more years old. For the 31 days of every January its floor is three versions too high, and on 1 February it drops back by two. In January 2027, for example, the rule reports 62.0 and below, where 59.0 and below is three years old.

getSalesforceApiVersionFor treats October to January as the Winter release and uses the calendar year for all four months. January belongs to the Winter release that started in the October before, so for January the year is one too high, and one year is three releases.

The change

  • src/plugin.ts: January counts in the year before. The three branches are unchanged.
  • test/plugin.test.ts: four dated cases, for December 2025, January 2026, January 2027, and February 2027. None of the existing cases is in January. Without the fix, the two January cases fail.
  • package.json: the regex engine's version goes to 0.41.0-SNAPSHOT.

Testing

With the change, the regex engine's build, lint, and tests pass locally (83 tests of 83, with plugin.ts at 100% coverage), and so do the snapshot version check and the package interdependency check.

Compared day by day from 2024-01-01 to 2039-12-31, the fixed function differs from the current one on exactly 496 days, the 31 days of each of the 16 Januaries, and each time the current one is 3 higher.

The title

I do not have a work item number, so the title has none and the title check will fail. Please rename the pull request as you need.

getSalesforceApiVersionFor treated January as part of the Winter release
of its own calendar year. That release starts in the October before, so
for the whole of January the rule's floor was three versions too high.
January now counts in the year before.

Four dated test cases cover December, January, and February.

forcedotcom/code-analyzer#2102
@git2gus

git2gus Bot commented Oct 6, 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.

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.

[BUG][code-analyzer] AvoidOldSalesforceApiVersions sets its floor three versions too high every January

1 participant