fix(drivers): check retained package before reinstall - #1117
Merged
Merged
Conversation
Contributor
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_11e1826c-24c4-431d-b13f-d514ef47d5a6) |
Codex Review SummaryThis 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. |
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.
An install recorded before the format column existed could be relabeled as a direct-manifest driver when its repository alias was reused. If its Sourceful package envelope remained, startup then failed after activation had already replaced the rollback record with the same path.
Check for a retained package envelope before writing files or activation state. Any envelope presence, including corrupt files and dangling symlinks, rules out a direct-manifest reinstall. When an older row has no envelope and no recorded format, require the existing signed backfill check for its source, exact artifact and v1 contract. A missing file cannot establish legacy format. This also protects retained files without a database row.
Tests exercise valid, corrupt, dangling and missing envelopes, the unchanged activation and rollback record on rejection, and valid same-format reinstalls. Verified legacy format may persist if a later install step fails; the backfill leaves activation and rollback state intact. The previous installer fails the new regressions.
Validation:
make verifyandgo test -race ./internal/driverrepo ./internal/drivers -count=1pass. An overlay of the installer from8617c7e9fails all four negative cases, including replacement of the active symlink. Positive tests cover canonical reinstall and an older direct-manifest reinstall followed by Registry startup and default. Independent source review and a second focused race run found no further issues.Addresses the late review of #1115. These tests use local signed fixtures and synthetic adapters; no physical device or driver source change is included.
Note
Medium Risk
Changes the driver install activation path and format classification for legacy rows; behavior is fail-closed with new regression tests around rollback preservation.
Overview
Fixes a case where reinstalling over a pre-format-column install could treat a retained Sourceful driver as a direct-manifest (
FTWManifestV1) install when the same repository id was reused, leaving activation/rollback in a bad state before startup failed.installResolvednow runs these checks before writing the artifact or touching activation: if the target repo is direct-manifest, any on-disk package envelope next to the retained artifact (including corrupt files or dangling symlinks) blocks the reinstall; when the DB row has emptyRepositoryFormatand no envelope, install requiresrecordDirectManifestFormat(signed legacy metadata) instead of assuming v1.Rejected installs leave the active install row, rollback pointer, Lua artifact, envelope, and active symlink unchanged. New tests cover envelope variants, canonical Sourceful reinstall, and verified legacy direct-manifest reinstall through driver registry startup.
Reviewed by Cursor Bugbot for commit 13de3cd. Bugbot is set up for automated code reviews on this repo. Configure here.