diff --git a/.github/workflows/issue-implementation.lock.yml b/.github/workflows/issue-implementation.lock.yml index b14bf01f..6f7b8b2c 100644 --- a/.github/workflows/issue-implementation.lock.yml +++ b/.github/workflows/issue-implementation.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"1988880bf0d0724823db9ea5211a6d529628da106ccc8841b6fcdbb724075b57","body_hash":"0060d6357fc727d5a1c00f788d34d99a4a62f4cc2074c21d27d5fd8957464836","compiler_version":"v0.93.5","strict":true,"agent_id":"copilot","agent_model":"gpt-6.1-sol","detection_agent_id":"copilot","engine_versions":{"copilot":"1.0.101"}} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"9a41d4a23fd81522e1b98190621762b864c631e80a9fe1427989967d9160a5dd","body_hash":"0060d6357fc727d5a1c00f788d34d99a4a62f4cc2074c21d27d5fd8957464836","compiler_version":"v0.93.5","strict":true,"agent_id":"copilot","agent_model":"gpt-6.1-sol","detection_agent_id":"copilot","engine_versions":{"copilot":"1.0.101"}} # gh-aw-manifest: {"version":1,"secrets":["DEPENDABOT_APP_PRIVATE_KEY","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/checkout","sha":"d23441a48e516b6c34aea4fa41551a30e30af803","version":"d23441a48e516b6c34aea4fa41551a30e30af803"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"9000827ccba6bdab643e8b6fd33ac0654aef8333"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"3a2844b7e9c422d3c10d287c895573f7108da1b3"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"cf430e030ddbb5b0abf93d22962f4752f3646cd9"},{"repo":"github/gh-aw/actions/setup","sha":"32ecafbc061c9af57e9361942099e381102ae304","version":"32ecafbc061c9af57e9361942099e381102ae304"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.28.70","digest":"sha256:b15ab48cbbab02904eb9bbd359a398db59690eebbea1e6934d47ed2bb407dd34","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.28.70@sha256:b15ab48cbbab02904eb9bbd359a398db59690eebbea1e6934d47ed2bb407dd34"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.28.70","digest":"sha256:9ac8f9c7294e892c916de3da9d2588dfd8cd4931e5c39b00143266d7ed9fd52a","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.28.70@sha256:9ac8f9c7294e892c916de3da9d2588dfd8cd4931e5c39b00143266d7ed9fd52a"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.28.70","digest":"sha256:b5bc53f4becfd96e926e63c83831f1b3c9512f713c83161d2b8c9b7204b3e917","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.28.70@sha256:b5bc53f4becfd96e926e63c83831f1b3c9512f713c83161d2b8c9b7204b3e917"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.37","digest":"sha256:9c7f242f6dec2d7d7b55d4c9e07872d59b85377c6cb3de46c915a5d1ffb91442","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.37@sha256:9c7f242f6dec2d7d7b55d4c9e07872d59b85377c6cb3de46c915a5d1ffb91442"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:23746305eeded20dc2726ab18bb081962d66ee3b2e09a54291afd1869ab3ef6d","pinned_image":"ghcr.io/github/gh-aw-node@sha256:23746305eeded20dc2726ab18bb081962d66ee3b2e09a54291afd1869ab3ef6d"}],"mcp_servers":[{"name":"safeoutputs","tools":["noop","report_incomplete","report_missing_data"]}],"threat_detection":{"mode":"enabled"},"admission":false} # This file was automatically generated by gh-aw (v0.93.5). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # @@ -545,6 +545,7 @@ jobs: /AUTOMATION.md /README.md /.nvmrc + /.gitignore /.github/copilot-instructions.md /typescript/ /python/ diff --git a/.github/workflows/issue-implementation.md b/.github/workflows/issue-implementation.md index 3e6e7dd1..964643b9 100644 --- a/.github/workflows/issue-implementation.md +++ b/.github/workflows/issue-implementation.md @@ -489,6 +489,7 @@ steps: /AUTOMATION.md /README.md /.nvmrc + /.gitignore /.github/copilot-instructions.md /typescript/ /python/ diff --git a/AUTOMATION.md b/AUTOMATION.md index 2a6fecde..171424de 100644 --- a/AUTOMATION.md +++ b/AUTOMATION.md @@ -1099,6 +1099,10 @@ short-lived App-access proof are frozen. An immutable spending reservation precedes inference. The model-start guard repeats authorization and rejects App preflight older than 15 minutes. A build command expires after 24 hours. +The sparse coding checkout includes the root [`.gitignore`](./.gitignore). +This keeps the collector's standard Git ignore checks offline in a partial clone, +instead of requiring a lazy fetch from inside the sandbox. + Detection is eligible only after successful preparation and successful, sole-`noop` agent completion. Its inference credential is released only after the trusted authorization and exact-patch staging step succeeds and preceding job steps diff --git a/tools/tests/implementation-workflow.test.mjs b/tools/tests/implementation-workflow.test.mjs index 7bd0f077..6b6be3fd 100644 --- a/tools/tests/implementation-workflow.test.mjs +++ b/tools/tests/implementation-workflow.test.mjs @@ -2,11 +2,15 @@ // Licensed under the MIT License. import assert from "node:assert/strict"; +import { execFileSync } from "node:child_process"; import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; import test from "node:test"; +import { pathToFileURL } from "node:url"; import { runInNewContext } from "node:vm"; import { parse } from "yaml"; -import { BUILD_LIMITS } from "../issue-implementation.mjs"; +import { BUILD_LIMITS, blobHash, collectCandidate } from "../issue-implementation.mjs"; const workflows = new URL("../../.github/workflows/", import.meta.url); const markdown = fs.readFileSync(new URL("issue-implementation.md", workflows), "utf8"); @@ -27,6 +31,48 @@ test("coding is inactive by default and only an owner Issue comment can activate assert.equal(source.concurrency["job-discriminator"], "${{ github.run_id }}"); }); +test("sparse coding checkouts collect complete candidates offline with ignore rules", t => { + const checkout = source.steps.find(step => step.uses?.startsWith("actions/checkout@")); + const compiledCheckout = compiled.jobs.agent.steps.find(step => step.uses?.startsWith("actions/checkout@")); + assert.equal(checkout.with["sparse-checkout-cone-mode"], false); + assert.equal(compiledCheckout.with["sparse-checkout"], checkout.with["sparse-checkout"]); + + const directory = fs.mkdtempSync(path.join(os.tmpdir(), "typechat-sparse-collector-")); + t.after(() => fs.rmSync(directory, { recursive: true, force: true })); + const origin = path.join(directory, "origin"); + const coding = path.join(directory, "coding"); + const git = (cwd, args, options = {}) => execFileSync("git", ["-C", cwd, ...args], + { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], ...options }); + git(directory, ["init", "--quiet", origin]); + git(origin, ["config", "core.autocrlf", "false"]); + git(origin, ["config", "uploadpack.allowFilter", "true"]); + fs.writeFileSync(path.join(origin, ".gitignore"), "node_modules/\n"); + fs.mkdirSync(path.join(origin, "python"), { recursive: true }); + const original = "value = 1\n"; + fs.writeFileSync(path.join(origin, "python", "value.py"), original); + git(origin, ["add", "--all"]); + git(origin, ["-c", "user.name=TypeChat Test", "-c", "user.email=typechat-test@example.invalid", "-c", "commit.gpgsign=false", + "commit", "--quiet", "-m", "Sparse checkout fixture", "-m", "Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>"]); + const prepared = { source: { commit: git(origin, ["rev-parse", "HEAD"]).trim() } }; + git(directory, ["clone", "--quiet", "--no-checkout", "--filter=blob:none", pathToFileURL(origin).href, coding]); + assert.equal(git(coding, ["config", "--get", "remote.origin.promisor"]).trim(), "true"); + git(coding, ["config", "core.autocrlf", "false"]); + git(coding, ["sparse-checkout", "set", "--no-cone", "--stdin"], { input: checkout.with["sparse-checkout"] }); + git(coding, ["checkout", "--quiet", prepared.source.commit]); + git(coding, ["remote", "set-url", "origin", pathToFileURL(path.join(directory, "unavailable-origin")).href]); + fs.writeFileSync(path.join(coding, "python", "value.py"), "value = 2\n"); + fs.writeFileSync(path.join(coding, "python", "added.py"), "added = True\n"); + fs.mkdirSync(path.join(coding, "python", "node_modules")); + fs.writeFileSync(path.join(coding, "python", "node_modules", "ignored.py"), "not part of the candidate\n"); + + const candidate = collectCandidate(prepared, coding, "Collect the complete offline patch."); + assert.equal(candidate.baseSha, prepared.source.commit); + assert.deepEqual(candidate.files, [ + { path: "python/added.py", previousSha: null, content: "added = True\n" }, + { path: "python/value.py", previousSha: blobHash(original), content: "value = 2\n" }, + ]); +}); + test("native budgets, execution limits, exact completion, and separate usage are enforced", () => { assert.equal(source["max-ai-credits"], BUILD_LIMITS.mainCredits); assert.equal(source["max-turns"], BUILD_LIMITS.maxTurns); diff --git a/typescript/tests/package.test.mjs b/typescript/tests/package.test.mjs index d724841a..84b770e9 100644 --- a/typescript/tests/package.test.mjs +++ b/typescript/tests/package.test.mjs @@ -24,7 +24,21 @@ const childEnv = { ...process.env, NODE_OPTIONS: "", VSCODE_INSPECTOR_OPTIONS: " let packedFiles; before(() => { - const options = { cwd: packageRoot, encoding: "utf8", env: childEnv, timeout: 30000 }; + const packageSource = join(directory, "package-source"); + cpSync(packageRoot, packageSource, { + recursive: true, + filter: source => { + const relativePath = path.relative(packageRoot, source); + return !relativePath + .split(path.sep) + .some(segment => ["node_modules", "out", ".git"].includes(segment)); + }, + }); + const packageManifestPath = join(packageSource, "package.json"); + const packageManifest = JSON.parse(readFileSync(packageManifestPath, "utf8")); + delete packageManifest.scripts.prepare; + writeFileSync(packageManifestPath, JSON.stringify(packageManifest, null, 2)); + const options = { cwd: packageSource, encoding: "utf8", env: childEnv, timeout: 30000 }; const packed = process.platform === "win32" ? spawnSync(process.env.ComSpec ?? "cmd.exe", ["/d", "/s", "/c", "npm pack --ignore-scripts --dry-run --json"], options) : spawnSync("npm", ["pack", "--ignore-scripts", "--dry-run", "--json"], options);