plan: hardcoded policy migration engine#663
Open
github-actions[bot] wants to merge 1 commit into
Open
Conversation
Create comprehensive implementation plan for migrating hardcoded policy values across scripts into a centralized, validated policy configuration system. Key components: - Extend config/policy.schema.json with adaptive sections (timeout, model_selection, daemon) - Centralize 25+ hardcoded values in config/policy.json - Implement policy_get_with_precedence() with 4-level fallback chain: 1. ~/.shipwright/learned-policy.json (runtime-learned optimizations) 2. ~/.shipwright/policy.json (user customizations) 3. config/policy.json (repo defaults) 4. hardcoded defaults (final safety fallback) - Refactor scripts/lib/adaptive-timeout.sh, adaptive-model.sh, daemon-state.sh - Create sw-policy-migration-test.sh with 15+ test cases - Document precedence chain and learned policy format in docs/config-policy.md Failure mode analysis covers 7 critical risks: - jq command failures with fallback handling - Race conditions in learned-policy.json rewriting (atomic writes) - Invalid learned policy injection (schema validation) - Missing config directory graceful degradation - Precedence chain ambiguity (audit logging + policy_debug command) - Performance regression mitigation (in-memory caching) - Circular dependency and file lock prevention Task decomposition: 14 tasks across 5 phases - Phase 1: Schema & Configuration (Tasks 1-3) - Phase 2: Policy Resolution Engine (Tasks 4-5) - Phase 3: Script Migration (Tasks 6-8) - Phase 4: Testing & Validation (Tasks 9-11) - Phase 5: Documentation & Cleanup (Tasks 12-14) Definition of Done covers functional requirements, script migration, testing, documentation, code quality, and evidence verification. This approach minimizes risk through backward compatibility, incremental adoption, and comprehensive fallback behavior while enabling runtime policy optimization via adaptive overrides. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Comprehensive implementation plan for migrating hardcoded policy values into a centralized, validated policy configuration system with adaptive override framework.
Key Points
What Gets Migrated
Risk Mitigation Highlights
Files Created
.claude/IMPLEMENTATION_PLAN.md— Complete 200+ line detailed plan with code examplesNext Steps
🤖 Generated with Claude Code