Repository navigation
feat: add driver upgrades to lock and sync - #635
Conversation
zeroshade
left a comment
There was a problem hiding this comment.
Solid feature; the strict per-driver signer approvals, unused-approval check, and refusal to silently re-pin a changed published hash all look right. A few things to address:
-
One doc page still gives the old advice.
docs/concepts/driver_registry.md:226still says "deletedbc.lockand rundbc lock" to accept a key change. The matching text indriver_list.mdandcli.mdwas rewritten, but this one was missed. Point it atdbc lock --allow-signer-change NAME. -
No documented way to accept a corrected archive. The guide used to say "delete
dbc.lockand rundbc lockagain" to pick up a corrected archive at the same location; it now only says "have the registry publish it as a new version", which users of a third-party registry can't do. Since--upgradedeliberately fails on a changed published hash, deleting the lock file is the only way out, and it's no longer documented. Either restore that escape hatch (with its "may also change other drivers" caveat) or add a narrower option. -
Pins for dropped platforms are kept.
TestPlanLockUpgradeRetainsUnreplacedArtifacts/"target removed from declared platforms"pins that afterplatformsshrinks, an upgrade keeps the artifact for the removed target, so the lock lists artifacts outside itsplatformsand carries them as long as the version stays the same. Same for targets the index no longer lists. Keeping pins the index can't confirm makes sense, but dropping targets the user removed fromplatformsseems like the expected behavior. Please confirm this is intended and document it. -
A failed install leaves the lock ahead of what's installed.
sync --upgradewrites the lock before installing (TestSyncUpgradeInstallFailureKeepsNewLock). That matches existing sync behavior, but after a failed install the lock says 1.1.0 while 1.0.0 is still installed. A one-line stderr warning in that case would tell users a rerun is needed. -
Changed signer-mismatch output for
sync --locked(minor). The single trailing hint becomes a command repeated on each problem line. Better for scripts, but anything that parsed the old trailing hint will break; worth a release-note line. -
Stacking: this sits on #634 → #633 → #631, and #631 has changes requested. If #631 changes how versions are chosen across registries, the docs line "can select another registry with the same signing key" may need updating.
dbc sync writes the lock file before installing, so a failed install leaves the lock ahead of the installed drivers. Say so in one line on stderr and ask to rerun dbc sync. dbc sync --locked writes nothing, so it does not warn.
…pped platforms Point signer changes at the per-driver approval instead of deleting the lock file, document how to accept a corrected archive republished at the same version by resetting only that driver's lock entry, and state that artifacts of targets removed from platforms stay pinned while the version and source are unchanged. A missing version recorded in a version 1 lock file now suggests dbc lock --upgrade-driver.
a07ba74 to
18b0aba
Compare
|
zeroshade
left a comment
There was a problem hiding this comment.
Thanks, all earlier points are addressed.
- Signer-change advice:
driver_registry.mdnow gives the--allow-signer-changerecovery instead of "deletedbc.lock", and no doc page still tells users to delete the lock file. - Corrected archives: "Accepting a corrected archive" documents a narrow escape hatch. You remove only that driver's
[[drivers]]block, so other drivers keep their pins. The published-hash mismatch error links to it. The caveat about a stale published hash is a good addition. - Artifacts for dropped platforms: keeping them is intended and now documented:
platformsis the minimum set the lock must cover.additionalRegistryArtifactskeeps an old pin unless an accepted artifact replaces its target. If another target's artifact uses the same location with a different hash or size, it fails instead of silently dropping the pinned hash. - Lock ahead of installed drivers: a failed install after the lock write now warns on stderr, and
--lockedstays quiet. --lockedoutput: it was never released, so no release note is needed.- Stacking: the selection-rules link covers the change in #631. The missing-v1-version error now suggests
dbc lock --upgrade-driver NAME, andTestLockUpgradeDriverReplacesMissingV1Pinexercises that path end to end.
Two minor inline notes, neither blocking.
| err = fmt.Errorf("failed to install driver package: %w", err) | ||
| } | ||
| program.Send(fmt.Errorf("failed to install driver package: %w", err)) | ||
| program.Send(syncInstallFailedMsg{err: err}) |
There was a problem hiding this comment.
Nit: a cancelled install (for example Ctrl-C after the lock write) takes the s.ctx.Err() != nil early return just above and never sends this message, so the lock can still be ahead of the installed drivers with no warning. Consider sending the warning on that path too.
| printCmd, | ||
| s.installDriver(s.cfg, s.installItems[s.index]), | ||
| ) | ||
| case syncInstallFailedMsg: |
There was a problem hiding this comment.
Nit: writeLockFileV2 runs on every non---locked sync, even when nothing changed. So "the lock file was written" also appears when the lock still matches the installed drivers. Wording like "installation did not complete; fix the error and rerun dbc sync" would be accurate in both cases.
Follow-ups to the non-blocking review notes on #630, #631, #634 and #635. `dbc sync` saves the lock file before installing. It already warned on install failure, but could exit without a warning after Ctrl-C or SIGINT. It now warns once on stderr if it saved the lock file and installation did not finish or could not be confirmed. On an install error, the warning asks you to fix it and rerun `dbc sync`. On interruption, it says installation "may be incomplete" and asks you to rerun, since the last install may have finished before sync received its result. Both warnings say the lock file "has been saved" to avoid implying that its contents changed. SIGINT stops the CLI program without canceling sync's worker context. On exit, sync prevents a preparation worker from starting a lock-file write and waits for any write already in progress before deciding whether to warn. Smaller follow-ups: - Call `Target.PlatformTuple()` directly (#630). - Explain why the ambiguity check uses registry pointers to distinguish configurations that share a URL (#631). - Clarify that `GetWithConstraint` ignores build metadata when selecting a record (#634).
Closes #196. dbc reuses compatible lock entries so repeated installs use the same versions, sources, and signers. Deleting the lock file to refresh one driver discards every driver's pins. The new flags let you choose which versions to resolve again.
dbc lock --upgradeanddbc sync --upgradedrop the locked-version preference for all drivers. Repeat--upgrade-driver NAMEto target specific drivers. The two flags are mutually exclusive, and either conflicts withdbc sync --locked. Resolution follows the driver list's constraints, prerelease settings, platforms, and explicit sources. Other drivers follow the usual lock or sync rules. When sync writes the lock file and installation later fails, it warns on stderr and tells the user to rerun sync.platforms. The update fails if a published hash conflicts with a pin or if retained and selected artifacts at the same location disagree on hash or size. The guide explains how to accept a corrected archive republished at the same version.dbc lock --allow-signer-change NAMEto approve changes for specific drivers. Each approval must be used to accept a change to a signer pinned in the v2 lock file during this run. Moving between unsigned sources also requires declaring the destination source. After saving, dbc reports the old and new sources and signers and warns when future installs will skip library signature verification. Sync rejects signer changes and shows the driver-specificdbc lockcommand for approval.