Skip to content

ASM-21703: add PR validation CI (lint, test, compile, smoke tests) - #29

Open
kgal-akl wants to merge 4 commits into
masterfrom
ASM-21703/pr-ci
Open

kgal-akl wants to merge 4 commits into
masterfrom
ASM-21703/pr-ci

Conversation

@kgal-akl

@kgal-akl kgal-akl commented Nov 12, 2026 •

Copy link
Copy Markdown

What

Adds PR CI for the JS SDK (ASM-21703) so dependency upgrades (including Dependabot security PRs) are validated before merge.

.github/workflows/pr-validation.yml runs on PRs to master (and manually):

Job Steps
Lint, test, compile npm ci --ignore-scripts, ESLint on src/, npm test, npm run build, verify dist loads and exports ApiClient/V2Api/Auth/GetSecretValue, tsc type-check of the smoke scripts against dist
Smoke tests Installs runtime deps only, downloads dist, runs scripts/smoke/auth.js (access id/key auth) and scripts/smoke/get-secret-value.js

Why the extra commits

Both pre-existing problems blocked the requested npm ci and test steps on master:

  • Orphaned test specs. openapi-generator never deletes files for models removed from the API spec. 41 specs constructed classes that src/index.js no longer exports. The generated specs register root-level beforeEach hooks, so one failure aborted the entire suite (0 passing). After removal: 11,819 passing. The generator does not recreate specs for models outside the spec.
  • Lockfile drift. Every release regenerates package.json but leaves package-lock.json alone, so they drifted (superagent locked at 3.7.0 vs ^5.3.0 declared, mocha 9.2.2 vs ^8.0.1), and npm ci refused to install. Re-synced with npm install --package-lock-only, which keeps every existing resolution that still satisfies package.json (31 package entries change, lockfile v2 unchanged). Consumers resolve from package.json, so the published package is unaffected.

Design notes

  • Survives SDK releases. The release job regenerates on top of this repo and pushes with git add .. New files (.github/, scripts/, .nvmrc, eslint.config.mjs) are kept, but package.json is overwritten, so nothing is added to it. ESLint and TypeScript run via npx at pinned versions (ESLINT_VERSION / TYPESCRIPT_VERSION in the workflow).
  • Lint only enables rules that indicate broken generated output (no-undef, no-dupe-keys, no-dupe-class-members, no-unreachable, no-import-assign, no-const-assign). no-redeclare is omitted because the upstream ApiClient template reuses var k in two loops.
  • Type-check uses checkJs: false plus // @ts-check in the smoke scripts, so the ~1,300 generated modules aren't checked but broken imports or renamed dist exports fail the build. Method typos on V2Api instances aren't caught (Babel's class output infers loosely).
  • Smoke tests live in scripts/smoke/, not test/. npm test is also run by akeyless-main-repo's sdktest without these credentials.
  • Secrets are only exposed to the smoke steps. The scripts never print the token or secret value, and errors report only the HTTP status and server message (superagent errors carry the request body, which contains the access key). No pull_request_target. All actions are SHA-pinned to their latest releases. actionlint and zizmor report no findings.
  • Fork PRs / missing secrets: smoke steps are skipped with a warning instead of failing.

Required repo setup (before marking ready)

  1. In Akeyless, create a dedicated access-key auth method and a role that grants only read on one dedicated smoke secret, e.g. /ci/akeyless-javascript/smoke (a static secret with any non-empty value). No other permissions.
  2. Add these repository secrets in both places. Dependabot-triggered runs can only read Dependabot secrets:
    • Settings > Secrets and variables > Actions: AKEYLESS_ACCESS_ID, AKEYLESS_ACCESS_KEY, AKEYLESS_SMOKE_SECRET (the secret path from step 1)
    • Settings > Secrets and variables > Dependabot: the same three
  3. Optional repository variable (Actions): AKEYLESS_API_URL (defaults to https://api.akeyless.io)

Verification

Ran every workflow step locally in node:22:

  • npm ci --ignore-scripts, lint, npm test (11,819 passing), build (1,333 files), dist export check, tsc (5.9.3 and 7.0.2): all pass
  • Negative checks: ESLint flags a duplicate key and an undefined identifier; tsc flags a misspelled dist export
  • auth.js against api.akeyless.io with a real access key: auth: ok. With a bad key: HTTP 401 server message, key not present in output
  • get-secret-value.js against api.akeyless.io: request and token path work (unauthorized for an unreadable path, exits 1). Against a local stub API: success, empty value, and bad token are all handled correctly
  • Missing env vars fail closed

Once the secrets are configured, re-run this PR's checks and rebase one Dependabot PR (e.g. #25) to confirm smoke tests get the Dependabot secrets.

Follow-ups (not in this PR)

  • Releases revert direct-dependency bumps. When Dependabot bumps a dependency in package.json, the next release regenerates package.json and reverts it, which can desync the lockfile again. Fix in akeyless-main-repo go/src/client/generate/main.go, similar to addPackagesToResolutionsAndOverrides.
  • Orphaned generated files. 41 src/model files (and docs) for removed models are still compiled into dist, though not exported. The generator should prune files that are absent from .openapi-generator/FILES and the spec. New orphaned specs will reappear whenever a model is removed.
  • Branch protection. The release pushes directly to master via git_push.sh. If these checks become required, the release token needs bypass.
  • Auto-merge. Enable auto-merge for Dependabot security PRs once this CI is stable.
  • Dependabot ecosystems. chore: add Dependabot version updates for all package ecosystems #28 adds .github/dependabot.yml for npm and github-actions, which also covers the pinned actions here.

Summary by CodeRabbit

  • Tests

    • Pull requests can now be checked with automated linting, tests, build and package-export checks, plus TypeScript checks for smoke tests.
    • Optional authentication and secret-retrieval smoke tests run when the required credentials are available; otherwise, they are skipped with a warning.
    • Removed generated model test placeholders that contained no active assertions.
  • Chores

    • Standardized the project’s Node.js version and added linting rules for source files.

kgal-akl and others added 3 commits November 12, 2026 16:06
openapi-generator never deletes files for removed models. These 41 specs
construct classes that src/index.js no longer exports, and because the
generated specs register root-level beforeEach hooks, the first failure
aborts the whole suite (0 passing). The generator does not recreate test
specs for models outside the spec, so the removal is durable.

Co-authored-by: Cursor <cursoragent@cursor.com>
Each release regenerates package.json but leaves the lockfile untouched,
so they drifted (e.g. superagent 3.7.0 locked vs ^5.3.0 declared) and
npm ci refused to install. Regenerated with npm install --package-lock-only,
which keeps every existing resolution that still satisfies package.json.

Co-authored-by: Cursor <cursoragent@cursor.com>
Runs npm ci, lint, test, compile and a type-check of the smoke scripts
against dist, then auth and get-secret-value smoke tests against the
compiled SDK using AKEYLESS_ACCESS_ID/AKEYLESS_ACCESS_KEY secrets.

Tooling lives outside package.json (pinned npx versions, standalone
eslint.config.mjs) because package.json is regenerated on every release.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PR adds a CI workflow that validates the source and built package, then conditionally runs authentication and secret-retrieval smoke checks. It also adds ESLint and smoke-test TypeScript configuration, sets Node.js to version 22, and removes generated model test scaffolds with no active assertions.

Changes: CI validation and package smoke checks

Layer / File(s) Summary
Toolchain and validation job
.nvmrc, eslint.config.mjs, .github/workflows/pr-validation.yml
Node.js is set to version 22. The workflow adds linting, tests, a build, compiled export checks, smoke-test type-checking, and an artifact containing dist/.
Smoke-check helpers and scripts
scripts/smoke/*
Shared helpers create a V2 API client, require credentials, authenticate, report errors, and set the process exit code. Auth and secret-retrieval checks use these helpers. TypeScript checking uses a strict, no-emit configuration with minimal global declarations.
Smoke-job artifact and credential flow
.github/workflows/pr-validation.yml
The dependent job downloads the compiled package and checks for required credentials. It runs auth and secret-retrieval checks when all required credentials are available; otherwise, it warns and skips them.

Generated model test cleanup

Layer / File(s) Summary
Remove model test scaffolds
test/model/*.spec.js
Generated model test files are deleted. Their test bodies contained commented-out assertions or no active assertions.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant ValidateJob
  participant ArtifactStore
  participant SmokeJob
  participant AkeylessAPI
  GitHubActions->>ValidateJob: Start validation
  ValidateJob->>ArtifactStore: Upload dist/
  ArtifactStore-->>SmokeJob: Download compiled package
  SmokeJob->>SmokeJob: Check required credentials
  alt Credentials are available
    SmokeJob->>AkeylessAPI: Authenticate and request secret
  else Credentials are missing
    SmokeJob->>SmokeJob: Warn and skip smoke checks
  end
Loading

Suggested reviewers: akeyless-ci

Merge Risk: Minimal · up to 0e849

This change adds PR validation and removes inactive generated test scaffolds. It does not alter runtime library behavior, and no actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "ASM-21703: add PR validation CI (lint, test, compile, smoke tests)" matches the main change. The PR adds a pull-request validation workflow that runs lint, tests, build, export checks, and …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "ASM-21703: add PR validation CI (lint, test, compile, smoke tests)" matches the main change. The PR adds a pull-request validation workflow that runs lint, tests, build, export checks, and smoke tests. It also removes stale model specs and syncs the lockfile, which the title does not mention. The title is specific and concise, and it includes a ticket ID.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the build at dawn
Then hops where smoke tests carry on
The tokens pass; the secrets gleam
Old empty tests leave the scene
With carrots packed, I bound away

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 0bd39403-44a4-4d36-bb17-4db68e7a7cbf
Commits

Reviewing files that changed from the base of the PR and between 169bcdb and 0e8495e.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 49

  • .github/workflows/pr-validation.yml
  • .nvmrc
  • eslint.config.mjs
  • scripts/smoke/auth.js
  • scripts/smoke/client.js
  • scripts/smoke/get-secret-value.js
  • scripts/smoke/globals.d.ts
  • scripts/smoke/tsconfig.json
  • test/model/AllowedAccessArgs.spec.js
  • test/model/AllowedAccessDeleteArgs.spec.js
  • test/model/AllowedAccessUpdateArgs.spec.js
  • test/model/CreateManagedKey.spec.js
  • test/model/CreateManagedKeyOutput.spec.js
  • test/model/CreateRdpTarget.spec.js
  • test/model/CreateTargetOutput.spec.js
  • test/model/CustomerFragment.spec.js
  • test/model/CustomerFragmentsJson.spec.js
  • test/model/EncryptPKCS1.spec.js
  • test/model/EncryptPKCS1Output.spec.js
  • test/model/GatewayAddAllowedManagementAccess.spec.js
  • test/model/GatewayAddSubAdmins.spec.js
  • test/model/GatewayAddSubAdminsOutput.spec.js
  • test/model/GatewayBasicInfo.spec.js
  • test/model/GatewayCreateProducerCertificateAutomation.spec.js
  • test/model/GatewayCreateProducerCertificateAutomationOutput.spec.js
  • test/model/GatewayDeleteAllowedManagementAccess.spec.js
  • test/model/GatewayDeleteSubAdmins.spec.js
  • test/model/GatewayDeleteSubAdminsOutput.spec.js
  • test/model/GatewayListAllowedManagementAccess.spec.js
  • test/model/GatewayListSubAdmins.spec.js
  • test/model/GatewayUpdateProducerCertificateAutomation.spec.js
  • test/model/GatewayUpdateProducerCertificateAutomationOutput.spec.js
  • test/model/GetCloudIdentity.spec.js
  • test/model/GetCloudIdentityOutput.spec.js
  • test/model/GetSubAdminsListReplyObj.spec.js
  • test/model/KMIPClientsConfigPart.spec.js
  • test/model/ManagedKeyDetailsInfo.spec.js
  • test/model/ManagedKeyStatusInfo.spec.js
  • test/model/ManagedKeyTargetInfo.spec.js
  • test/model/NullTime.spec.js
  • test/model/RemoteSecretInfo.spec.js
  • test/model/TargetObjectAssociation.spec.js
  • test/model/TargetTypeDetailesInput.spec.js
  • test/model/UIdentityConfigPart.spec.js
  • test/model/UpdateManagedKey.spec.js
  • test/model/UpdateRotatedSecretSC.spec.js
  • test/model/UpdateRotatedSecretSCOutput.spec.js
  • test/model/UpdateTokenizer.spec.js
  • test/model/UpdateTokenizerOutput.spec.js
Files with no reviewable changes: 41

  • test/model/GatewayUpdateProducerCertificateAutomationOutput.spec.js
  • test/model/CreateRdpTarget.spec.js
  • test/model/GatewayCreateProducerCertificateAutomationOutput.spec.js
  • test/model/GatewayListSubAdmins.spec.js
  • test/model/GetSubAdminsListReplyObj.spec.js
  • test/model/CreateManagedKeyOutput.spec.js
  • test/model/GatewayDeleteAllowedManagementAccess.spec.js
  • test/model/TargetObjectAssociation.spec.js
  • test/model/GatewayAddSubAdmins.spec.js
  • test/model/GatewayAddSubAdminsOutput.spec.js
  • test/model/GatewayCreateProducerCertificateAutomation.spec.js
  • test/model/ManagedKeyTargetInfo.spec.js
  • test/model/GatewayDeleteSubAdmins.spec.js
  • test/model/CustomerFragmentsJson.spec.js
  • test/model/GatewayBasicInfo.spec.js
  • test/model/RemoteSecretInfo.spec.js
  • test/model/ManagedKeyStatusInfo.spec.js
  • test/model/GetCloudIdentityOutput.spec.js
  • test/model/CreateManagedKey.spec.js
  • test/model/UpdateManagedKey.spec.js
  • test/model/GatewayDeleteSubAdminsOutput.spec.js
  • test/model/UpdateTokenizerOutput.spec.js
  • test/model/UpdateTokenizer.spec.js
  • test/model/UpdateRotatedSecretSC.spec.js
  • test/model/EncryptPKCS1.spec.js
  • test/model/CustomerFragment.spec.js
  • test/model/CreateTargetOutput.spec.js
  • test/model/KMIPClientsConfigPart.spec.js
  • test/model/GatewayAddAllowedManagementAccess.spec.js
  • test/model/AllowedAccessDeleteArgs.spec.js
  • test/model/UpdateRotatedSecretSCOutput.spec.js
  • test/model/TargetTypeDetailesInput.spec.js
  • test/model/GatewayUpdateProducerCertificateAutomation.spec.js
  • test/model/AllowedAccessArgs.spec.js
  • test/model/UIdentityConfigPart.spec.js
  • test/model/EncryptPKCS1Output.spec.js
  • test/model/ManagedKeyDetailsInfo.spec.js
  • test/model/GatewayListAllowedManagementAccess.spec.js
  • test/model/AllowedAccessUpdateArgs.spec.js
  • test/model/GetCloudIdentity.spec.js
  • test/model/NullTime.spec.js

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kgal-akl
kgal-akl marked this pull request as ready for review November 12, 2026 17:37
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.

1 participant