Skip to content

test: add add_dist_tag bats helper for verdaccio storage#422

Merged
jdx merged 2 commits intomainfrom
claude/nice-noyce-a68ca3
Apr 30, 2026
Merged

test: add add_dist_tag bats helper for verdaccio storage#422
jdx merged 2 commits intomainfrom
claude/nice-noyce-a68ca3

Conversation

@jdx
Copy link
Copy Markdown
Contributor

@jdx jdx commented Apr 30, 2026

Summary

  • Adds add_dist_tag <pkg> <tag> <version> to test/test_helper/common_setup.bash. It splices a dist-tag into test/registry/storage/<pkg>/package.json via jq — Verdaccio re-reads from disk per request, so the new tag takes effect on the next resolve without a registry restart.
  • Needed by ~10 test files (heaviest in update.bats); factoring it out avoids reinventing the same jq splice in each caller.

Notes for reviewers

  • The helper mutates the committed Verdaccio fixture. Callers must restore via git checkout in teardown — same pattern deprecate.bats already uses. The doc comment spells this out and points at that file.
  • Tests using this helper aren't parallel-safe (they share the on-disk fixture across tests). Doc comment recommends # bats file_tags=serial + BATS_NO_PARALLELIZE_WITHIN_FILE=1, matching the existing convention in deprecate.bats.
  • No existing call sites are migrated in this PR — landing the helper first lets the follow-up file conversions stay narrow.

Test plan

  • Sanity-checked the helper against is-odd: adds next: 0.1.2 alongside latest: 3.0.1, then git checkout cleanly restores.
  • Confirm shfmt/shellcheck pass on test/test_helper/common_setup.bash (pre-commit ran clean locally).

🤖 Generated with Claude Code


Note

Low Risk
Low risk since it only adds a test helper, but it mutates committed Verdaccio fixtures so incorrect cleanup could cause flaky or non-parallel-safe test runs.

Overview
Adds add_dist_tag <pkg> <tag> <version> to test/test_helper/common_setup.bash to let BATS tests update a package’s dist-tags directly in the committed Verdaccio storage via jq (taking effect on the next registry resolve).

The helper writes via a temp file and documents required git checkout teardown cleanup plus serial/within-file non-parallel execution to avoid cross-test fixture races.

Reviewed by Cursor Bugbot for commit 76b0262. Bugbot is set up for automated code reviews on this repo. Configure here.

Verdaccio re-reads package.json from disk per request, so mutating
test/registry/storage/<pkg>/package.json is enough to flip a dist-tag
mid-test without a registry restart. update.bats and ~9 other files
need this pattern; factor it out so each caller doesn't reinvent the
jq splice.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

Adds add_dist_tag <pkg> <tag> <version> to test/test_helper/common_setup.bash. The helper writes jq output to a .tmp sidecar before atomically replacing the fixture, cleans up the temp file on jq failure, and documents the required git checkout teardown and serial-execution constraints. The stale-.tmp concern raised in the prior review thread is already addressed in the implementation.

Confidence Score: 5/5

Safe to merge — test-only helper with correct temp-file handling and clear usage documentation.

Single-file change adding a test helper; no production code touched. The jq-failure cleanup path correctly removes the .tmp file and returns early. The docs accurately capture the serial and teardown requirements. No P0 or P1 findings.

No files require special attention.

Important Files Changed

Filename Overview
test/test_helper/common_setup.bash Adds add_dist_tag BATS helper that splices a dist-tag into a Verdaccio fixture via jq; temp-file handling on jq failure is correct, docs clearly state teardown/serial requirements.

Reviews (2): Last reviewed commit: "test: clean up add_dist_tag tmp file on ..." | Re-trigger Greptile

Comment thread test/test_helper/common_setup.bash Outdated
@jdx jdx enabled auto-merge (squash) April 30, 2026 21:21
Empty .tmp files from a failed jq run aren't restored by the
git-checkout teardown pattern, so they'd linger as untracked junk
in the committed fixture. Guard the redirect with `|| { rm -f
"$tmp"; return 1; }`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jdx jdx merged commit 6a7c44a into main Apr 30, 2026
18 checks passed
@jdx jdx deleted the claude/nice-noyce-a68ca3 branch April 30, 2026 21:27
@github-actions
Copy link
Copy Markdown

Benchmark changes

Versions:

  • aube: 1.5.1 -> 1.5.2
  • pnpm: 11.0.1 -> 11.0.3

Public ratios: warm installs vs Bun 3x -> 4x; warm installs vs pnpm 9x -> 6x.

Benchmark aube bun pnpm
Fresh install (warm cache) 237ms -> 409ms (+73%) 728ms -> 1493ms (+105%) 2104ms -> 2312ms (+10%)
CI install (warm cache, GVS disabled) 564ms -> 932ms (+65%) 742ms -> 1491ms (+101%) 2094ms -> 2084ms (0%)
CI install (cold cache, GVS disabled) 2282ms -> 4555ms (+100%) 1895ms -> 4703ms (+148%) 5439ms -> 5064ms (-7%)

76b0262 vs b5cb3cd | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex.

jdx added a commit that referenced this pull request Apr 30, 2026
## Summary
- Check off Phase 0 — `@pnpm.e2e/*` fixtures
([#424](#424)) and `add_dist_tag`
helper ([#422](#422)) both landed.
- Record `lifecycleScripts.ts` 8/21 ported via
[#421](#421) with a done/remaining
split.
- Relabel Phase 2 as unblocked (was "depends on add_dist_tag helper").
- Refresh the conventions note now that the `@pnpm.e2e/*` fixtures are
in-tree.

## Test plan
- [ ] doc-only — render check on GitHub

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation-only updates to the pnpm test-import tracking doc; no
runtime or test behavior changes.
> 
> **Overview**
> Updates `test/PNPM_TEST_IMPORT.md` to mark Phase 0 infrastructure work
as complete (mirrored `@pnpm.e2e/*` fixtures and the `add_dist_tag`
helper), and records current Tier 1 progress for `lifecycleScripts.ts`
(8/21 ported with done/remaining notes).
> 
> Renames Phase 2 as *unblocked* now that `add_dist_tag` exists, and
refreshes the translation conventions to prefer using the in-tree
`@pnpm.e2e/*` fixtures when specific package shapes are required.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
270cfc9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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