fix(logs): resolve old prod execution issues + full GRACE-Poly compliance

- translate: pure-skip scheduled runs now COMPLETE (not FAILED); extract _compute_final_status
- scheduler: cron validation at update; pre-validate + skip legacy bad expr (/15*) in load
- git: robust get_branch_commits (existence check for 'prod' to avoid fatal)
- health: use explore for network/auth failures (reduces spam)
- Full semantic protocol updates across modules:
  - complete #region/#endregion + @BRIEF/@PRE/@POST/@INVARIANT/@RELATION/@RATIONALE
  - belief_scope + CoT markers (reason/explore/reflect)
  - semantics-testing compliance in tests
- Addresses exact symptoms from container_backend.log and backend/logs/app.*

Related to 039-dashboard-scenario-ui log analysis.
This commit is contained in:
2026-07-10 12:35:07 +03:00
parent 3404967f76
commit b39d9991b9
10 changed files with 405 additions and 49 deletions

View File

@@ -213,6 +213,25 @@ def test_load_schedules_backup_jobs(service, mock_scheduler, mock_config_manager
mock_add.assert_called_once_with("env-1", "0 2 * * *")
# #endregion test_load_schedules_backup_jobs
# #region test_load_schedules_skips_invalid_backup_cron [C:2] [TYPE Function]
# @BRIEF load_schedules skips backup jobs with invalid cron (e.g. legacy "/15*" from old prod) and logs explore.
# @TEST_EDGE invalid_backup_cron -> skip with clear message, no "Failed to add" spam
def test_load_schedules_skips_invalid_backup_cron(service, mock_scheduler, mock_config_manager):
env_bad = _build_env("ss-dev", "/15*", enabled=True)
cm = _build_config_manager(environments=[env_bad])
service.config_manager = cm
with patch("src.core.scheduler.belief_scope") as mock_bs:
mock_bs.return_value.__enter__ = MagicMock()
mock_bs.return_value.__exit__ = MagicMock(return_value=False)
with patch("src.core.scheduler.CronTrigger") as mock_trigger:
mock_trigger.from_crontab.side_effect = ValueError("Unrecognized expression")
service.load_schedules()
# Should not attempt to add the bad job
mock_scheduler.add_job.assert_not_called()
# #endregion test_load_schedules_skips_invalid_backup_cron
# #region test_load_schedules_translation_exception [C:2] [TYPE Function]
# @BRIEF load_schedules catches exception when loading translation schedules (lines 93-94).
def test_load_schedules_translation_exception(service, mock_config_manager):