Skip to content

feat: add apply --force flag and rename --no-apply to --save-only#33

Merged
mikolalysenko merged 5 commits intomainfrom
feat/force-and-save-only
Mar 4, 2026
Merged

feat: add apply --force flag and rename --no-apply to --save-only#33
mikolalysenko merged 5 commits intomainfrom
feat/force-and-save-only

Conversation

@mikolalysenko
Copy link
Contributor

Summary

  • Add --force / -f flag to apply command that skips pre-application hash verification, allowing patches to be applied even when the installed package version differs from what the patch targets
  • Rename get --no-apply to get --save-only for clarity, keeping --no-apply as a backward-compatible alias
  • When --force is enabled: HashMismatch files are patched anyway, NotFound (non-new) files are skipped instead of aborting
  • PyPI variant selection also respects --force by skipping the pre-check that filters variants by hash

Test plan

  • 235 unit tests pass (cargo test --workspace)
  • 2 new unit tests: test_apply_package_patch_force_hash_mismatch, test_apply_package_patch_force_not_found_skips
  • cargo clippy --workspace -- -D warnings clean
  • New e2e tests (run with --ignored):
    • test_npm_save_only — verifies --save-only saves manifest without applying
    • test_npm_apply_force — installs minimist@1.2.2, saves patch, reinstalls @1.2.5, verifies normal apply fails then --force succeeds
    • test_pypi_save_only — verifies --save-only for PyPI patches
    • test_pypi_apply_force — corrupts a file to create hash mismatch, verifies normal apply fails then --force succeeds

🤖 Generated with Claude Code

mikolalysenko and others added 5 commits March 4, 2026 16:33
Add --force/-f flag to `apply` command that skips pre-application hash
verification, allowing patches to be applied even when the installed
package version differs from what the patch targets. When force is
enabled, hash mismatches are treated as ready-to-patch and missing
files (for non-new entries) are skipped rather than aborting.

Rename `get --no-apply` to `get --save-only` for clarity, with
`--no-apply` kept as a backward-compatible alias.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n swap

npm test: Swapping to minimist@1.2.5 changes the PURL version so the
crawler never matches the manifest key — apply returns success without
reaching the hash check. Instead, corrupt the file content in-place.

pypi test: The pydantic-ai patch variant may have files with empty
beforeHash (new files). Dynamically find a file with a non-empty
beforeHash to corrupt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Hash)

The pydantic-ai@0.0.36 patch treats all files as new (empty beforeHash),
so hash mismatch cannot occur. The --force feature is covered by the npm
e2e test and 2 unit tests in apply.rs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mikolalysenko mikolalysenko merged commit 1ac23f1 into main Mar 4, 2026
10 checks passed
@mikolalysenko mikolalysenko deleted the feat/force-and-save-only branch March 4, 2026 22:01
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