Skip to content

feat: add user work role preference - #1952

Open
Douglasymlai wants to merge 3 commits into
fix/personalised-example-space-categoryfrom
fix/personalised-example-user-role
Open

Douglasymlai wants to merge 3 commits into
fix/personalised-example-space-categoryfrom
fix/personalised-example-user-role

Conversation

@Douglasymlai

Copy link
Copy Markdown
Contributor

Pull Request

Related Design

This is PR 2 of the personalised example-content foundation and follows
#1951. It is intentionally stacked on that PR so the two schema migrations
remain in one ordered Alembic lineage.

Description

Adds an optional work_role_key to the user profile. The value provides a
stable product preference that future experiences can use to present more
relevant example Tasks without changing permissions or existing application
behavior.

Users who have not selected a role keep null. No role is inferred, and the
current application continues to behave as it does today. A future example
experience can use its generic fallback when the preference is absent.

Design

  • Adds nullable user.work_role_key VARCHAR(50) with no server default.
  • Adds work_role_key to User, UserProfile, and UserOut.
  • Carries the value through the existing authenticated user profile API.
  • Preserves all omitted profile fields during a partial update.
  • Clears the value when an update explicitly sends work_role_key: null.
  • Keeps existing users and older clients compatible.

The API accepts these product-owned keys:

  • product-management
  • engineering
  • human-resources
  • finance
  • marketing
  • sales
  • operations
  • data-science
  • design
  • legal
  • scientist
  • student
  • founder
  • healthcare
  • writer
  • educator
  • consultant
  • researcher
  • software-engineer
  • others

The role is preference metadata, not an authorization, entitlement, agent, or
execution role. Unlike the content-owned Space category key in #1951, this
list belongs to the product onboarding contract and is validated by the API.

Scope

This PR contains the user preference persistence and API contract only. It
does not add role-selection UI, onboarding screens, recommendation delivery,
example content, source configuration, Automation behavior, Session execution,
or Task execution.

Migration

The Alembic revision follows add_space_category_key, adds one nullable
column, and preserves a single migration head:

ALTER TABLE "user" ADD COLUMN work_role_key VARCHAR(50);

No database default or fixed-value database constraint is added. Existing
rows remain null until a user chooses a role.

Testing Evidence

  • 33 focused user-role, API-contract, migration, and persistence tests pass.

  • 150 broader server tests pass, including the Space category tests from
    feat: add content-owned Space category key #1951.

  • SQLModel persistence verifies the role survives a database reload.

  • Alembic reports one head and PostgreSQL offline SQL generation verifies the
    ordered Space-category and user-role migrations.

  • Ruff check, Ruff format, Prettier, and git diff --check pass.

  • The Douglas Eigent PR check found no remaining actionable issues.

  • I have included human-verified testing evidence in this PR.

  • This PR includes frontend/UI changes, and I attached screenshot(s) or
    screen recording(s).

  • No frontend/UI changes in this PR.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

This branch has not been deployed

No deployments
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.

1 participant