Repository navigation
Description
Problem or Motivation
ADR 0018 (docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md, #3242) defines seven isolation controls to ensure commands run by the planner cannot write to the repository, access secrets, or contact the network. Proof tests must verify that these controls hold.
Proposed Solution & Architectural Design
Add offline and live proof tests in tests/roadmap/test_roadmap_run_job.py:
- Implement offline invariant tests verifying the Job spec rendered via
build_job:test_a_write_outside_the_read_only_copy_fails: verifiesreadOnly: trueon the repo mount and ensures only the twoemptyDirvolumes are writable.test_a_read_of_a_credential_and_of_the_service_account_token_finds_no_file: verifiesautomountServiceAccountToken: false, no secretenvFrom, and credential-free ConfigMap volume.test_an_outbound_connection_fails: verifies NetworkPolicy selects Job pod labels and denies all egress and DNS.
- Implement live cluster verification test:
test_the_run_job_holds_the_three_controls: executes write attempt, credential read attempt, and outbound network attempt in the real cluster pod.- Mark live test with
k8smarker and declare marker inpyproject.toml.
Depends on: #3242 (ADR 0018).
Target Subsystem
SDLC, Git & PR Governance
Existing Tool Considered
Pytest with existing test fixtures and Kubernetes job templates covers offline assertions. The cluster test uses the existing k8s marker pattern. Implementing these test suites costs approximately 10,000 tokens and 0.5 elapsed days.
Alternatives check of 2026-11-09: not-applicable.
Class: test, no search.
Tool: none found.
Proposed design
Problem statement
ADR 0018 defines seven isolation controls for the planner run Job. The repository has no proof tests for these controls. This item adds offline tests that read the run Job and its NetworkPolicy. It also adds one live test. The live test tries a write, a credential read and an outbound connection. The run Job manifest and its NetworkPolicy arrive with #4003. The tests wait for that merge.
Acceptance criteria
Requirement: Offline write test reads the read-only repository mount
The test test_a_write_outside_the_read_only_copy_fails SHALL assert that the run Job mounts the staged commit read-only and that only the home and tmp emptyDir volumes are writable.
Scenario: A run Job is built from the planner run CronJob
- WHEN The test calls
build_jobwith thedevops-cli-planner-runCronJob and the planner template. - THEN The repository mount has
readOnly: true, and the only writable volumes arehomeandtmp.
Requirement: Offline credential test reads no secret and no token
The test test_a_read_of_a_credential_and_of_the_service_account_token_finds_no_file SHALL assert that the run Job has no Secret envFrom, a credential-free config volume, and automountServiceAccountToken: false.
Scenario: A run Job is built from the planner run CronJob
- WHEN The test reads the container
envFrom, theconfigvolume, and the podautomountServiceAccountToken. - THEN No
envFromnames Secretdevops-cli, theconfigvolume comes from the credential-free ConfigMap, andautomountServiceAccountTokenisfalse.
Requirement: Offline network test reads a deny-all egress policy
The test test_an_outbound_connection_fails SHALL assert that the devops-cli-planner-run NetworkPolicy selects the run Job pod labels and admits no egress and no DNS.
Scenario: The planner run NetworkPolicy is read
- WHEN The test reads the
podSelector,policyTypes, andegressrules of the NetworkPolicy. - THEN The selector matches the run Job pod labels,
policyTypesincludesEgress, and no egress rule admits traffic or DNS.
Requirement: The live test carries the k8s marker
The live test test_the_run_job_holds_the_three_controls SHALL carry the k8s marker, and pyproject.toml SHALL declare that marker.
Scenario: The test suite collects the live test
- WHEN pytest collects
tests/roadmap/test_roadmap_run_job.pywithout-m k8s. - THEN The live test is skipped, and the
k8smarker is declared inpyproject.toml.
Requirement: The live test holds the three attempts
The live test SHALL attempt a write, a credential read, and a public connection in the run Job pod, and SHALL assert that each fails.
Scenario: The live test source is read
- WHEN A test reads
tests/roadmap/test_roadmap_run_job.py. - THEN The file contains the three attempts in the run Job pod and asserts that each fails.
Requirement: The proof tests live in one module
The change SHALL add the three offline tests and the live test to tests/roadmap/test_roadmap_run_job.py.
Scenario: The test module is collected
- WHEN pytest collects the
tests/roadmapfolder. - THEN The module
tests/roadmap/test_roadmap_run_job.pyholds the three offline tests and the live test.
Existing Tool Considered
The alternatives check returned not-applicable for this test item and named no tool. Pytest, already a dev dependency, covers the offline test harness. It lacks the devops-cli-planner-run CronJob and NetworkPolicy, which #4003 adds, and a cluster for the live test. The test suite costs about 10,000 tokens and 0.5 elapsed days.
Key questions
- Which CronJob does the proof test read to render the run Job?: The suspended CronJob
devops-cli-planner-run, whichPLANNER_TEMPLATEnames insrc/devops_cli/k8s/cluster_job.py. feat(k8s): manifest and admission policy for planner sandboxed run job #4003 adds its manifest. [sources: src/devops_cli/k8s/cluster_job.py, docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md] - Which pytest marker selects the live cluster test?:
k8s. The change adds the marker topyproject.toml, and only-m k8sselects the live test. (best practice) [sources: docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md, pyproject.toml]- Chosen: k8s. ADR 0018 names
k8sfor the live proof test, andpyproject.tomldeclares nok8smarker today. - Rejected: live.
liveselects local tool binaries, not a cluster test. - Rejected: bwrap.
bwrapselects bubblewrap sandbox tests, not Kubernetes.
- Chosen: k8s. ADR 0018 names
- Is the
k8smarker already declared inpyproject.toml?: No.pyproject.tomldeclares the markersbwrap,liveandunreachableonly. The change addsk8s. [sources: pyproject.toml] - Does the live test run in CI by default?: No. The
k8smarker excludes it unless a person runspytest -m k8s. [sources: pyproject.toml, docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md] - Should the live test be deferred to a new issue?: No. The test is written in the module and marked
k8s; a person runs it with a cluster. The offline tests carry the CI proof. (best practice) [sources: docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md]- Chosen: Keep the live test in the module. ADR 0018 names one live test in this module, and the test blocks no merge.
- Rejected: Defer the live test to a new issue. The test can be written with the offline tests, and the ADR names it here.
- What does the offline write test assert about the repository mount?: It asserts
readOnly: trueon the repository mount and that only thehomeandtmpemptyDirvolumes are writable. [sources: docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md] - What does the offline credential test assert?: It asserts no
envFromof Secretdevops-cli, aconfigvolume from the credential-free ConfigMap, andautomountServiceAccountToken: false. [sources: docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md] - What does the offline network test assert?: It asserts that a NetworkPolicy selects the run Job pod labels, that
policyTypesincludesEgress, and that no egress rule admits traffic or DNS. [sources: docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md] - Which issue must merge before the proof tests can read the run Job and NetworkPolicy?: feat(k8s): manifest and admission policy for planner sandboxed run job #4003, which adds the
devops-cli-planner-runCronJob and its NetworkPolicy. The draft pull request feat(k8s): Add the planner sandboxed run Job #5754 is not merged. [sources: docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md]
Fit
Fits in one pull request.
Suspected block
None.
Activity
devops-cli-service commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The tests confirm security controls, but the work depends on the manifest and the ADR.The tests show that the sandbox controls hold and prevent a regression.The candidate estimates 10,000 tokens and 0.5 elapsed days for two test suites.Both items cover the same seven isolation controls. Item 4003 adds the manifest and the policy, and this item adds the proof tests.devops-cli-service commentedon Nov 8, 2026
Refine cannot set this item to Ready at 1f03ee3 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
devops-cli-service commentedon Nov 9, 2026
Alternatives check: not-applicable
Class: test. The check makes no search and no model call for an item of this class.
Tool: none found
Checked on 2026-11-09. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 14, 2026
The item waits on #4003, whose manifest is a draft pull request (#5754) and not on
main. The refine block records the same block: "the run Job CronJob manifest of ADR 0018 follow-up 1 is not in the repository".devops-cli-planner-runand NetworkPolicydevops-cli-planner-run, and neither file is onmaintoday.main, a cluster with the devops stack, and the gVisor node.k8smarker is already declared inpyproject.toml, so the live test adds no marker change.No test is written before the manifest lands. Once #4003 merges, this item can add
tests/roadmap/test_roadmap_run_job.pyand run the offline tests. The live test stays a person step with a cluster.devops-cli-service commentedon Nov 15, 2026
Status set to Ready at 46c62f3 (see proposed design in issue body).