fix(mqtt): resolve B-9 by implementing lazy get_logs_dir() evaluation

- Replace import-time LOGS_DIR cwd binding with dynamic get_logs_dir() function
- Implement PEP 562 __getattr__ and __dir__ for transparent LOGS_DIR backward compatibility
- Update audit-log callers in mqtt_common.py and registry.py to use dynamic resolution
- Add 5 regression guards in tests/test_tier1_unit.py (276/276 PASS)
- Update IMPROVEMENTS.md, VERSIONS.md, registry.md, and include plan and peer review reports
This commit is contained in:
2026-08-17 13:37:51 +09:00
parent 8cee9374b1
commit ac82f9b993
8 changed files with 671 additions and 22 deletions
@@ -165,7 +165,9 @@ even after the registry dir is cleaned up. It is git-ignored.
| event received | `received` | `job_subscriber.py` |
Helpers live in [`./scripts/mqtt_common.py`](./scripts/mqtt_common.py):
`LOGS_DIR`, `job_log_path`, `init_job_log`, `append_event` (fcntl-locked,
`get_logs_dir` (audit-log root, resolved per call — a chdir after import no
longer strands the trail; `LOGS_DIR` remains as a dynamic compat alias),
`job_log_path`, `init_job_log`, `append_event` (fcntl-locked,
concurrent-append safe), `update_logged_status`, and the readers
`read_logged_meta` / `read_logged_status` / `iter_logged_events` /
`list_logged_jobs`. Every writer is **best-effort and isolated** — wrapped in