Fix profile write-back: use the API-managed "GitHub (auto)" field - #20
Merged
Conversation
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>
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.
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.setonly persists a custom field whose Data source is set to API — for any other data source it returnsok: trueand discards the write. (Confirmed empirically: even writing a bogus field ID returnedok: true.)Fix
GitHub (auto)field (label containsgithub+auto) whose Data source is API. Reads/lookups stay on the member-editable GitHub field, which members continue to self-manage.@handledisplay text — the field is alinktype, so bare handles are silently rejected; we storehttps://github.com/<handle>with@<handle>as the display text.(auto)field, and a new resolver finds the auto field; both by label.Data source = APIstep (without it, write-back silently does nothing).Behaviour
set_github_usernameremains best-effort and never blocks an invite. With noSLACK_ADMIN_USER_TOKENor no(auto)field, it cleanly no-ops.Tests
Updated
test_slack_profile.py: writes URL +@handleto 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