fix: evolved strategy syntax guard (#321) #333

Merged
jihoson merged 1 commits from feature/issue-321-evolution-syntax-guard into feature/v3-session-policy-stream 2026-02-28 17:06:04 +09:00
Collaborator

Summary

  • Add AST/compile syntax validation before saving generated evolved strategies
  • Normalize generated body indentation to avoid false syntax failures
  • Add tests for valid code save and invalid code block behavior

Validation

  • pytest -q tests/test_evolution.py -k "generate_strategy"
## Summary - Add AST/compile syntax validation before saving generated evolved strategies - Normalize generated body indentation to avoid false syntax failures - Add tests for valid code save and invalid code block behavior ## Validation - pytest -q tests/test_evolution.py -k "generate_strategy"
agentson added 1 commit 2026-02-28 14:35:43 +09:00
fix: add syntax guard for evolved strategy generation (#321)
Some checks are pending
Gitea CI / test (push) Waiting to run
Gitea CI / test (pull_request) Waiting to run
2f3b2149d5
Author
Collaborator

Ticket Maturity Update (2026-02-28)

  • Implemented: done
  • Integrated: done
  • Observed: done (targeted test commands executed and passing)
  • Accepted: pending (reviewer + runtime verifier approval required)

Coverage Matrix:

Stage Status
Implemented PASS
Integrated PASS
Observed PASS
Accepted NOT_OBSERVED
## Ticket Maturity Update (2026-02-28) - Implemented: done - Integrated: done - Observed: done (targeted test commands executed and passing) - Accepted: pending (reviewer + runtime verifier approval required) Coverage Matrix: | Stage | Status | | --- | --- | | Implemented | PASS | | Integrated | PASS | | Observed | PASS | | Accepted | NOT_OBSERVED |
agentson reviewed 2026-02-28 16:14:52 +09:00
agentson left a comment
Author
Collaborator

Review: PR #333 — fix: evolved strategy syntax guard (#321)

플랜 일치: ACT-04 정확히 일치

코드 품질: 우수

  • STRATEGY_TEMPLATE 들여쓰기 정규화: 기존 nested indent 문제의 근본 원인 수정
  • body 정규화: textwrap.dedent(body).strip() + textwrap.indent() — false positive 방지
  • 검증 위치: file_path.write_text() 직전 → 디스크에 잘못된 코드 미저장
  • 실패 시 None 반환 → 기존 전략 유지

테스트: 충분

  • 유효 코드 저장 테스트
  • 무효 코드 차단 + caplog 검증

결론: LGTM

## Review: PR #333 — fix: evolved strategy syntax guard (#321) ### 플랜 일치: ✅ ACT-04 정확히 일치 ### 코드 품질: ✅ 우수 - STRATEGY_TEMPLATE 들여쓰기 정규화: 기존 nested indent 문제의 근본 원인 수정 - body 정규화: `textwrap.dedent(body).strip()` + `textwrap.indent()` — false positive 방지 - 검증 위치: `file_path.write_text()` 직전 → 디스크에 잘못된 코드 미저장 - 실패 시 `None` 반환 → 기존 전략 유지 ### 테스트: ✅ 충분 - 유효 코드 저장 테스트 - 무효 코드 차단 + caplog 검증 ### 결론: **LGTM** ✅
jihoson merged commit 28ded34441 into feature/v3-session-policy-stream 2026-02-28 17:06:04 +09:00
jihoson deleted branch feature/issue-321-evolution-syntax-guard 2026-02-28 17:06:04 +09:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#333