UAT: CorrectionService.analyze_impact uses synthetic placeholder file paths instead of real artifact tracking #3830

Open
opened 2026-04-06 06:49:29 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/backlog-correction-impact-synthetic-files
  • Commit Message: fix(correction): replace synthetic file paths with real artifact tracking in CorrectionService.analyze_impact
  • Milestone: (backlog — no milestone)
  • Parent Epic: #397

Background and Context

CorrectionService.analyze_impact() in src/cleveragents/application/services/correction_service.py computes the impact of a correction by traversing the decision tree. However, the affected_files and artifacts_to_archive fields in the returned CorrectionImpact are populated with synthetic placeholder values derived from decision IDs rather than real file paths.

Current Behavior

In correction_service.py (lines ~330-345), the impact analysis builds:

impact = CorrectionImpact(
    affected_decisions=affected,
    # TODO: affected_files and artifacts_to_archive use synthetic
    # placeholders derived from decision IDs.  Replace with real
    # file / artifact tracking once the resource-rollback layer
    # is integrated (see spec § Mid-Execute Correction).
    affected_files=[f"{d}.py" for d in affected],
    affected_child_plans=[],
    ...
    artifacts_to_archive=artifacts,  # artifacts = [f"{d}.artifact" for d in affected]
)

The affected_files list contains strings like "01HXM8C2ZK4Q7C2B3F2R4VYV6J.py" (decision ID + .py extension) and artifacts_to_archive contains strings like "01HXM8C2ZK4Q7C2B3F2R4VYV6J.artifact". These are not real file paths.

Expected Behavior (from spec)

Per the specification (§ Affected Subtree Computation and § Mid-Execute Correction):

  • affected_files should contain the actual file paths that were modified by the affected decisions (derived from Decision.artifacts_producedArtifactRef.artifact_path)
  • artifacts_to_archive should contain the actual artifact paths from Decision.artifacts_produced that need to be archived during a revert
  • affected_child_plans should be populated from Decision.downstream_plan_ids for affected decisions

Impact

This causes:

  1. The dry-run report (CorrectionDryRunReport) to show meaningless file paths to users
  2. The CorrectionResult.archived_artifacts to contain fake paths after revert execution
  3. The agents plan correct --dry-run output to be misleading

Code Location

  • src/cleveragents/application/services/correction_service.pyanalyze_impact() method, lines ~310-350
  • The TODO comment explicitly acknowledges this: # TODO: affected_files and artifacts_to_archive use synthetic placeholders
  • src/cleveragents/domain/models/core/decision.pyDecision.artifacts_produced: list[ArtifactRef] and Decision.downstream_plan_ids: list[str] contain the real data

Subtasks

  • Pass decisions: dict[str, Decision] parameter to analyze_impact() (similar to how execute_revert already accepts it)
  • Derive affected_files from decision.artifacts_produced[*].artifact_path for all affected decisions
  • Derive artifacts_to_archive from the same source
  • Derive affected_child_plans from decision.downstream_plan_ids for affected decisions
  • Update generate_dry_run_report() to pass decisions through
  • Update Behave BDD tests to verify real file paths appear in impact analysis

Definition of Done

  • CorrectionImpact.affected_files contains real artifact paths from Decision.artifacts_produced
  • CorrectionImpact.artifacts_to_archive contains real artifact paths
  • CorrectionImpact.affected_child_plans contains real child plan IDs from Decision.downstream_plan_ids
  • No synthetic <decision_id>.py or <decision_id>.artifact placeholders in production output
  • Behave unit tests verify real file paths in impact analysis
  • nox -e unit_tests passes
  • nox -e typecheck passes

Backlog note: This issue was discovered during autonomous operation
on milestone (active). It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/backlog-correction-impact-synthetic-files` - **Commit Message**: `fix(correction): replace synthetic file paths with real artifact tracking in CorrectionService.analyze_impact` - **Milestone**: *(backlog — no milestone)* - **Parent Epic**: #397 ## Background and Context `CorrectionService.analyze_impact()` in `src/cleveragents/application/services/correction_service.py` computes the impact of a correction by traversing the decision tree. However, the `affected_files` and `artifacts_to_archive` fields in the returned `CorrectionImpact` are populated with synthetic placeholder values derived from decision IDs rather than real file paths. ## Current Behavior In `correction_service.py` (lines ~330-345), the impact analysis builds: ```python impact = CorrectionImpact( affected_decisions=affected, # TODO: affected_files and artifacts_to_archive use synthetic # placeholders derived from decision IDs. Replace with real # file / artifact tracking once the resource-rollback layer # is integrated (see spec § Mid-Execute Correction). affected_files=[f"{d}.py" for d in affected], affected_child_plans=[], ... artifacts_to_archive=artifacts, # artifacts = [f"{d}.artifact" for d in affected] ) ``` The `affected_files` list contains strings like `"01HXM8C2ZK4Q7C2B3F2R4VYV6J.py"` (decision ID + `.py` extension) and `artifacts_to_archive` contains strings like `"01HXM8C2ZK4Q7C2B3F2R4VYV6J.artifact"`. These are not real file paths. ## Expected Behavior (from spec) Per the specification (§ Affected Subtree Computation and § Mid-Execute Correction): - `affected_files` should contain the actual file paths that were modified by the affected decisions (derived from `Decision.artifacts_produced` → `ArtifactRef.artifact_path`) - `artifacts_to_archive` should contain the actual artifact paths from `Decision.artifacts_produced` that need to be archived during a revert - `affected_child_plans` should be populated from `Decision.downstream_plan_ids` for affected decisions ## Impact This causes: 1. The dry-run report (`CorrectionDryRunReport`) to show meaningless file paths to users 2. The `CorrectionResult.archived_artifacts` to contain fake paths after revert execution 3. The `agents plan correct --dry-run` output to be misleading ## Code Location - `src/cleveragents/application/services/correction_service.py` — `analyze_impact()` method, lines ~310-350 - The TODO comment explicitly acknowledges this: `# TODO: affected_files and artifacts_to_archive use synthetic placeholders` - `src/cleveragents/domain/models/core/decision.py` — `Decision.artifacts_produced: list[ArtifactRef]` and `Decision.downstream_plan_ids: list[str]` contain the real data ## Subtasks - [ ] Pass `decisions: dict[str, Decision]` parameter to `analyze_impact()` (similar to how `execute_revert` already accepts it) - [ ] Derive `affected_files` from `decision.artifacts_produced[*].artifact_path` for all affected decisions - [ ] Derive `artifacts_to_archive` from the same source - [ ] Derive `affected_child_plans` from `decision.downstream_plan_ids` for affected decisions - [ ] Update `generate_dry_run_report()` to pass decisions through - [ ] Update Behave BDD tests to verify real file paths appear in impact analysis ## Definition of Done - [ ] `CorrectionImpact.affected_files` contains real artifact paths from `Decision.artifacts_produced` - [ ] `CorrectionImpact.artifacts_to_archive` contains real artifact paths - [ ] `CorrectionImpact.affected_child_plans` contains real child plan IDs from `Decision.downstream_plan_ids` - [ ] No synthetic `<decision_id>.py` or `<decision_id>.artifact` placeholders in production output - [ ] Behave unit tests verify real file paths in impact analysis - [ ] `nox -e unit_tests` passes - [ ] `nox -e typecheck` passes > **Backlog note:** This issue was discovered during autonomous operation > on milestone (active). It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#397 Epic: Server & Autonomy Infrastructure
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3830
No description provided.