Repository navigation
✨ Settings: "Post on other projects as" control for remote write identity - #18603
Conversation
…ne, docs (#18516) - Settings → Repos → Reference repos: owner-only three-way control (Hive bot, falling back to me / Hive bot only / Me) with one provenance line; every write entry says which identity posts there and why ("posts as hivecommons-hive[bot]: App installed on <org>", "posts as <owner>: App not installed on <org>", "read-only: connect your GitHub account", "read-only: bot only, App not installed on <org>"). Owner-panel copy no longer says remote writes are never the App. - PUT /api/config/reference-repos/write-identity: validates, dry-runs the hand-written entries under the new value (refuses what boot would stop on), saves, re-resolves synchronously, audits config_remote_write_identity (sensitive). GET /api/config/reference-repos carries write_identity, write_identities and bot_login; entries and /api/status carry credential_identity and credential_note. - Repos card chip names the bot identity; unresolved chip restored. - Docs: two-lane section (whose name the writes carry), operator reference row, API reference, openapi. Settings-parity allowlist entry removed. Fixes #18516 Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
@nate-double-u FYI, this adds the Settings choice for #18516: pick "Hive bot only" under Settings, Repos, Reference repos. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. @clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. |
Mutation testing7 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the
Verdict: |
Karibhou
left a comment
There was a problem hiding this comment.
Review of #18603 against what #18536 handled, as requested. Three points; the first two change behaviour.
1. The Settings per-repo line ignores credential_note and re-infers the reason from the saved setting
referenceRepoIdentityLine(entry, setting) (config-governor.js:1276) drops credential_note (the entries.map at L1472 does not copy it). It rebuilds the text from meta.write_identity. The field contract says the note is "in words the Settings page shows as is" (pkg/config/reference_repos.go, CredentialNote). The repos card in this PR already does that (repos-render.js:400). Consequences:
- Hive with no GitHub App credentials: the backend resolves
ownerwiththis hive has no GitHub App credentials(referenceNoteNoApp). The line saysApp not installed on <org>, which is wrong. The same applies toread-only: bot only, App not installed on <org>underbot_only. - The line follows the saved setting, not the installed resolution, so it can contradict the identity actually used (see 2).
Suggested: 'posts as ' + who + (note ? ': ' + note : ''), 'read-only' + (note ? ': ' + note : ''), 'read-only this pass' + …, with credential_note carried in entries.map. Also: no invented installation status when the note is missing.
2. The PUT is not atomic with re-resolution
api_config_remote_write_identity.go:63writescfg.Project.RemoteWriteIdentitywithout holdingrt.mu. The derive poller reads that field throughdeps.writeIdentityinsideapplyReferenceReposunderrt.mu. That is a data race, and a pass can install policies under a value that L65 then rolls back whensaveConfigfails.- The dry run (
checkRemoteWriteIdentity, hand-written only) and the post-saverederiveReferenceReposare two separate resolutions. If the second one fails, it only logsprevious policies kept. The PUT still returns 200 with the new setting stored while the old policies stay installed.
#18536 handled this with a LockRemoteWriteIdentity dep. It holds rt.mu across dry run → save → publish, keeps the dry-run resolution (pendingIdentity), publishes exactly that one after a successful save, and discards it on a failed save. Request latency is the same, since this PR also runs the full pass synchronously in the request.
3. Tests
The radio group's role="radio"/aria-checked and the three tooltips are implemented identically here but untested. #18536's reference_repos_editor.test.js asserted them (plus the per-repo lines for no GitHub App credentials, token_file, unresolved, and a missing note).
Happy to push these as a follow-up on top of this PR once it lands if that's easier than folding them in here.
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Part 2 of #18516. It adds the Settings control, the API and the docs on top of the backend already merged in #18521.
Settings → Repos → Reference repos
bot, the default), Hive bot only (bot_only) and Me (owner).posts as hivecommons-hive[bot]: App installed on <org>posts as <owner>: App not installed on <org>posts as <owner>: set to post as youread-only: connect your GitHub accountread-only: bot only, App not installed on <org>read-only this pass: could not check the App on <org>🤖 as <bot>for bot-identity entries, and theunresolvedchip is back.API
PUT /api/config/reference-repos/write-identitywith body{"write_identity": "bot|bot_only|owner"}. It is owner-only.config_remote_write_identityaudit entry, marked sensitive.GET /api/config/reference-reposnow also returnswrite_identity,write_identitiesandbot_login./api/statusnow carrycredential_identityandcredential_note.Docs
writeand on the derived-entries row.check-docs-citations.py --fix.project.remote_write_identityline is removed from the settings-parity allowlist.Tests
api_config_remote_write_identity_test.go: owner-only, validation, the dry-run refusal, persistence, the re-resolve hook, the audit entry, and that re-sending the same value does nothing.reference_repos_editor.test.js: the three choices and the default, PUT then reload, a refusal shown in place, and the per-repo lines for bot, owner, read-only and bot_only.Upgrade
Existing hives have no key, so they read as
bot, and the control shows Hive bot, falling back to me. Choosing Me gives the pre-#18516 behaviour everywhere.Fixes #18516
🤖 Generated with Claude Code