Follow-up from review of #52.
In src/climatevision/governance/datasheet.py:
_PROJECT_ROOT = Path(__file__).resolve().parents[4]
_DEFAULT_OUTPUT_DIR = _PROJECT_ROOT / "outputs" / "datasheets"
The file lives at src/climatevision/governance/datasheet.py. Walking parents:
[0] = governance
[1] = climatevision
[2] = src
[3] = repo root
[4] = parent of repo root
So _DEFAULT_OUTPUT_DIR lands outside the repo. Should be parents[3].
The existing tests don't catch this because every test passes an explicit tmp_path for output_dir, so the default path is never exercised.
Acceptance criteria:
- Fix the index in
datasheet.py.
- Add a unit test that calls
write_datasheet(sheet) with no output_dir and asserts the resulting path is inside the repo (e.g. under <repo>/outputs/datasheets/). Use monkeypatch on _DEFAULT_OUTPUT_DIR or assert relative-to-repo-root rather than touching the real outputs/ dir.
- Audit
scripts/generate_datasheet.py for the same pattern just in case.
Nice-to-haves (optional, can be split out):
scripts/generate_datasheet.py defines logger but only uses print — wire one or the other.
_coerce_config could give a friendlier error if the manifest path doesn't exist.
- Confirm the rendered-markdown output for nested dicts (currently embedded as a JSON code fence) is the intended format.
Follow-up from review of #52.
In
src/climatevision/governance/datasheet.py:The file lives at
src/climatevision/governance/datasheet.py. Walking parents:[0]=governance[1]=climatevision[2]=src[3]= repo root[4]= parent of repo rootSo
_DEFAULT_OUTPUT_DIRlands outside the repo. Should beparents[3].The existing tests don't catch this because every test passes an explicit
tmp_pathforoutput_dir, so the default path is never exercised.Acceptance criteria:
datasheet.py.write_datasheet(sheet)with nooutput_dirand asserts the resulting path is inside the repo (e.g. under<repo>/outputs/datasheets/). Usemonkeypatchon_DEFAULT_OUTPUT_DIRor assert relative-to-repo-root rather than touching the realoutputs/dir.scripts/generate_datasheet.pyfor the same pattern just in case.Nice-to-haves (optional, can be split out):
scripts/generate_datasheet.pydefinesloggerbut only usesprint— wire one or the other._coerce_configcould give a friendlier error if the manifest path doesn't exist.