Repository navigation
Description
Context
ProPR currently has no concept of "who is this work assigned to". Tasks, goals, plans, automations and to-dos all store a raw GitHub numeric user id (tasks.initial_job_data.userId, goals.owner_id, task_drafts.user_id, repo_todos.user_id, agent_definitions.owner_id) but nothing anywhere maps that id back to a GitHub login or avatar URL. That is the single missing primitive that blocks every other part of this feature: the Tasks list cannot render avatar + username, the task detail page cannot show assignment, and the "my tasks" filter has nothing to compare the signed-in user against.
This task adds the two foundations the rest of the feature builds on:
- A shared contract (
@propr/shared) for an assigned/attributed user and for the task assignment filter, so the API, CLI, MCP and Web UI all agree on one shape instead of each inventing its own. - A GitHub user profile cache (
github_user_profilestable plus a core service) that maps a stable GitHub numeric user id to its login and avatar URL, refreshed opportunistically from GitHub.
A cache is required rather than resolving logins on demand: the Tasks list renders up to 25 grouped tasks per page and each can have several assignees, so a per-render GitHub lookup would mean dozens of API calls per page view and would make the list fail whenever GitHub rate-limits the installation.
No user-visible behaviour changes in this task. It is pure groundwork and must be merged before the tasks that follow.
Requirements
- Add
AttributedUser(id, login, displayName, avatarUrl) andTASK_ASSIGNMENT_FILTERS/TaskAssignmentFilterto@propr/shared, exported from its barrel. - Add a validator/normalizer for the assignee filter query value so the API, CLI and MCP share one parser.
- Create a
github_user_profilesmigration: primary keygithub_user_id(string), pluslogin,avatar_url,display_name,refreshed_at,created_at,updated_at, and an index onloginfor login-based lookups. - Add
packages/core/src/services/githubUserProfileService.tsexposing:rememberGitHubUserProfiles(profiles)- idempotent upsert of profiles already observed in a GitHub payload.loadGitHubUserProfiles(userIds)- batch read returning aMap<string, AttributedUser>.resolveGitHubUserProfiles(userIds)- batch read that fills gaps from the GitHub API (GET /user/{account_id}) and caches the result, with a staleness window.resolveGitHubUserProfileByLogin(login)- used to turn an operator-supplied login into a stable id.
- Every function must fail soft: a GitHub outage or an unreadable cache returns whatever is known rather than throwing, because assignment display must never break a task list.
- Re-export the service and types from
packages/core/src/index.ts. - Unit tests in
test/covering upsert idempotency, batch reads, the staleness refresh window, GitHub failure tolerance and filter parsing.
Implementation Specification
Files added
packages/shared/src/assignment.tspackages/core/src/db/migrations/20261012000000_create_github_user_profiles.jspackages/core/src/services/githubUserProfileService.tstest/githubUserProfileService.test.ts
Files modified
packages/shared/src/index.ts- export the new module from the barrel.packages/core/src/index.ts- re-export the service and the shared types consumers import from core.
Step-by-step
- Create
packages/shared/src/assignment.tswith theAttributedUserinterface, the filter constants andparseTaskAssignmentFilter. Keep it dependency-free so the UI can import it without pulling in core. - Add
export * from './assignment.js';topackages/shared/src/index.ts, beside the other contract modules. - Create the migration. Use a string primary key, because GitHub numeric ids are stored as strings everywhere else in this codebase (
goals.owner_id,tasks.initial_job_data.userId). - Create
githubUserProfileService.ts. Resolve unknown or stale ids throughgetAuthenticatedOctokit()wrapped inwithRetry(retryConfigs.githubApi, ...), and swallow failures with alogger.warn. - Re-export from
packages/core/src/index.tsin the services section. - Add the unit test file using
node:testwith an in-memory SQLite database and the shared migrations, following the pattern inpackages/api/test/mcpRepositoryAutoResolve.test.ts.
Acceptance Criteria
npm run typecheckandnpm run lintpass.- Migrating a fresh SQLite database creates
github_user_profiles; rolling the migration back drops it. rememberGitHubUserProfilescalled twice with the same payload leaves exactly one row and updatesupdated_at.loadGitHubUserProfilesreturns only cached rows and never calls GitHub.resolveGitHubUserProfilescalls GitHub once per unknown id, caches the result, and returns cached values for ids refreshed inside the staleness window.- When the GitHub request throws,
resolveGitHubUserProfilesstill returns the cached entries it did find and logs a warning instead of rejecting. parseTaskAssignmentFilteracceptsall,meand a comma-separated login list, trims and de-duplicates logins case-insensitively, and rejects an over-long list.- No existing behaviour changes: no route, worker or UI file is touched in this task.
Created by ProPR AI Planner
Activity
propr-dev commentedon Oct 8, 2026
Suggested Implementation:
Implementation Approach
Assignment display needs a GitHub login and avatar for an id that ProPR already stores. There were three ways to get them:
The cache is written from two directions.
rememberGitHubUserProfilesrecords profiles that arrived free inside a webhook payload (GitHub sendsloginandavatar_urlon every actor), which means the cache fills during normal operation without a single extra API call.resolveGitHubUserProfilesis the fallback that fetches only genuinely unknown or stale ids.Every read is fail-soft and returns a partial
Maprather than throwing. This is deliberate: the alternative is that a GitHub outage or a locked SQLite file turns an avatar into a 500 on the Tasks page.The shared contract lives in
@propr/sharedrather than core because the Web UI imports it directly, and core pulls in GitHub auth, Redis and the database on import.File:
packages/shared/src/assignment.ts(new file)Why this file:
@propr/sharedis the only package the backend, CLI and Web UI all depend on, so the assignment shape has to live here for the API projection, the UI renderer and the CLI table to agree. It is kept free of imports so the browser bundle does not pull in server code. The filter parser lives beside the type so the HTTP route, the CLI flag and the MCP tool validate the same strings the same way instead of three near-identical regexes drifting apart.File:
packages/shared/src/index.tsWhy this file: the barrel is the only import path other packages use (
@propr/shared), so a new contract module is invisible until it is re-exported here.File:
packages/core/src/db/migrations/20261012000000_create_github_user_profiles.js(new file)Why this file: one row per GitHub user, keyed by the id the rest of the schema already stores. Putting login and avatar here rather than on
tasks,goals,task_drafts,repo_todosandagent_definitionsmeans a renamed account is a one-row update instead of a cross-table backfill.File:
packages/core/src/services/githubUserProfileService.ts(new file)Why this file: the single place that reads and writes the cache, so the staleness policy and the fail-soft behaviour are decided once. Routes, workers and MCP tools call it rather than querying the table, which keeps the "never throw for an avatar" rule in one function instead of at every call site.
File:
packages/core/src/index.tsWhy this file: core's barrel is the single import path for the API, worker and CLI. The assignment types are re-exported from here too so a server file does not have to import from both
@propr/coreand@propr/sharedfor one feature.Add near the other service re-exports:
File:
test/githubUserProfileService.test.ts(new file)Why this file: the cache's value is entirely in its edge behaviour (idempotent upsert, staleness window, GitHub failure tolerance), none of which is visible from a happy-path call. The tests pin those so a later change cannot quietly turn a warning into a thrown error on a list page.
propr-dev commentedon Oct 8, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-52888/claude-opus-5-5-add-shared-assignment-con-20261008-2245-0r12888-epic-task-assignment-1m4issue-2888-20261008-2245-claude-opus-5-5-0r1🔍 Track Task Execution