Skip to content

fix(delete): include goals in referenced_by and cascade_plan - #731

Open
kurosawareiji7007-hub wants to merge 3 commits into
vouchdev:testfrom
kurosawareiji7007-hub:fix/delete-gate-include-goals
Open

fix(delete): include goals in referenced_by and cascade_plan#731
kurosawareiji7007-hub wants to merge 3 commits into
vouchdev:testfrom
kurosawareiji7007-hub:fix/delete-gate-include-goals

Conversation

@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor

Summary

  • referenced_by / cascade_plan walked pages, claims, and relations but never goals, even though Goal.claims / Goal.entities are validated refs.
  • Deleting a cited claim succeeded with an empty gate; later set_goal_status crashed via _validate_goal_refs.
  • Goals now block delete, appear in the cascade plan, and are unlinked on cascade approve (goal.cascade_unlink).

Fixes #727

Test plan

  • uv run pytest tests/test_delete.py tests/test_cascade_delete.py -q
  • CI green

Goals cite claims/entities but the delete gate never walked list_goals,
so deleting a cited claim left dangling refs that crashed set_goal_status.
Block delete when a goal cites the target, plan goal unlinks for cascade,
and apply them via goal.cascade_unlink.

Fixes vouchdev#727
@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance storage kb storage, migrations, schemas, and proposals tests tests and fixtures size: S 50-199 changed non-doc lines labels Jul 31, 2026
test_only_lifecycle_mutates_a_stored_goal forbids proposals calling
update_goal. Move cascade claim/entity unlinks into
lifecycle.cascade_unlink_goal_refs so the single-writer + audit invariant holds.

Fixes vouchdev#727
hit entity->goal cascade_plan, ArtifactNotFoundError and no-op unlink
paths in lifecycle.cascade_unlink_goal_refs so diff-coverage stays 100%.
@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor Author

Maintainer note: this is a correctness bugfix. If it looks right, a bug label would help Gittensor scoring (vouch bug multiplier). Happy to address any review feedback quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs documentation, specs, examples, and repo guidance size: S 50-199 changed non-doc lines storage kb storage, migrations, schemas, and proposals tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(delete): referenced_by/cascade_plan omit goals citing the target

1 participant