Repository navigation
fix(desktop-commander): promote is a no-op when the verified upload already serves 100% #13479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Type surface for promote.mjs (a plain Node script; vitest tests import | ||
| // its pure helper). deploymentStatus classifies the live deployment | ||
| // against a provenance manifest: "already-promoted" when the manifest | ||
| // version is already the sole 100% deployment, "at-baseline" when the | ||
| // active version matches the manifest baseline, "drifted" otherwise. | ||
| export type DeploymentStatus = "already-promoted" | "at-baseline" | "drifted"; | ||
|
|
||
| export interface ManifestVersionEntry { | ||
| version_id?: string; | ||
| percentage?: number; | ||
| } | ||
|
|
||
| export interface ManifestDeployment { | ||
| versions?: ManifestVersionEntry[]; | ||
| } | ||
|
|
||
| export interface PromotionManifest { | ||
| versionId: string; | ||
| baselineVersionId: string; | ||
| } | ||
|
|
||
| export function deploymentStatus( | ||
| current: ManifestDeployment | undefined, | ||
| manifest: PromotionManifest, | ||
| ): DeploymentStatus; |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { deploymentStatus } from "../promote.mjs"; | ||
|
|
||
| // Oracle: the promote drift contract in pkgs/desktop-commander/worker/README.md — | ||
| // promotion proceeds only at the manifest baseline, is a no-op success when the | ||
| // verified upload is already the sole 100% deployment, and refuses any other | ||
| // live state (#13472: the target version had already been deployed and the | ||
| // baseline-only check misread that success as drift). | ||
|
|
||
| const manifest = { | ||
| versionId: "37e2f6a3-f2ed-4f77-a84a-a7acf67f6ff4", | ||
| baselineVersionId: "c2ac67bb-f7ab-4912-a820-aa2ead4aa908", | ||
| }; | ||
|
|
||
| describe("promotion drift classification", () => { | ||
| it("treats the verified upload already serving 100% as already-promoted", () => { | ||
| expect( | ||
| deploymentStatus( | ||
| { versions: [{ version_id: manifest.versionId, percentage: 100 }] }, | ||
| manifest, | ||
| ), | ||
| ).toBe("already-promoted"); | ||
| }); | ||
|
|
||
| it("allows promotion when the live deployment still matches the baseline", () => { | ||
| expect( | ||
| deploymentStatus( | ||
| { versions: [{ version_id: manifest.baselineVersionId, percentage: 100 }] }, | ||
| manifest, | ||
| ), | ||
| ).toBe("at-baseline"); | ||
| }); | ||
|
|
||
| it("refuses drift to an unrelated active version", () => { | ||
| expect( | ||
| deploymentStatus( | ||
| { versions: [{ version_id: "00000000-0000-0000-0000-000000000000", percentage: 100 }] }, | ||
| manifest, | ||
| ), | ||
| ).toBe("drifted"); | ||
| }); | ||
|
|
||
| it("refuses a partial rollout of the verified upload instead of guessing", () => { | ||
| expect( | ||
| deploymentStatus( | ||
| { versions: [{ version_id: manifest.versionId, percentage: 50 }, { version_id: manifest.baselineVersionId, percentage: 50 }] }, | ||
| manifest, | ||
| ), | ||
| ).toBe("drifted"); | ||
| }); | ||
|
|
||
| it("refuses an empty or malformed deployment record", () => { | ||
| expect(deploymentStatus(undefined, manifest)).toBe("drifted"); | ||
| expect(deploymentStatus({}, manifest)).toBe("drifted"); | ||
| expect(deploymentStatus({ versions: [] }, manifest)).toBe("drifted"); | ||
| }); | ||
| }); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a first publish with no existing deployment,
upload-version.mjsexplicitly recordsbaselineVersionId: null. If the deployment list is empty when promoting that upload, this comparison checksundefined === nulland classifies the state as drifted, preventing the initial deployment. The previous implementation normalized a missing active version with?? null, allowing this supported bootstrap path. Preserve that normalization when comparing against the baseline.Useful? React with 👍 / 👎.