Skip to content

Fix profile write-back: use the API-managed "GitHub (auto)" field - #20

Merged
ewels merged 2 commits into
mainfrom
feature/github-auto-profile-field
Jun 22, 2026
Merged

Fix profile write-back: use the API-managed "GitHub (auto)" field#20
ewels merged 2 commits into
mainfrom
feature/github-auto-profile-field

Conversation

@ewels

@ewels ewels commented Jun 22, 2026

Copy link
Copy Markdown
Member

Why

The profile write-back shipped in #19 was a silent no-op in production. It wrote the GitHub handle into the member-editable GitHub profile field, but Slack's users.profile.set only persists a custom field whose Data source is set to API — for any other data source it returns ok: true and discards the write. (Confirmed empirically: even writing a bogus field ID returned ok: true.)

Fix

  • Write to a dedicated GitHub (auto) field (label contains github + auto) whose Data source is API. Reads/lookups stay on the member-editable GitHub field, which members continue to self-manage.
  • Store a URL + @handle display text — the field is a link type, so bare handles are silently rejected; we store https://github.com/<handle> with @<handle> as the display text.
  • Populate for everyone — dropped the old "skip if the member field is set" rule; the auto field is now populated for all invitees. Only skips when the auto field is already set (idempotent).
  • Two-field resolution — the member-field resolver now excludes the (auto) field, and a new resolver finds the auto field; both by label.
  • Docs — documented the two-field setup and the mandatory Data source = API step (without it, write-back silently does nothing).

Behaviour

set_github_username remains best-effort and never blocks an invite. With no SLACK_ADMIN_USER_TOKEN or no (auto) field, it cleanly no-ops.

Tests

Updated test_slack_profile.py: writes URL + @handle to the auto field, writes even when the member field is set, skips when the auto field is already set, no-ops without the auto field / admin token, never raises. Full suite green; ruff + mypy clean.

🤖 Generated with Claude Code

ewels and others added 2 commits June 22, 2026 23:02
PR #19 wrote handles into the member-editable "GitHub" field, which Slack
silently no-ops (users.profile.set only persists for fields whose Data
source is "API"). Profile write-back therefore did nothing in production.

- Write to a dedicated "GitHub (auto)" custom field (label contains
  "github" + "auto"), which has its Data source set to API. Reads/lookups
  stay on the member-editable "GitHub" field.
- Store the value as a GitHub URL with `@handle` display text (the field
  is a link type — bare handles are silently rejected).
- Populate the auto field for everyone (drop the old "skip if the member
  field is set" rule); only skip when the auto field is already populated
  (idempotent).
- Resolve the two fields separately by label; the member resolver now
  excludes the "(auto)" field.
- Document the two-field setup + the mandatory "Data source = API" step.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ewels
ewels merged commit 2a63ed0 into main Jun 22, 2026
3 checks passed
@ewels
ewels deleted the feature/github-auto-profile-field branch June 22, 2026 21:06
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