feat: AI advisor integration and architecture improvements#30
Conversation
- Remove stale code examples that duplicated source - Fix RolloutStrategy trait signature (now takes DateTime<Utc>) - Update Context struct with trait-based DI fields - Document mock constructors and test helpers - Cut from 360 to ~105 lines, keeping all actionable info Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace ~140 lines of hand-rolled occurrence structs with the canonical false-protocol crate, gaining spec compliance (entities under context, DateTime<Utc> timestamps, protocol_version field) and a single source of truth. Adapt build_occurrence() to use the crate's builder API and return Option<Occurrence> for graceful fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the FALSE Protocol occurrence handling in KULTA by replacing ~140 lines of hand-rolled structs with the canonical false-protocol crate, bringing spec compliance and a single source of truth. The changes also include documentation updates to CLAUDE.md and minor code formatting improvements across test files.
Changes:
- Replaced inline FALSE Protocol type definitions with
false-protocolcrate dependency - Refactored
build_occurrence()to use the crate's builder pattern and constructors - Updated CLAUDE.md to be more concise and reflect current architecture
- Applied
cargo fmtformatting across test files (rollout_test.rs, prometheus_ab.rs, cdevents_test.rs)
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Added false-protocol crate as a path dependency, removed ulid direct dependency |
| Cargo.lock | Added false-protocol package entry with its transitive dependencies |
| src/controller/occurrence.rs | Major refactor: removed ~110 lines of struct definitions, updated to use false-protocol types and builder methods |
| src/controller/rollout_test.rs | Formatting improvements: reformatted long function calls to fit line length conventions |
| src/controller/prometheus_ab.rs | Formatting improvements: reformatted function calls for readability |
| src/controller/cdevents_test.rs | Formatting improvements: reformatted assertion chains |
| CLAUDE.md | Rewrote from verbose learning guide to concise reference documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # FALSE Protocol (ULID generation for occurrence IDs) | ||
| ulid = "1" | ||
| # FALSE Protocol occurrence types | ||
| false-protocol = { path = "../false-protocol/rust" } |
There was a problem hiding this comment.
The false-protocol dependency uses a relative path (../false-protocol/rust), which makes the project unbuildable unless the false-protocol crate is available at that specific relative location. This creates tight coupling and makes it difficult for others to build, test, or contribute to this project.
Consider one of these alternatives:
- Publish the
false-protocolcrate to crates.io and reference it by version - Use a git dependency with a repository URL if the crate is in a separate repo
- Move the
false-protocolcode into a workspace if both crates are meant to be maintained together - Document the repository structure requirements clearly in the README if the relative path is intentional for development
Address review comment about path dependency by documenting the required repository layout in the getting started instructions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduce a 4-level AI adoption ladder (Off → Context → Advised → Planned → Driven) that lets operators progressively opt into AI-assisted rollout decisions. Level 0 preserves current behavior. Level 1 enriches FALSE Protocol events with step/weight/traffic context. Level 2 consults an external advisor service but lets thresholds decide. - Add AdvisorLevel, AdvisorConfig, Recommendation, DecisionSource types - Create AnalysisAdvisor trait (NoOpAdvisor, HttpAdvisor, MockAdvisor) - Wire advisor into reconcile Context and analysis step - Enrich failure occurrences with rich what_failed/possible_causes - Add advisor.recommendation occurrence type for Level 2+ - Regenerate CRD schema with advisor fields Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Test plan
cargo test)cargo fmtcleanadvisor.level: Contextand verify enriched occurrencesadvisor.level: Advisedand verify advisor consultation logs🤖 Generated with Claude Code