Fix blank pnpm current versions in Library Tracking uploads (LIBTRACK-136)#35
Merged
naarok merged 3 commits intoJun 9, 2026
Merged
Conversation
…-136) Resolve each dependency's current version from the structured `pnpm list --depth=0 --json` output instead of scraping the rendered tree text. The previous regexes both began with `^.*?\s`, requiring a leading `├── ` prefix that pnpm omits in non-TTY/CI runs, so current_version came back blank for ~every library and was uploaded that way. Also select the JSON entry by the analyzed workspace path instead of `pnpm list --dir <subdir>`, which collapsed to the repo root and made every workspace's analysis identical. Preserves the libyear merge, the a..b multi-version range, and empty handling for link:/workspace: specifiers. Adds an #add_all_libraries spec (previously stubbed). Includes the OpenSpec change artifacts under openspec/changes/fix-pnpm-current-version-resolution. Co-Authored-By: Amplify 2.1.1 <amplify@getjobber.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
representable (pulled in via google-api-client) requires "multi_json" at runtime but does not declare it as a dependency, so bundler omitted it and `require "google/apis/sheets_v4"` failed with "multi_json is not part of the bundle", aborting spec_helper load. Add multi_json to the Gemfile. `bundle exec rspec` now passes (116 examples, 0 failures), including the new #add_all_libraries specs. (Gemfile.lock is gitignored for this gem; CI regenerates it from the Gemfile.) Co-Authored-By: Amplify 2.1.1 <amplify@getjobber.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the completed OpenSpec change to the archive and promote its delta into a living spec at openspec/specs/pnpm-version-analysis/spec.md (3 requirements). The deferred release task (5.1) remains as a follow-up. Co-Authored-By: Amplify 2.1.1 <amplify@getjobber.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
For pnpm repos (e.g.
jobber-frontend), the analyzer uploaded a blankcurrent_versionfor ~every library, so Library Tracking showed no installed version (LIBTRACK-136).Root cause (confirmed from the nightly
static_analysisupload log — every library uploaded asname @ <blank>):Pnpm#add_all_librariesparsed the rendered text ofpnpm list --depth=0 --silentwith two regexes that both begin with^.*?\s, i.e. they require a leading tree prefix (├──) before the package name. In the non-TTY CI environment pnpm emits barename@versionlines with no prefix, so both regexes match nothing.A second defect in the same path:
pnpm list --dir <subdir>resolves to the workspace root, so all 24 workspaces were analyzed against identical root data (per-workspace analysis wasn't actually per-workspace).What changed
pnpm list --depth=0 --jsonoutput (reading theversionfield) instead of scraping rendered tree text — eliminates the TTY/format dependence.path, instead of relying on--dir— fixes the per-workspace duplication.a..bmulti-version range (calculate_version), and empty handling forlink:/workspace:specifiers.#add_all_librariesspec (the method was stubbed everywhere previously).Verification
Ran the new
add_all_librariesagainst livepnpm list --jsonfrom thejobber-frontendworktree:Per-workspace key sets now differ (119 vs 12) — the duplicate-root-data bug is fixed. Result is rendering-independent, so CI matches local.
Follow-ups (not in this PR)
jobber-frontendbin/Gemfileto consume the fix.jobber-frontend'sscripts/codeAnalysis/.../libraryVersionAnalysis.tsgreedilyJSON.parse-ing the gem stdout (fails on Ruby hash-inspect output) — separate jobber-frontend-owned change.recently_seenthreshold.OpenSpec change:
openspec/changes/fix-pnpm-current-version-resolution.Co-Authored-By: Amplify 2.1.1 amplify@getjobber.com
🤖 Generated with Claude Code