Skip to content

feat: ability to start changelog build with different levels of api-processor version validation#87

Merged
b41ex merged 7 commits into
developfrom
feature/migration-mode
May 22, 2026
Merged

feat: ability to start changelog build with different levels of api-processor version validation#87
b41ex merged 7 commits into
developfrom
feature/migration-mode

Conversation

@makeev-pavel
Copy link
Copy Markdown
Collaborator

@makeev-pavel makeev-pavel commented May 15, 2026

Summary

  • Added apiProcessorVersionValidationLevel option to BuilderRunOptions to support relaxed version validation during data migration
  • In major mode, changelog builds are allowed when the major version matches, even if minor/patch differs — this unblocks users from publishing while migration is in progress
  • When versions participating in a comparison were built by a different api-processor, their builder versions are recorded in previousVersionBuilderVersion / currentVersionBuilderVersion fields of the build result, so the backend can identify and rebuild them after migration completes

Changes

Types

  • src/types/internal/builder.ts: Added VersionValidationLevel type ('major' | 'strict') and apiProcessorVersionValidationLevel to BuilderRunOptions
  • src/types/internal/compare.ts: Added apiProcessorVersionValidationLevel to CompareContext, new BuilderVersionInfo and CompareResult types
  • src/types/external/config.ts, src/types/package/config.ts: Added previousVersionBuilderVersion and currentVersionBuilderVersion fields to BuildConfig and PackageConfig

Validation logic (src/validators.ts)

  • validateApiProcessorVersion: Added validationLevel parameter (default strict). In major mode: compares only major version part, skips validation if either version is unparseable
  • getMismatchedBuilderVersion: New helper — returns the builder version from resolved version data only if it differs from the current api-processor version
  • applyBuilderVersionInfo: New helper — copies previousVersionBuilderVersion / currentVersionBuilderVersion from comparison result to build config (for persistence in info.json)

Comparison pipeline

  • src/components/compare/compare.operations.ts: compareVersionsOperations now returns BuilderVersionInfo alongside the comparison. Passes validationLevel from context to validateApiProcessorVersion. Uses getMismatchedBuilderVersion to detect version mismatches
  • src/components/compare/compare.ts: compareVersions returns CompareResult (comparisons + builder version info). Builder version info from ref-packages is discarded (only relevant at root level)

Strategy integration

  • src/builder.ts, src/strategies/build.strategy.ts, src/strategies/changelog.strategy.ts, src/strategies/prefix-groups-changelog.strategy.ts: All call sites updated to destructure CompareResult and apply builder version info to config via applyBuilderVersionInfo

Test infrastructure

  • test/helpers/registry/local.ts: Added VersionOverrideRegistry — extends LocalRegistry to override apiProcessorVersion per version in versionResolver
  • test/helpers/utils.ts: Added buildChangelogWithVersionOverrides helper for e2e tests with configurable validation level and spec content

Tests (test/validators.test.ts)

  • 28 unit tests for validateApiProcessorVersion: parametrized matrix covering strict/major modes, exact matches, minor/patch/major mismatches, prerelease suffixes, unparseable versions, null versions, error prefix formatting
  • 6 e2e tests through PackageVersionBuilder: strict pass/fail, major pass/fail for both previous and current version sides
  • 4 integration tests for builder version info: verifies previousVersionBuilderVersion and currentVersionBuilderVersion are set/unset correctly in changelog build results

@makeev-pavel makeev-pavel requested a review from b41ex as a code owner May 15, 2026 14:24
@makeev-pavel makeev-pavel marked this pull request as draft May 15, 2026 14:24
@github-actions github-actions Bot added the enhancement New feature or request label May 15, 2026
@makeev-pavel makeev-pavel marked this pull request as ready for review May 20, 2026 06:16
Comment thread src/validators.ts Outdated
Comment thread src/validators.ts
Comment thread src/types/internal/builder.ts Outdated
Comment thread src/types/package/config.ts
Comment thread src/types/external/config.ts
Comment thread src/types/internal/compare.ts
@b41ex b41ex changed the title feat: Enhanced builder version check to support migration mode feat: ability to start changelog build with different levels of api-processor version validation May 22, 2026
@b41ex b41ex merged commit 18c3a5d into develop May 22, 2026
14 checks passed
@b41ex b41ex deleted the feature/migration-mode branch May 22, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat]: Enhance builder version check to support migration mode

3 participants