Skip to content

Fix dummy issue parent assignments#9207

Open
miachillgood wants to merge 1 commit into
makeplane:previewfrom
miachillgood:fix/dummy-parent-assignments
Open

Fix dummy issue parent assignments#9207
miachillgood wants to merge 1 commit into
makeplane:previewfrom
miachillgood:fix/dummy-parent-assignments

Conversation

@miachillgood
Copy link
Copy Markdown

@miachillgood miachillgood commented Jun 4, 2026

Summary

  • Add generated sub-issues to the bulk update list after assigning parent IDs
  • Add unit coverage for persisting dummy issue parent assignments

Fixes #9176

Tests

  • git diff --check origin/preview...fix/dummy-parent-assignments
  • python -m compileall -q apps/api/plane/bgtasks/dummy_data_task.py apps/api/plane/tests/unit/bg_tasks/test_dummy_data_task.py

Not run:

  • python -m pytest plane/tests/unit/bg_tasks/test_dummy_data_task.py (local environment is missing the project dependency celery)
  • python -m ruff check ... (local environment is missing ruff)

Summary by CodeRabbit

  • Bug Fixes

    • Improved background task for initializing sample data to ensure proper data relationships.
  • Tests

    • Added test coverage for sample data initialization functionality.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 4, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 94ed6950-3928-4942-9284-6b8b0aae62f8

📥 Commits

Reviewing files that changed from the base of the PR and between b6e47cc and f0f1c56.

📒 Files selected for processing (2)
  • apps/api/plane/bgtasks/dummy_data_task.py
  • apps/api/plane/tests/unit/bg_tasks/test_dummy_data_task.py

📝 Walkthrough

Walkthrough

This PR fixes a bug in create_issue_parent where sub-issue parent assignments were never saved. The function's loop modified sub-issue objects in memory but failed to append them to the bulk update list, causing the database update to operate on an empty collection. A single-line fix and comprehensive test now ensure parent-child relationships persist correctly.

Changes

Dummy Data Task Parent Assignment Fix

Layer / File(s) Summary
Parent assignment bulk update fix
apps/api/plane/bgtasks/dummy_data_task.py
The create_issue_parent function now appends each modified sub_issue to bulk_sub_issues inside the assignment loop, ensuring the subsequent bulk_update call persists the parent references instead of operating on an empty list.
Test coverage for parent assignment
apps/api/plane/tests/unit/bg_tasks/test_dummy_data_task.py
New TestCreateIssueParent test class validates that sub-issues receive bulk-updated parent fields. Monkeypatches Issue.objects to simulate manager behavior, patches random.randint for determinism, and asserts that all generated sub-issues are assigned the expected parent id.

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰 A fix so small, yet so mighty indeed,
One line in the loop was all that we need,
Now parents embrace their sub-issues with care,
In bulk update's list, they'll always be there! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix dummy issue parent assignments' clearly and concisely describes the main change—fixing a bug where parent assignments were not persisted in dummy data generation.
Description check ✅ Passed The description includes a clear summary of changes, fixes a linked issue, and describes tests attempted. However, it lacks details on the Type of Change and Screenshots sections from the template.
Linked Issues check ✅ Passed The PR fully addresses issue #9176: adds the missing bulk_sub_issues.append(sub_issue) in the loop and includes comprehensive unit test coverage for the fix.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the parent issue assignment bug and adding test coverage. No out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parent Issue Assignments Never Saved in Dummy Data — Missing append in Loop

2 participants