Files
codex-security/evals/package-application-mapping/cases.mts
utsav-oaiandutsav-oai e224a3314b fix(cli): hillclimb dependency investigation eval & speed (#2737)
* feat(cli): add independently reviewed dependency checks

* Compare frozen Python advisory versions as releases

* fix(cli): bind unnamed root manifests to observed services

* test(cli): evaluate dependency investigations across public fixtures

* test(sdk): bound the budget wait after the mock scan starts

* test(cli): exercise MCP evidence and missing caller access

* Bind graded citations to the approved use evidence

* test: restore dependency investigation quality controls

* fix(cli): restore dependency investigation and report compatibility

* test: grade malformed dependency baseline answers

* fix(cli): scope headless tool access to the investigator

* test(cli): lock down reviewer and external evidence tool access

* fix(cli): keep linked evidence tied to its originating call

* Reconcile application mappings and expose original evidence hashes

* test: verify selected catalog rows against original replies

* fix(cli): recover incomplete reviews and preserve selected evidence rows

* fix(cli): preserve wire evidence and verify finding citations

* Finalize from approved submissions and explain remaining uses

* fix(cli): restore coordinator recovery, independent review and report contracts

* Review withdrawals under the original dependency assessment ID

* test(cli): compare trace progress with completed search scopes

* Recheck dependency coverage after concurrent investigation changes

* Preserve exploratory scope explanations during dependency review

* feat(cli): track shared source work in dependency investigations

* Include shared source work in final coverage checks

* Require deciding evidence on the caller it establishes

* Preserve generic MCP search outcomes and scopes in dependency reports

* Share pinned source notes between dependency investigators

* Ship the source worklist and search audit modules

* refactor(cli): name the dependency coordinator for its ability to resume

* refactor(cli): simplify the tools for dependency investigations

* fix(cli): keep investigation tool arguments visible to Codex and reuse the evidence store

* fix(cli): send missing verdict citations back to the reviewer

* fix(cli): verify caller bindings and input flow across investigation steps

* fix(cli): require direct citations for asserted runtime facts on every use

* test(cli): verify failed catalog lookups without a timed source scan

---------

Co-authored-by: utsav-oai <348536218+utsav-oai@users.noreply.github.com>
2026-11-19 11:10:07 -08:00

188 lines
5.3 KiB
TypeScript

export interface CatalogService {
id: string;
name: string;
}
export interface MappingCase {
id: string;
package: string;
path: string;
files: Record<string, string>;
catalog?: Record<string, CatalogService[]>;
expected: { applications: CatalogService[] };
}
export const catalogServer = "mapping_catalog";
export const catalogTool = "lookup_service_by_path";
const packageName = "@sample/labels";
const consumer = "packages/runner/main.cjs";
const weekly = { id: "svc-18", name: "weekly-delivery" };
const morning = { id: "svc-25", name: "morning-delivery" };
const evening = { id: "svc-76", name: "evening-delivery" };
const bulletin = { id: "svc-92", name: "print-delivery" };
function projectCatalog(
project: string,
entry: string,
...services: CatalogService[]
) {
return {
[project]: services,
[`${project}/package.json`]: services,
[entry]: services,
};
}
const workspace = {
"package.json": '{"private":true,"workspaces":["packages/*"]}\n',
"packages/labels/package.json":
'{"name":"@sample/labels","version":"1.0.0"}\n',
"packages/labels/index.js": "exports.label = value => String(value);\n",
"packages/runner/package.json":
'{"name":"report-runner","private":true,"scripts":{"start":"node main.cjs"},"dependencies":{"@sample/labels":"1.0.0"}}\n',
[consumer]:
'const { label } = require("@sample/labels");\nconsole.log(label(process.env.EDITION || "daily"));\n',
};
const dockerfile = `FROM node:22
WORKDIR /app
COPY . .
RUN npm install --offline --ignore-scripts --no-audit
`;
export const cases: MappingCase[] = [
{
id: "external-launcher",
package: packageName,
path: consumer,
files: {
...workspace,
Dockerfile: dockerfile,
"packages/runner-next/package.json":
'{"name":"report-runner-next","private":true}\n',
"packages/runner-next/main.cjs": 'console.log("preview");\n',
".github/workflows/check.yaml": `name: Check
on: [push]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: node --check packages/runner/main.cjs
`,
"ops/weekly/compose.yaml": `services:
digest:
build: ../..
command: ["node", "packages/runner/main.cjs"]
preview:
build: ../..
command: ["node", "packages/runner-next/main.cjs"]
`,
},
catalog: {
...projectCatalog("packages/runner", consumer, weekly),
...projectCatalog(
"packages/runner-next",
"packages/runner-next/main.cjs",
{
id: "svc-41",
name: "preview-delivery",
},
),
"ops/weekly/compose.yaml": [weekly],
".github/workflows/check.yaml": [],
},
expected: { applications: [weekly] },
},
{
id: "shared-project",
package: packageName,
path: consumer,
files: {
...workspace,
Dockerfile: dockerfile,
"ops/morning/compose.yaml": `name: morning-edition
services:
digest:
build: ../..
command: ["node", "packages/runner/main.cjs"]
environment:
EDITION: morning
`,
"ops/evening/compose.yaml": `name: evening-edition
services:
digest:
build: ../..
command: ["node", "packages/runner/main.cjs"]
environment:
EDITION: evening
`,
},
catalog: {
...projectCatalog("packages/runner", consumer, morning, evening),
"ops/morning/compose.yaml": [morning],
"ops/evening/compose.yaml": [evening],
},
expected: { applications: [morning, evening] },
},
{
id: "runnable-package",
package: packageName,
path: consumer,
files: { ...workspace },
catalog: projectCatalog("packages/runner", consumer),
expected: { applications: [] },
},
{
id: "shared-library-consumer",
package: packageName,
path: "packages/format/render.cjs",
files: {
"package.json": '{"private":true,"workspaces":["packages/*","jobs/*"]}\n',
"packages/labels/package.json": workspace["packages/labels/package.json"],
"packages/labels/index.js": workspace["packages/labels/index.js"],
"packages/format/package.json":
'{"name":"@sample/format","version":"1.0.0","main":"render.cjs","dependencies":{"@sample/labels":"1.0.0"}}\n',
"packages/format/render.cjs":
'const { label } = require("@sample/labels");\nmodule.exports = value => label(value);\n',
"jobs/print/package.json":
'{"name":"print-job","private":true,"dependencies":{"@sample/format":"1.0.0"}}\n',
"jobs/print/start.cjs":
'const render = require("@sample/format");\nconsole.log(render("daily"));\n',
Dockerfile: dockerfile,
"ops/print/compose.yaml": `services:
bulletin:
build: ../..
command: ["node", "jobs/print/start.cjs"]
`,
},
catalog: {
...projectCatalog("jobs/print", "jobs/print/start.cjs", bulletin),
"ops/print/compose.yaml": [bulletin],
},
expected: { applications: [bulletin] },
},
{
id: "catalog-unavailable",
package: packageName,
path: consumer,
files: {
...workspace,
"packages/runner/catalog-info.yaml": `apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: report-runner
spec:
type: service
lifecycle: production
owner: examples
`,
"compose.yaml": `services:
digest:
build: .
command: ["node", "packages/runner/main.cjs"]
`,
Dockerfile: dockerfile,
},
expected: { applications: [] },
},
];