Commit ce726bf1 ce726bf1f8f26a8fd504d4819a60d72861ac6347 by cnb.bofCdSsphPA

Persist the repo status snapshot for faster resumability

Constraint: Future sessions benefit from a saved machine-readable snapshot, not just on-demand script output
Rejected: Keep snapshot stdout-only | Makes handoff less durable and harder to automate across sessions
Confidence: high
Scope-risk: narrow
Directive: Refresh .omx/latest_status_snapshot.json whenever the default docs, smoke paths, or next-step commands materially change
Tested: /usr/local/miniconda3/bin/python scripts/status_snapshot.py --output .omx/latest_status_snapshot.json; JSON parse check for latest_commit and next_commands
Not-tested: External automation consuming the saved snapshot over multiple sessions
1 parent 15c1aa6b
......@@ -10,7 +10,7 @@ Use this checklist when a new session starts working on the repo.
## 2. Verify repo health
```bash
git status --short
/usr/local/miniconda3/bin/python scripts/status_snapshot.py
/usr/local/miniconda3/bin/python scripts/status_snapshot.py --output .omx/latest_status_snapshot.json
```
## 3. Verify open-dataset tooling
......
#!/usr/bin/env python3
import argparse
import json
import subprocess
from pathlib import Path
......@@ -9,7 +10,8 @@ workspace_root = root.parent
def sh(cmd):
return subprocess.check_output(cmd, shell=True, text=True).strip()
snapshot = {
def build_snapshot():
return {
'latest_commit': sh('git log --oneline -n 1'),
'docs': {
'readme': str((workspace_root / 'docs/README.md').resolve()),
......@@ -31,5 +33,22 @@ snapshot = {
'inspect_jamendo': '/usr/local/miniconda3/bin/python src/data/external_adapters.py inspect-local mtg_jamendo data/raw/mtg_jamendo_audio --eval-ratio 0.2 --query-duration 8.0',
'smoke_jamendo': '/usr/local/miniconda3/bin/python src/data/external_adapters.py smoke-local mtg_jamendo data/raw/mtg_jamendo_audio --output-root data/external_smoke --eval-ratio 0.2 --query-duration 8.0 --train-epochs 1 --batch-size 2'
}
}
print(json.dumps(snapshot, ensure_ascii=False, indent=2))
}
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--output', default=None)
args = parser.parse_args()
snapshot = build_snapshot()
text = json.dumps(snapshot, ensure_ascii=False, indent=2)
if args.output:
out = Path(args.output)
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(text)
print(text)
if __name__ == '__main__':
main()
......
......@@ -202,6 +202,25 @@
- 新 session 现在不只靠静态文档,也可以直接读取当前仓库状态快照
- 持续开发交接更稳
### Stage: 状态快照落盘
完成项:
- 扩展 [acr-engine/scripts/status_snapshot.py](../acr-engine/scripts/status_snapshot.py)
- 新增 `--output`
- 可直接写入 `.omx/latest_status_snapshot.json`
验证结果:
- `/usr/local/miniconda3/bin/python scripts/status_snapshot.py --output .omx/latest_status_snapshot.json` 成功
- 已验证:
- 文件存在
- JSON 可解析
- 包含 `latest_commit`
- 包含 `next_commands`
结论:
- 新 session 现在可以直接读取最近一次状态快照文件
- 交接信息更适合自动化和长期持续开发
### Stage: confused 定向优化 v6(sample-level weighting)
完成项:
......
......@@ -276,6 +276,7 @@
- [docs/session-handoff.md](./session-handoff.md)
- [acr-engine/FIRST_RUN_CHECKLIST.md](../acr-engine/FIRST_RUN_CHECKLIST.md)
- 运行 [acr-engine/scripts/status_snapshot.py](../acr-engine/scripts/status_snapshot.py)
- 或直接查看最新落盘快照:`acr-engine/.omx/latest_status_snapshot.json`
2. 检查真实数据是否已落位:
- `acr-engine/data/raw/fma_small_audio/`
......