fix(build): recover ConfigDumpInfo after failed Designer build - #47
fix(build): recover ConfigDumpInfo after failed Designer build#47korolevpavel wants to merge 10 commits into
Conversation
- keep isolated worktree directories out of version control
- define transactional snapshot and recovery boundaries\n- split successful reconcile into issue alkoleft#46
- define test-first recovery tasks\n- include verification and review gates
- snapshot tracked ConfigDumpInfo before Designer load\n- restore raw bytes without XML rewriting
- persist snapshots after failed restoration\n- use durable atomic CDFI replacement
- recover snapshots on load and update failure paths - retain platform output after successful update
- expose typed recovery status in build results - document failed-build source protection
- expose truthful typed recovery diagnostics on success and failure - preserve cleanup warnings and retained recovery artifacts - cover idempotent and absent-baseline recovery paths
|
Warning Review limit reached
Next review available in: 21 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughДобавлен механизм byte-exact snapshot и восстановления ChangesВосстановление CDFI
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant BuildProject
participant CdfiRecoveryGuard
participant Designer
participant BuildResult
participant CLIorMCP
BuildProject->>CdfiRecoveryGuard: capture ConfigDumpInfo.xml
BuildProject->>Designer: execute Designer load
Designer-->>BuildProject: build outcome
BuildProject->>CdfiRecoveryGuard: restore or cleanup
CdfiRecoveryGuard-->>BuildResult: cdfi_recovery summary
BuildResult-->>CLIorMCP: serialized recovery diagnostics
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
src/use_cases/build_project/cdfi_recovery.rs (1)
108-149: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low valueПовторный вызов
restore()после успешного восстановления вернёт ошибку.После
finalize_successful_restoresnapshot удалён, поэтому повторныйrestore()(если guard когда-нибудь переиспользуют) упадёт вrestore_snapshot_withна чтении снимка вместо возвратаNotNeeded. Сейчас вызывающий код делает это один раз, но защита от будущего рефакторинга дешёвая: помечать guard как «уже восстановлен» и сразу отдаватьNotNeeded.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/use_cases/build_project/cdfi_recovery.rs` around lines 108 - 149, Добавьте в состояние guard признак успешного восстановления и обновляйте его после завершения restore; в restore_with проверяйте этот признак до обращения к snapshot и возвращайте CdfiRecoverySummary с действием NotNeeded. Используйте существующие значения tracked_path, original_exists и changed_entry_count, чтобы повторный вызов restore() не пытался читать уже удалённый snapshot.src/use_cases/build_project.rs (1)
632-645: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy liftДиагностика восстановления хранится только для одного source-set.
BuildResult.cdfi_recovery— один слот, аretain_cdfi_recovery/merge_cdfi_recoveryв координаторе перезаписывают предыдущее значение (тестexecute_build_keeps_designer_cdfi_replacement_after_successful_updateявно ожидает summary дляext, а не дляmain). При сборке нескольких source-set сведения о предыдущих CDFI теряются, кроме склеенного cleanup-предупреждения. Если это осознанный компромисс — ок; иначе стоит перейти наVec<CdfiRecoverySummary>в контракте.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/use_cases/build_project.rs` around lines 632 - 645, Измените контракт результата сборки вокруг BuildStepOutcome и BuildResult::cdfi_recovery с одного Option<CdfiRecoverySummary> на Vec<CdfiRecoverySummary>, чтобы сохранять диагностику для каждого source-set. Обновите retain_cdfi_recovery и merge_cdfi_recovery в координаторе для добавления новых сведений вместо перезаписи предыдущих, сохранив существующее объединение cleanup-предупреждений.src/use_cases/build_project/coordinator.rs (1)
986-999: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
retain_cdfi_recoveryтеряет второе cleanup-предупреждение.Если у текущего summary уже есть
cleanup_warning, кандидат отбрасывается целиком — включая его собственныйcleanup_warningи удержанныйsnapshot_path.merge_cdfi_recoveryв такой ситуации предупреждения склеивает; логично переиспользовать её и на успешном пути.♻️ Возможный вариант
fn retain_cdfi_recovery( current: &mut Option<Box<CdfiRecoverySummary>>, candidate: Option<Box<CdfiRecoverySummary>>, ) { let Some(candidate) = candidate else { return; }; - if current - .as_ref() - .is_none_or(|summary| summary.cleanup_warning.is_none()) - { - *current = Some(candidate); - } + *current = merge_cdfi_recovery(current.take(), Some(candidate)); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/use_cases/build_project/coordinator.rs` around lines 986 - 999, Update retain_cdfi_recovery so a candidate is not discarded when the current summary already has cleanup_warning; merge both summaries through merge_cdfi_recovery, preserving the candidate’s cleanup warning and snapshot_path. Keep the existing replacement behavior when current is absent or has no cleanup warning, and retain the early return for a missing candidate.docs/superpowers/plans/2026-07-26-cdfi-rollback.md (1)
56-59: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
\nвgit commit -mне превратится в перевод строки.В двойных кавычках bash оставит
\nбуквально; используйте$'...'или несколько-m. То же в шагах Task 2 и Task 3.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/superpowers/plans/2026-07-26-cdfi-rollback.md` around lines 56 - 59, Исправьте команды git commit в текущем шаге и шагах Task 2 и Task 3: последовательность \n внутри двойных кавычек сейчас сохраняется буквально, а не становится переносом строки. Используйте несколько аргументов -m либо ANSI-C quoting через $'...', сохранив заданное содержимое сообщения коммита.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/cli_build.rs`:
- Around line 414-453: Update
build_json_failure_reports_successful_cdfi_recovery and its write_build_script
setup so the /LoadConfigFromFiles path mutates ConfigDumpInfo.xml before the
build fails, causing actual recovery. Change the cdfi_recovery assertion to
expect action "restored", while retaining the final byte-for-byte comparison
with original_cdfi.
---
Nitpick comments:
In `@docs/superpowers/plans/2026-07-26-cdfi-rollback.md`:
- Around line 56-59: Исправьте команды git commit в текущем шаге и шагах Task 2
и Task 3: последовательность \n внутри двойных кавычек сейчас сохраняется
буквально, а не становится переносом строки. Используйте несколько аргументов -m
либо ANSI-C quoting через $'...', сохранив заданное содержимое сообщения
коммита.
In `@src/use_cases/build_project.rs`:
- Around line 632-645: Измените контракт результата сборки вокруг
BuildStepOutcome и BuildResult::cdfi_recovery с одного
Option<CdfiRecoverySummary> на Vec<CdfiRecoverySummary>, чтобы сохранять
диагностику для каждого source-set. Обновите retain_cdfi_recovery и
merge_cdfi_recovery в координаторе для добавления новых сведений вместо
перезаписи предыдущих, сохранив существующее объединение cleanup-предупреждений.
In `@src/use_cases/build_project/cdfi_recovery.rs`:
- Around line 108-149: Добавьте в состояние guard признак успешного
восстановления и обновляйте его после завершения restore; в restore_with
проверяйте этот признак до обращения к snapshot и возвращайте
CdfiRecoverySummary с действием NotNeeded. Используйте существующие значения
tracked_path, original_exists и changed_entry_count, чтобы повторный вызов
restore() не пытался читать уже удалённый snapshot.
In `@src/use_cases/build_project/coordinator.rs`:
- Around line 986-999: Update retain_cdfi_recovery so a candidate is not
discarded when the current summary already has cleanup_warning; merge both
summaries through merge_cdfi_recovery, preserving the candidate’s cleanup
warning and snapshot_path. Keep the existing replacement behavior when current
is absent or has no cleanup warning, and retain the early return for a missing
candidate.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6ba8b1a0-360f-428a-a4d4-62178eb3abc9
📒 Files selected for processing (12)
.gitignoreSKILL/SKILL.mddocs/superpowers/plans/2026-07-26-cdfi-rollback.mddocs/superpowers/specs/2026-07-26-cdfi-rollback-design.mdsrc/cli/execute.rssrc/domain/build.rssrc/mcp/service.rssrc/use_cases/build_project.rssrc/use_cases/build_project/cdfi_recovery.rssrc/use_cases/build_project/coordinator.rssrc/use_cases/build_project/helpers.rstests/cli_build.rs
|
А точно надо восстановление? Может его вообще в игнор? я в юнике политику прописывал другую По факту с каждой базой в каждой соурстри у каждого разраба будет свое состояние файла |
Closes #24.
Verification:
Known baseline: two pre-existing compiler warnings and repository-wide strict-clippy debt remain outside this change.
Summary by CodeRabbit
Новые возможности
ConfigDumpInfo.xmlпосле сбоев или отмены Designer-сборки.Документация
Исправления
ConfigDumpInfo.xmlпосле неудачной сборки.