| from __future__ import annotations |
|
|
| from pathlib import Path |
|
|
| from scripts import audit_action_bounds |
| from scripts import audit_chart_feature_sources |
| from scripts import audit_cil_charts |
| from scripts import build_action_scale_vector |
| from scripts import build_data_accounting |
| from scripts import calibrate_dominance |
| from scripts import check_tangent_reconstruction |
| from scripts import eval_chart_positive_memory_proxy |
| from scripts import export_chart_object_embeddings |
| from scripts import export_chart_observation_embeddings |
| from scripts import train_utility_energy |
|
|
|
|
| def test_readme_only_report_helpers_remove_stale_markdown(tmp_path: Path) -> None: |
| writers = [ |
| lambda out: build_data_accounting._write_markdown_report( |
| out, |
| {}, |
| no_markdown_report=True, |
| ), |
| lambda out: audit_cil_charts._write_markdown_report(out, {}, no_markdown_report=True), |
| lambda out: check_tangent_reconstruction._write_markdown_report( |
| out, |
| {}, |
| no_markdown_report=True, |
| ), |
| lambda out: audit_chart_feature_sources._write_markdown_report( |
| out, |
| {}, |
| no_markdown_report=True, |
| ), |
| lambda out: audit_action_bounds._write_markdown_report( |
| out, |
| {}, |
| no_markdown_report=True, |
| ), |
| lambda out: export_chart_observation_embeddings._write_markdown_report( |
| out, |
| {}, |
| no_markdown_report=True, |
| ), |
| lambda out: export_chart_object_embeddings._write_markdown_report( |
| out, |
| {}, |
| no_markdown_report=True, |
| ), |
| lambda out: eval_chart_positive_memory_proxy._write_markdown_report( |
| out, |
| "local_atlas", |
| 1, |
| {}, |
| no_markdown_report=True, |
| ), |
| lambda out: build_action_scale_vector._write_markdown_report( |
| out, |
| {}, |
| no_markdown_report=True, |
| ), |
| lambda out: calibrate_dominance._write_markdown_report( |
| out, |
| {}, |
| no_markdown_report=True, |
| ), |
| lambda out: train_utility_energy._write_markdown_report( |
| out, |
| {}, |
| no_markdown_report=True, |
| ), |
| ] |
| for index, writer in enumerate(writers): |
| out_dir = tmp_path / f"run_{index}" |
| out_dir.mkdir() |
| report_path = out_dir / "report.md" |
| report_path.write_text("stale\n") |
|
|
| writer(out_dir) |
|
|
| assert not report_path.exists() |
|
|
|
|
| def test_hf_sync_enforces_remote_readme_only_markdown_policy() -> None: |
| script = Path("scripts/hf_push_once.sh").read_text() |
|
|
| assert "HF_SYNC_CLEAN_REMOTE_MARKDOWN=\"${HF_SYNC_CLEAN_REMOTE_MARKDOWN:-1}\"" in script |
| assert "HF_SYNC_REMOTE_MARKDOWN_KEEP=\"${HF_SYNC_REMOTE_MARKDOWN_KEEP:-workspace/README.md}\"" in script |
| assert "cleanup_remote_markdown" in script |
| assert 'path.endswith(".md") and path not in keep' in script |
| assert "api.delete_files" in script |
|
|