diff --git a/src/job_research/storage.py b/src/job_research/storage.py index 9e06d9a..17d0c50 100644 --- a/src/job_research/storage.py +++ b/src/job_research/storage.py @@ -21,3 +21,13 @@ def load_yaml(path: Path) -> dict[str, Any]: raise ValueError("candidate-profile YAML root must be a mapping") return dict(payload) + + +def apec_run_paths(data_root: Path, run_id: str) -> dict[str, Path]: + run_dir = data_root / "apec" / "runs" / run_id + return { + "run_dir": run_dir, + "listings": run_dir / "listings.yaml", + "run_meta": run_dir / "run-meta.yaml", + "snapshots": run_dir / "snapshots", + } diff --git a/tests/test_apec_storage.py b/tests/test_apec_storage.py index 31e1dd6..22e4c3f 100644 --- a/tests/test_apec_storage.py +++ b/tests/test_apec_storage.py @@ -1,4 +1,7 @@ +from pathlib import Path + from job_research.models import ApecListing, ApecRunMeta, ListingWarning +from job_research.storage import apec_run_paths def test_apec_models_serialize_expected_listing_shape() -> None: @@ -32,3 +35,13 @@ def test_apec_models_serialize_expected_listing_shape() -> None: assert listing.model_dump()["source"] == "apec" assert listing.model_dump()["warnings"][0]["field"] == "location" assert run_meta.model_dump()["derived_queries"] == ["Data Engineer"] + + +def test_apec_run_paths_builds_expected_layout(tmp_path: Path) -> None: + paths = apec_run_paths(tmp_path, run_id="2026-06-01T10-00-00Z") + run_dir = tmp_path / "apec" / "runs" / "2026-06-01T10-00-00Z" + + assert paths["run_dir"] == run_dir + assert paths["listings"] == run_dir / "listings.yaml" + assert paths["run_meta"] == run_dir / "run-meta.yaml" + assert paths["snapshots"] == run_dir / "snapshots"