Skip to content

fix(cli): enforce fingerprint-safe install and sync - #804

Merged
XiaoSeS merged 4 commits into
mainfrom
codex/fix/cli-fingerprint-guards-20260902
Sep 2, 2026
Merged

fix(cli): enforce fingerprint-safe install and sync#804
XiaoSeS merged 4 commits into
mainfrom
codex/fix/cli-fingerprint-guards-20260902

Conversation

@XiaoSeS

@XiaoSeS XiaoSeS commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • validate the extracted install snapshot against the fingerprint returned by resolve before replacing files or writing inventory
  • make namespace sync decide from semantic version order plus fingerprint
  • block same-version content drift, automatic downgrade, and unorderable versions with validation exit code 6
  • keep hard remote guards effective under local edits, --force, and --check
  • share the strict version comparator with upgrade and document the behavior

Behavior

Local vs remote Result
same version + same fingerprint up-to-date
remote version is newer update-available, even when content is identical
same version + different fingerprint blocked; verify and use explicit install
remote version is older blocked; no automatic downgrade
version order cannot be determined blocked; no automatic update

--force only permits overwriting local edits during an otherwise valid update. It does not bypass any remote integrity/version guard. Blocked pull/check results use validation exit code 6.

Validation

  • cd cli && bun test: 432 passed, 0 failed
  • cd cli && bun run typecheck: passed
  • cd cli && bun run lint: passed
  • cd cli && bun run build: passed
  • cd cli && node dist/index.js version: passed
  • GitHub CLI matrix: Ubuntu, macOS, Windows passed
  • DCO and CLA passed
  • independent exact-diff review: no unresolved findings
  • exact-SHA release Compose smoke passed at 362ca1e06a76512d61aa9b8aa5b8d98cccb00796, with MinIO pinned to RELEASE.2025-09-07T16-13-09Z and its digest

Manual retest

  1. Install integrity:
    cd cli && bun test test/unit/services/install-service.test.ts --test-name-pattern "rejects a downloaded fingerprint mismatch"
    Expected: exit code 6; existing skill directory and inventory remain byte-for-byte unchanged; temporary install directory is removed.
  2. Sync decision table:
    cd cli && bun test test/integration/sync-command.test.ts
    Expected: the five rows above are observed; blocked --check and --force exit 6; no install action runs; local files remain unchanged.
  3. Force bypass regression:
    In the sync integration output, verify the parameterized local-edit cases cover downgrade, same-version drift, and unknown version order. Each must report blocked, retain changedFiles: ["SKILL.md"], and return no actions.

The running Compose preview validates the exact-SHA server/runtime and MinIO upload/download path. The CLI branch decisions are intentionally reproduced against the controlled fake registry so version and fingerprint combinations can be set deterministically.

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
@XiaoSeS
XiaoSeS marked this pull request as ready for review September 2, 2026 10:25
@XiaoSeS
XiaoSeS merged commit 2b831f3 into main Sep 2, 2026
17 of 18 checks passed
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