Repository navigation
OpenConceptLab/ocl_issues#2947 | Data migration: TBv2 My Pins become follows - #953
Merged
Merged
Conversation
…y Pins become follows For every pin, follow the pinned org or repo for the person whose TBv2 My Pins list showed it (a user pin's user, an org pin's creator), unless it's gone or they can no longer view it. Follows are inserted directly, so no Followed events are recorded. Pins are untouched, and the reverse migration does nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph
paynejd
commented
Oct 22, 2026
paynejd
left a comment
Member
Author
There was a problem hiding this comment.
Codex review, pass 1 (codex-cli 0.163.0, commit 833ac23)
Verdict: clean, no findings.
findings.json
{
"reviewer": "codex-cli 0.163.0",
"perspective": "defects",
"mode": "full",
"commit": "833ac23d",
"verdict": "clean",
"prior": [],
"findings": []
}
Member
Author
|
Simplification review (claude subagent, commit 833ac23) Verdict: clean, nothing to cut. No commits since Codex pass 1, so no follow-up Codex check is needed. simplify.json{
"reviewer": "claude subagent",
"perspective": "simplify",
"mode": "full",
"commit": "833ac23d",
"verdict": "clean",
"prior": [],
"findings": []
} |
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.
TBv3 keeps pins as overview highlights and lists follows as personal shortcuts. TBv2's My Pins list (
GET /users/<me>/pins/?includeCreatorPins=true) showed a person's own pins plus the org pins they created, so this one-time data migration turns each person's list into follows.What changed
core/pins/migrations/0005_pins_to_follows.py. For every pin it follows the pinned org, source or collection for the person whose My Pins list showed it: the pin's user for a user pin, the pin's creator for an org pin.is_active=False, which the follow API refuses too), or when the person can no longer view it. Viewing followsCanViewConceptDictionary: public, staff, the repo's owner, or a member of the org that owns it. A repo version counts as public only while its HEAD is. Org pins also need the person to still see the pinning org, asPin.get_visible_torequired for that list.bulk_create(..., ignore_conflicts=True), notUserProfile.follow(), so no Followed events are recorded and an existing follow stays as it is. Pins are untouched. The reverse is a no-op, since by then people may have changed their follows.pins.0004,users.0037,orgs.0022,sources.0046,collections.0071,contenttypes.0002. Historical models only.How I verified it
PinsToFollowsMigrationTestruns the migration function with historical models (MigrationLoader(...).project_state(...)) on a dataset covering: user pins, org pins (follower = creator), an existing follow (kept, no duplicate), a deleted source, an inactive collection, private repos and a private org the follower lost access to (skipped) or can still see (followed), a staff creator, a public version of a private HEAD, an org pin whose private org the creator can't see, and a second run (adds nothing). It checks pins and the Event count are unchanged, and that each person's follows equal theirincludeCreatorPins=truelist less the deleted resources. 8 follows (7 new) on that dataset.is_activefilter or the owner check each fails the test.python manage.py test core.pins core.users --keepdb(107 tests, OK);pylint -j2 core10.00;migrate,migrate pins 0004andmigrate pinsrun cleanly;makemigrations --dry-runshows only the known localMapProject.encoder_modeldrift, not included.The web side (oclweb3) is a separate PR.
Part of OpenConceptLab/ocl_issues#2947
🤖 Generated with Claude Code
https://claude.ai/code/session_01TjM9dGow2KV1Gwr2dWQdph