Repository navigation
Wave 5: runtime-docker #7
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
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b2570e4
fix: Core ID assignment — SHA-256 content-addressed IDs per ADR-006
ThePlenkov 403d068
test: update expectations for SHA-256 content-addressed IDs
ThePlenkov 5d8892d
refactor: eliminate canonical JSON duplication between core and ir
ThePlenkov fe92e6b
fix(core): align canonicalStringify with tests (Date, undefined, lone…
devin-ai-integration[bot] f9f233b
Merge pull request #6 from sverka-dev/fix-core-id-assignment
ThePlenkov 5038d7a
feat: Wave 5 — runtime-docker package (Docker executor)
ThePlenkov 818a725
fix(runtime-docker): extract validateRequest/runContainer/finalizeRes…
ThePlenkov 474c118
fix(runtime-docker, core, ir): address CodeRabbit review threads for …
devin-ai-integration[bot] f2e5bc8
fix(runtime-docker): address resolved review threads on socket policy…
devin-ai-integration[bot] 11e2bad
fix(core,runtime-docker): reduce Codacy complexity/line-count findings
devin-ai-integration[bot] a9b7190
fix(core,ir): address CodeRabbit review findings
devin-ai-integration[bot] 8874d85
refactor(ir): split validateOperationIdentity to reduce cyclomatic co…
devin-ai-integration[bot] c0e424f
fix(runtime-host): treat spawn failure as runtime error
devin-ai-integration[bot] 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,73 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { createHash } from "node:crypto"; | ||
| import { computeOperationId } from "../internal/ids.js"; | ||
| import { canonicalStringify } from "../internal/canonical.js"; | ||
|
|
||
| const OP_ID_RE = /^op-[0-9a-f]{64}$/; | ||
|
|
||
| describe("computeOperationId", () => { | ||
| it("is prefixed with op- followed by 64 hex chars", () => { | ||
| const id = computeOperationId("run", "build", {}); | ||
| expect(id).toMatch(OP_ID_RE); | ||
| }); | ||
|
|
||
| it("is deterministic for identical inputs", () => { | ||
| expect(computeOperationId("run", "build", { os: "linux" })).toBe( | ||
| computeOperationId("run", "build", { os: "linux" }), | ||
| ); | ||
| }); | ||
|
|
||
| it("is independent of context key insertion order", () => { | ||
| const a = computeOperationId("run", "build", { os: "linux", arch: "x64" }); | ||
| const b = computeOperationId("run", "build", { arch: "x64", os: "linux" }); | ||
| expect(a).toBe(b); | ||
| }); | ||
|
|
||
| it("differs across kinds", () => { | ||
| expect(computeOperationId("run", "build", {})).not.toBe( | ||
| computeOperationId("check", "build", {}), | ||
| ); | ||
| }); | ||
|
|
||
| it("differs across names", () => { | ||
| expect(computeOperationId("run", "build", {})).not.toBe( | ||
| computeOperationId("run", "test", {}), | ||
| ); | ||
| }); | ||
|
|
||
| it("differs across context values", () => { | ||
| expect(computeOperationId("run", "build", { os: "linux" })).not.toBe( | ||
| computeOperationId("run", "build", { os: "macos" }), | ||
| ); | ||
| }); | ||
|
|
||
| it("differs when context values differ only by type", () => { | ||
| expect(computeOperationId("run", "build", { target: 1 })).not.toBe( | ||
| computeOperationId("run", "build", { target: "1" }), | ||
| ); | ||
| }); | ||
|
|
||
| it("matrix expansion produces distinct, deterministic ids", () => { | ||
| const combos = [ | ||
| { os: "linux", arch: "x64" }, | ||
| { os: "linux", arch: "arm64" }, | ||
| { os: "macos", arch: "x64" }, | ||
| { os: "macos", arch: "arm64" }, | ||
| ]; | ||
| const ids = combos.map((c) => computeOperationId("run", "build", c)); | ||
| expect(new Set(ids).size).toBe(ids.length); | ||
| expect(combos.map((c) => computeOperationId("run", "build", c))).toEqual(ids); | ||
| }); | ||
|
|
||
| it("matches a manual sha256 over the canonical JSON of {kind,name,context}", () => { | ||
| const kind = "run"; | ||
| const name = "build"; | ||
| const context = { os: "linux", arch: "x64" }; | ||
| const expected = | ||
| "op-" + | ||
| createHash("sha256") | ||
| .update(canonicalStringify({ kind, name, context }), "utf8") | ||
| .digest("hex"); | ||
| expect(computeOperationId(kind, name, context)).toBe(expected); | ||
| }); | ||
| }); |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.