Skip to content

Link legacy unauthored tasks to a virtual "anonyme" user profile#39

Merged
Mike031289 merged 2 commits into
developfrom
task/anonymous-user-migration
Jul 8, 2026
Merged

Link legacy unauthored tasks to a virtual "anonyme" user profile#39
Mike031289 merged 2 commits into
developfrom
task/anonymous-user-migration

Conversation

@Mike031289

@Mike031289 Mike031289 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

This Pull Request introduces a data migration and schema hardening process for the Task entity, resolving the core structural issues of legacy unauthored tasks. To support global security ownership features and clean up legacy MVP records, all tasks without an explicit author are now safely associated with a default virtual user named anonyme.

Changes Made

1. Data Hardening (src/AppBundle/Entity/Task.php)

  • Switched the user_id column configuration from nullable=true to nullable=false to guarantee absolute data integrity at the database layer.
  • Removed legacy onDelete="SET NULL" database triggers to avoid integrity conflicts with the new strict NOT NULL constraint.

2. Maintenance Command (src/AppBundle/Command/LinkAnonymousTasksCommand.php)

  • Created a reusable Symfony CLI command (app:tasks:link-anonymous) that checks for (or initializes) the virtual anonyme account with a secure, randomized password.
  • It safely batches and migrates any remaining orphan tasks to this profile.

3. Fixtures Synchronization (src/AppBundle/DataFixtures/ORM/LoadData.php)

  • Refactored test fixtures to output zero null references, seeding the default anonyme user account as a parent reference for unauthored legacy data instead.

4. Tests Added (tests/AppBundle/Command/LinkAnonymousTasksCommandTest.php)

  • Added automated LinkAnonymousTasksCommandTest using Symfony's KernelTestCase and CommandTester to prevent command execution crashes during automated CI workflows.

How to Test / Review

  1. Checkout the branch:
    git checkout task/anonymous-user-migration

- Implement AppBundle:LinkAnonymousTasksCommand to bind orphan tasks to an 'anonyme' user
- Update Task entity mapping to enforce 'nullable=false' on the user relation
- Update LoadData fixtures to automatically assign the virtual anonymous account to legacy items
- Add LinkAnonymousTasksCommandTest to secure the CLI execution behavior
@Mike031289 Mike031289 self-assigned this Jul 8, 2026
@Mike031289 Mike031289 added the bug Something isn't working label Jul 8, 2026
@Mike031289 Mike031289 added enhancement New feature or request feature Extra attention is needed security labels Jul 8, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity · 0 duplication

Metric Results
Complexity 5
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

- Implement LinkAnonymousTasksCommandTest under tests/AppBundle/Command/
- Properly boot Symfony 3.4 Kernel using self:: reference
- Add assertions to ensure command completion outputs expected success status
@Mike031289
Mike031289 merged commit 37fea1f into develop Jul 8, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in @Mike031289's ToDo-Co Jul 8, 2026
@Mike031289
Mike031289 deleted the task/anonymous-user-migration branch July 8, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request feature Extra attention is needed security

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant