Repository navigation
chore: deprecate the standalone V2 package - #344
Open
jerome-benoit wants to merge 7 commits into
Open
jerome-benoit wants to merge 7 commits into
jerome-benoit wants to merge 7 commits into
Conversation
- Stop publishing `@jerome-benoit/sap-ai-provider-v2`: drop its publish job, `tsup.config.v2.ts`, `scripts/prepare-v2-package.ts`, the `AI_SDK_VERSION=v2` `prepublishOnly` branch, and the `build:v2`, `build:v2:watch`, `prepare:v2` and `check-build:v2` scripts. - Add `scripts/v2-package-deprecation.ts`: a read-only registry freeze check (`check`), a deprecation-coverage verification (`verify`), and the one-time authenticated write (`deprecate --apply`). - Run `npm run check-v2-package` in the PR validation job and in the release build job, so a re-published `-v2` version or a lifted freeze fails CI. - Document `/v2` as the only supported V2 facade across README, API_REFERENCE, ARCHITECTURE, CONTRIBUTING, ENVIRONMENT_SETUP, MIGRATION_GUIDE, TROUBLESHOOTING, the PR template and the agent instructions.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34b90013f1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
CodeQL flagged the string-literal replacement as replacing only the first occurrence of the separator. Splitting and joining encodes every separator and yields the identical registry path for valid npm package names, so the freeze, coverage, and dry-run gates keep the same behaviour.
- `--apply` pins `--dry-run=false`: an inherited `dry-run` setting makes npm skip the write and still exit zero, so the gate would claim a write that never happened. CLI flags outrank `npm_config_dry_run` and any `.npmrc`. - Registry-supplied `latest` and unorderable version keys print escaped, so a registry value cannot forge a `Freeze holds` line in CI logs. - Argument parsing and the npm invocation moved to the library, which imports without side effects; the CLI entry stays thin and always executes. - Tests run the real entry in child processes against a stubbed registry transport, count the served reads, and strip every `npm_` spelling plus `NODE_OPTIONS` from the child environment. - Docs and agent rules still described two published packages, the removed `build:v2`/`prepare:v2` scripts, a deprecation message already stored on the published versions, and a manifest rewrite only the release workflow does.
- `npm deprecate` with the bare package name targets every version of npm's own uncached registry read, so a version published after the gate snapshot would receive a message naming 5.1.2 as the last release; the spec now stops at the frozen version. - `npm_execpath` must be an absolute path to an existing `npm-cli.js`, and `--apply` runs only from its own npm lifecycle script, so a direct invocation cannot start another executable with the npm credentials of the caller. - The dry run separates the npm target range from what the registry snapshot still misses, and exit zero no longer claims more than that npm reported no error. - Tests drop inherited `TSX_*` variables, because a stray `TSX_TSCONFIG_PATH` made the whole suite fail before any stubbed registry read. - `MIGRATION_GUIDE.md` uninstalls the frozen package and pins no `ai` range; `ARCHITECTURE.md` records the five-minute CDN window of the guard.
Reading the abbreviated packument was not enough to attest a freeze. A version key such as 5.01.2, 5.1.2-01 or 5.1.2+build is greater than 5.1.2 under semver.gtr and is rejected by no guard today, a version record may disagree with the key that holds it, and a dist-tag may name a version the versions table does not list. - Restrict version keys to the grammar npm can publish, and compare prerelease identifiers on exact digit strings instead of through Number(). - Require each version record to carry the package name and the version of its own key when that field is present. - Require every dist-tag value, latest included, to be a key of the versions table. - Name a 404 from the canonical registry origin instead of reporting a generic read failure; publication stays blocked while the freeze cannot be attested. - Drop "same releases" from the deprecation message: 4.1.2-rc.1, 4.1.2-rc.2 and 4.4.7 exist only under the standalone name, and only main-package 5.x exposes the /v2 facade. No version carries a message yet, so nothing written changes.
The artifact checker and the release-age gate decided whether to run from process.argv[1] resolved against their own module URL. Pointing a published npm script at either library file made it exit zero without checking anything, the silent failure commit 57edeca removed from the advisory gate. - Add scripts/check-build-artifacts-cli.ts and scripts/check-lockfile-release-age-cli.mjs, which always run; both libraries now export their checks and run nothing on import, and package.json points at the entries. - Execute the command each manifest script declares, so repointing a script at a file that runs nothing fails a test instead of CI: the main and V4 artifact families, an absent artifact, an unknown family, and the release-age usage path. - Lint scripts/*.mjs with the same override as the release-age library, now that a second .mjs holds a command entry.
The freeze rules were restated in six files, so a later change could keep one copy true while another went stale, and two entries enumerated the failure conditions with an incomplete list. - ARCHITECTURE.md (Build Process) owns when npm run verify-v2-package joins continuous integration; .cursor/rules/build-and-publish.mdc and openspec/config.yaml now refer to that sentence instead of repeating an invariant the one-time write invalidates. - Complete the guard description in ARCHITECTURE.md and .github/copilot-instructions.md: dist-tags outside the versions table, incoherent version records, unreadable documents and a registry that answers 404 were checked but not documented. - Say "the main package and the frozen standalone package" where a document said "both packages", and retitle the V2 facade section to match its anchor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
@jerome-benoit/sap-ai-provider-v2duplicates the/v2subpath of the main package, which every 5.x release of that package exports:5.0.0lists././v2/./v4inexports,5.0.2and later add./v3, while4.9.1— the last 4.x release — lists only.. Publishing the standalone name doubles the release surface for a facade that already has a supported home. This PR deprecates it properly: the package stops being published, the versions already on the registry get a deprecation message, and CI guards the freeze.Publication freeze
.github/workflows/npm-publish-packages.yml: thepublish-npm-v2job and thebuild:v2step are removed;prepublishOnlyloses itsAI_SDK_VERSION=v2branch.tsup.config.v2.ts,scripts/prepare-v2-package.tsand thebuild:v2,build:v2:watch,prepare:v2,check-build:v2scripts are deleted.npm run buildalready emitsindex-v2.*andnpm run check-buildalready verifies that artifact family, so the standalone build path was a duplicate.scripts/check-build-artifacts.tsdrops thev2artifact family;scripts/check-package-exports.tsdrops the standalone-manifest branch.Deprecation of the published versions
scripts/v2-package-deprecation.ts, its CLI entryscripts/v2-package-deprecation-cli.tsand co-located tests:npm run check-v2-package— read-only; the CI guard. Stops when the freeze cannot be attested: a version above the frozen5.1.2, alatestdist-tag that moved away from that version or that the versions table does not list, another dist-tag pointing outside that table, a version key npm could not have published (5.01.2,5.1.2-01, build metadata, an over-long string), a version record whose ownnameorversiondoes not match its key, or a document that cannot be read at all — including a registry that answers 404, which is named as such because it proves neither a removal nor a held freeze. It prints deprecation coverage without enforcing it: a version without the message never fails this command.npm run verify-v2-package— read-only; the coverage check. Fails while a published version lacks the canonical deprecation message, so it stays out of CI until the one-time write below has run: the registry holds 53 versions today and 0 carry the message.npm run deprecate-v2-package— dry run by default;-- --applywrites through npm. The package spec stops at the frozen version, so the versions npm selects from its own registry read cannot go past the freeze;npm_execpathmust be an absolute path to an existingnpm-cli.js; and--applyis refused outsidenpm run deprecate-v2-package. The command pins--dry-run=false, because an inherited dry-run setting makes npm skip the write and still exit zero. It never re-reads the registry, soverifyis what confirms coverage.npm run check-v2-packageruns in the PRvalidationjob and in the releasebuildjob, so a re-published-v2version, a movedlatesttag or an unreadable registry document stops CI. That guard detects rather than prevents — step 1 below is the prevention — and it reads the document through npm's CDN, which caches it for up to five minutes (cache-control: public, max-age=300), so a registry change made inside that window can stay invisible;ARCHITECTURE.mdrecords both limits.ARCHITECTURE.mddocuments the command sequence.Documentation
/v2is presented as the only supported V2 facade inREADME.md,API_REFERENCE.md,ARCHITECTURE.md,CONTRIBUTING.md,ENVIRONMENT_SETUP.md,MIGRATION_GUIDE.md,TROUBLESHOOTING.md, the PR template and the agent instructions. The obsoleteprepare:v2troubleshooting entry and the sequential-build description are removed. The standalone-package migration steps uninstall the frozen package and install the main package without anairange, because pinningai@^5would downgrade an AI SDK 6 consumer; they refer to the per-major installation table instead.Hardening after review
The first review round found no blocker; these are its follow-ups, each verified against the live registry and the existing suites:
name/versionidentity, dist-tags confined to the versions table, version keys restricted to the grammar npm can publish, and prerelease ordering done on exact digit strings instead of floats. The live abbreviated document satisfies all of it (allHaveName/allHaveVersiontrue for 53/53, both dist-tag targets present), socheckstill passes on the real registry.process.argvwith the module URL:scripts/check-build-artifacts-cli.tsandscripts/check-lockfile-release-age-cli.mjsalways run, the libraries run nothing on import, and a test executes exactly whatpackage.jsonpoints at, so repointing a script at a file that does not run stops failing silently. This is the mode commit57edecadocumented for the advisory gate;scripts/check-toc.tsandscripts/check-markdown-links.tskeep the old guard and are out of scope here (lint scope, no publication path).4.1.2-rc.1,4.1.2-rc.2and4.4.7do not exist under the main name and only main-package 5.x exposes/v2. It now says the/v2facade ships with the main package. Nothing was written to the registry yet, so this cost nothing to correct.ARCHITECTURE.mdnow owns whenverifyjoins CI;.cursor/rules/build-and-publish.mdcandopenspec/config.yamlrefer to it instead of stating an invariant that the one-time write would invalidate.Type of Change
No published package changes runtime behaviour. Existing installations of the frozen
-v2versions keep working; only new releases of that package name stop.Checklist
npm run check-lockfile-release-age && npm run check-dependency-audit && npm run type-check && npm run test:node && npm run test:edge && npm run prettier-check && npm run lintnpm run build && npm run check-build && npm run check-v2-packageBoth candidate gates passed on head
b74563f: 187 lockfile artifacts verified, no advisory left unexplained, 1874 Node tests, 1113 Edge tests, Prettier, Markdown lint with ToC and Mermaid checks, ESLint, and a build verified for artifacts, declaration routing and the standalone freeze.Related Issues
Additional Notes
Measured against the live registry on this branch:
These operator steps remain after merge, in this order.
Remove the npm trusted-publisher configuration from the frozen package. The registry still records it for the published head version, so a workflow in this repository that matches that configuration can still write under the name:
Clearing it happens on the npm side (package → Trusted publishing) and must precede any claim that the freeze is enforced from the registry alone.
Perform the one-time write from an authenticated npm CLI session:
Add
npm run verify-v2-packagebesidenpm run check-v2-packagein thevalidationjob of.github/workflows/check-pr.yaml— keep that step's existingif: runner.os == 'Linux', or three operating systems would triple the registry reads per pull request — and in thebuildjob of.github/workflows/npm-publish-packages.yml. Then retire the normative sentence inARCHITECTURE.md(Build Process) and update the two files that refer to it:.github/copilot-instructions.mdandopenspec/config.yaml.build:v2andcheck-build:v2are gone from the checklist, so the PR-template line now readsnpm run build && npm run check-build && npm run check-v2-package.