refactor(pipelock): take stage_dir, derive yaml_path internally
PipelockProxy.prepare now accepts (bottle, slug, stage_dir) and derives the yaml_path itself, so callers don't need to know the filename. DockerBottleBackend.prepare_proxy becomes a one-line wrapper whose only caller already has bottle and slug in scope, so it's inlined and deleted.
This commit is contained in:
@@ -68,8 +68,7 @@ class TestPipelockSidecarSmoke(unittest.TestCase):
|
||||
def test_prepare_and_start_yield_healthy_sidecar(self):
|
||||
proxy = DockerPipelockProxy()
|
||||
|
||||
yaml_path = self.work_dir / "pipelock.yaml"
|
||||
prep = proxy.prepare(fixture_minimal().bottles["dev"], self.slug, yaml_path)
|
||||
prep = proxy.prepare(fixture_minimal().bottles["dev"], self.slug, self.work_dir)
|
||||
|
||||
self.internal_net = network_create_internal(self.slug)
|
||||
self.egress_net = network_create_egress(self.slug)
|
||||
|
||||
@@ -66,11 +66,10 @@ class TestRenderAndWrite(unittest.TestCase):
|
||||
self.assertIn(required, text)
|
||||
|
||||
def test_prepare_writes_file_at_mode_600(self):
|
||||
yaml_path = self.out_dir / "min.yaml"
|
||||
DockerPipelockProxy().prepare(
|
||||
fixture_minimal().bottles["dev"], "demo", yaml_path
|
||||
plan = DockerPipelockProxy().prepare(
|
||||
fixture_minimal().bottles["dev"], "demo", self.out_dir
|
||||
)
|
||||
self.assertEqual(0o600, os.stat(yaml_path).st_mode & 0o777)
|
||||
self.assertEqual(0o600, os.stat(plan.yaml_path).st_mode & 0o777)
|
||||
|
||||
def test_prepare_does_not_leak_env_names_or_values(self):
|
||||
manifest = Manifest.from_json_obj({
|
||||
@@ -85,9 +84,10 @@ class TestRenderAndWrite(unittest.TestCase):
|
||||
},
|
||||
"agents": {"demo": {"skills": [], "prompt": "", "bottle": "dev"}},
|
||||
})
|
||||
yaml_path = self.out_dir / "secret.yaml"
|
||||
DockerPipelockProxy().prepare(manifest.bottles["dev"], "demo", yaml_path)
|
||||
content = yaml_path.read_text()
|
||||
plan = DockerPipelockProxy().prepare(
|
||||
manifest.bottles["dev"], "demo", self.out_dir
|
||||
)
|
||||
content = plan.yaml_path.read_text()
|
||||
self.assertNotIn("literal-value-should-not-appear", content)
|
||||
self.assertNotIn("MY_SECRET", content)
|
||||
self.assertNotIn("prompt-message", content)
|
||||
|
||||
Reference in New Issue
Block a user