feat(tasks): add multi-repo support to Task model#53302
Draft
richardsolomou wants to merge 5 commits intomasterfrom
Draft
feat(tasks): add multi-repo support to Task model#53302richardsolomou wants to merge 5 commits intomasterfrom
richardsolomou wants to merge 5 commits intomasterfrom
Conversation
Add TaskRepository junction model so tasks can be associated with multiple repositories. The API accepts a `repositories` array on create/update while keeping the legacy `repository` string field for backward compatibility. Generated-By: PostHog Code Task-Id: 32ce8a7c-b5ca-474c-8d1f-282cf688255c
Generated-By: PostHog Code Task-Id: 32ce8a7c-b5ca-474c-8d1f-282cf688255c
…ulti-repo-support # Conflicts: # products/tasks/backend/migrations/max_migration.txt # products/tasks/backend/serializers.py
Contributor
Migration SQL ChangesHey 👋, we've detected some migrations on this PR. Here's the SQL output for each migration, make sure they make sense:
|
Contributor
🔍 Migration Risk AnalysisWe've analyzed your migrations for potential risks. Summary: 1 Safe | 1 Needs Review | 0 Blocked
|
TaskRepository now inherits from UUIDModel per PostHog policy. The CreateModel and RunPython operations are split into separate migrations (0028 schema, 0029 backfill) to avoid holding locks during data work. Generated-By: PostHog Code Task-Id: 32ce8a7c-b5ca-474c-8d1f-282cf688255c
Contributor
|
Size Change: 0 B Total Size: 127 MB ℹ️ View Unchanged
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PostHog Code currently supports only one repository per task. Users working across multiple repos (e.g., posthog + posthog-js + posthog.com) need multi-repo support. The client-side changes are already done — this is the backend API work.
Changes
TaskRepositoryjunction model — supports multiple repositories per task, each with its own optional GitHub integration0026— creates the table and backfills existingTask.repositorydata intoTaskRepositoryrowsTaskSerializernow accepts arepositoriesarray on create/update. The legacyrepository(string) andgithub_integration(int) fields are kept as read-only for backward compatibility, returning the first repo's values{"repository": "org/repo"}withoutrepositoriesstill works and creates a singleTaskRepositoryrowTask.repositoryandTaskRepositoryentriestask_repositoriesis prefetched alongsiderunsto avoid N+1 queriesHow did you test this code?
I'm an agent — I wrote 8 unit tests in
TestTaskMultiRepoAPIcovering:repositoriesarrayrepositorystringI was unable to run the tests locally (no Postgres available in this environment). Please run:
Publish to changelog?
No
Docs update
N/A
🤖 LLM context
Agent-authored PR. Created the
TaskRepositorymodel, migration with data backfill, serializer changes with backward-compatible legacy field support, and API queryset updates.Created with PostHog Code