| 1 | # Connect GitHub: reviewed copy, 2026-11-23 |
| 2 | |
| 3 | The controller supplied Luna's verdict on 2026-11-23. These are the final |
| 4 | values for A, B, C and the native handoff: 39 keys, including the split pending hint and the later |
| 5 | already-connected and repository-limit verdicts. No runtime copy is added by this branch. |
| 6 | When implementing, use each exact value and mark it |
| 7 | `// COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)` with the usual inventory |
| 8 | and bounded release-test list. Send any later additions or changes separately. |
| 9 | Use "GitHub App" throughout, GitHub's spelling "Organization", "repositories" |
| 10 | for GitHub's side, and "projects" for Equipo's own. |
| 11 | Existing generic cancel, retry, owner-only and project controls are reused. |
| 12 | All values are standalone labels or sentences, not work.reason fragments. |
| 13 | |
| 14 | ## A. Owner-only GitHub section and manifest flow |
| 15 | |
| 16 | | Key | Reviewed value | Use | |
| 17 | | --- | --- | --- | |
| 18 | | `github.title` | GitHub | Owner-only Settings section, separate from model connections. | |
| 19 | | `github.connect` | Connect GitHub | Start setup. | |
| 20 | | `github.account` | GitHub account | Input for intended account login. | |
| 21 | | `github.account_type` | Account type | Choice label. | |
| 22 | | `github.organization` | Organization | Account type. | |
| 23 | | `github.personal_account` | Personal account | Account type. | |
| 24 | | `github.create_app` | Create a GitHub App | Manifest form submission. | |
| 25 | | `github.create_hint` | GitHub will ask you to create a GitHub App and choose the repositories Equipo can access. | Before the external form. | |
| 26 | | `github.confirm_account` | Connect %s | Verified account login, not submitted/model text. | |
| 27 | | `github.repository_count` | Repositories: %d | Verified complete count; never substitute zero on error. | |
| 28 | | `github.confirm` | Connect | Explicit activation tap. | |
| 29 | | `github.connected` | GitHub is connected | Connection state. | |
| 30 | | `github.already_connected` | GitHub is already connected for %s. | Duplicate start/Connect; %s is the verified account login. Luna OK, 2026-11-23. | |
| 31 | | `github.disconnect` | Disconnect | Owner action. | |
| 32 | | `github.disconnect_hint` | Disconnecting stops Equipo from reading these GitHub repositories. These projects stay listed. | Step-4 disconnect form. | |
| 33 | | `github.pending` | The GitHub App is not connected yet. | Created, awaiting installation or owner confirmation. | |
| 34 | | `github.pending_hint` | You can check again for up to 24 hours after creating the GitHub App. | All account types; separate from redirect deadline. | |
| 35 | | `github.pending_approval` | If approval is needed, ask a GitHub organization owner to approve it. | Organizations only; never show for a personal account. | |
| 36 | | `github.check_again` | Check again | JWT installation recheck, no redirect required. | |
| 37 | | `github.redirect_expired` | This GitHub setup link has expired. If you created the GitHub App, select Check again. Otherwise, start again. | Installation-stage ten-minute expiry only, while the key is held. Never use for manifest-stage expiry. | |
| 38 | | `github.pending_expired` | The 24-hour setup window has ended. Connect GitHub again to create a new GitHub App. | Key removed after pending lifetime. | |
| 39 | | `github.setup_failed` | GitHub setup could not be completed. Start again to create a new GitHub App. | Failed conversion or verification, and manifest-stage expiry; no raw error. | |
| 40 | | `github.app_remains` | The GitHub App still exists on GitHub. You can delete it in GitHub App settings. | Expiry, failed conversion, superseded pending setup or Disconnect. Use the account's Apps settings list if the slug is unverified. | |
| 41 | | `github.app_settings` | Open GitHub App settings | Cleanup link; never automatic deletion. | |
| 42 | | `github.reconnect` | Connect GitHub again | Typed reconnect state action. | |
| 43 | | `github.reconnect_hint` | Equipo can no longer use this GitHub App. Connect GitHub again to create a new one. | Sealed key cannot be read; no decrypt details. | |
| 44 | | `github.check_failed` | Equipo could not check GitHub right now. Try again later. | Retryable check failure, distinct from lost access. | |
| 45 | |
| 46 | ## B. Reachable repositories and the read-only boundary |
| 47 | |
| 48 | | Key | Reviewed value | Use | |
| 49 | | --- | --- | --- | |
| 50 | | `github.group` | GitHub, %s | Verified account group in Projects. | |
| 51 | | `github.not_connected` | GitHub is not connected | Disconnected or uninstalled state. | |
| 52 | | `github.suspended` | GitHub access is suspended | Verified installation suspension. | |
| 53 | | `github.stale` | Equipo could not refresh GitHub. This list may be out of date. | Network or rate-limit failure; not revocation. | |
| 54 | | `github.too_many` | Equipo can list up to %s repositories from this GitHub account. Choose fewer repositories on GitHub. | Above 1000 repositories; %s is the bound formatted through Rastrillo's locale number formatting, never hard-coded "1,000". Luna OK, 2026-11-23. | |
| 55 | | `github.not_reachable` | This repository is not available to Equipo. | Explicit GitHub miss or deselection. | |
| 56 | | `github.choose_repositories` | Choose repositories on GitHub | Verified installation settings link. | |
| 57 | | `github.read_only` | Equipo can read this GitHub project, but cannot change it yet. | Every GitHub task is refused, including moves and flag-off requests, before dispatch. | |
| 58 | |
| 59 | ## C. Read authorization and protocol |
| 60 | |
| 61 | | Key | Reviewed value | Use | |
| 62 | | --- | --- | --- | |
| 63 | | `github.runner_update` | Your runner needs an update to read GitHub projects. | Old-protocol refusal. | |
| 64 | | `github.read_unavailable` | Equipo cannot read this GitHub project right now. Check its connection in Projects. | Flag-off read refusal, or safe read refusal when a more specific state is unavailable. | |
| 65 | |
| 66 | ## Native follow-up |
| 67 | |
| 68 | | Key | Reviewed value | Use | |
| 69 | | --- | --- | --- | |
| 70 | | `github.setup_web` | Set up GitHub on the web | Owner web setup link, also reusable by the web not-connected card. | |
| 71 | | `github.setup_owner` | Ask a team owner to connect GitHub. | Member sees the state but has no owner setup controls. | |
| 72 | |
| 73 | The native apps reuse the same state values. Owners get the setup link; |
| 74 | members get the owner notice. All links come from validated instance or |
| 75 | GitHub identity, never repository prose. The final device API section will |
| 76 | be sent verbatim to Luna when its concrete wire changes are ready in C. |
| 77 | |
| 78 | ## State-to-string contract |
| 79 | |
| 80 | These are the exact rendering cases for the plan, including action labels. |
| 81 | The shared shell adds `github.title` on the owner GitHub page and |
| 82 | `github.group` on an account's Projects group. Account names are verified |
| 83 | logins; counts are known complete counts. Cleanup always pairs |
| 84 | `github.app_remains` with `github.app_settings`, using the validated old App |
| 85 | settings URL or the account's Apps settings list when its slug is unverified. |
| 86 | No cleanup link silently points to a replacement App. |
| 87 | |
| 88 | | State or surface | Exact keys and conditions | |
| 89 | | --- | --- | |
| 90 | | Owner GitHub section, no setup | `github.title`, `github.not_connected`, `github.connect`. | |
| 91 | | Start/account form | `github.account`, `github.account_type`, `github.organization`, `github.personal_account`, `github.create_app`, `github.create_hint`. | |
| 92 | | Awaiting manifest callback, within ten minutes | The manifest surface retains `github.create_app`, `github.create_hint`; do not show the created-App pending state before conversion. | |
| 93 | | Created, unconnected, key held under 24 hours | `github.pending`, `github.pending_hint`, `github.check_again`; add `github.pending_approval` only for organizations awaiting approval. | |
| 94 | | Verified installation, awaiting explicit Connect | `github.confirm_account`, `github.repository_count`, `github.confirm`. | |
| 95 | | Manifest-stage expiry, no conversion and no key | `github.setup_failed`, `github.app_remains`, `github.app_settings`, `github.connect`. Never `github.redirect_expired` or `github.check_again`. | |
| 96 | | Installation-stage redirect expiry, key still held under 24 hours | `github.redirect_expired`, `github.check_again`. | |
| 97 | | Created-but-unconnected key expires at 24 hours | `github.pending_expired`, `github.app_remains`, `github.app_settings`, `github.reconnect`. No Check again. | |
| 98 | | Conversion/verification fails for this valid attempt | `github.setup_failed`, `github.app_remains`, `github.app_settings`, `github.connect`. | |
| 99 | | Invalid, wrong-stage, replayed or wrong-session callback | `github.setup_failed`, `github.connect`. Reveal no other owner's setup, settings URL or secret; do not delete another valid attempt. | |
| 100 | | Session no longer belongs to a current owner | Existing owner-forbidden copy; no GitHub account details or actions. The transaction roster check denies the write. | |
| 101 | | The team's single pending setup superseded by any current owner, for any account | `github.app_remains`, `github.app_settings` for the discarded App, followed by the new Start/account form keys. | |
| 102 | | Connected | `github.connected`, `github.disconnect`, `github.disconnect_hint`. | |
| 103 | | Already connected, duplicate start or Connect | `github.already_connected`, with verified login; the existing connected surface remains and the team's pending setup is untouched. | |
| 104 | | Owner Disconnect | `github.not_connected`, `github.app_remains`, `github.app_settings`, `github.reconnect`. | |
| 105 | | Uninstalled, key retained for seven days from first observation | `github.not_connected`, `github.check_again`. Never the 24-hour pending hint or a second Connect confirmation. | |
| 106 | | Same-App/account reinstall verified within seven days | `github.connected`, `github.disconnect`, `github.disconnect_hint`; existing projects revive by IDs. | |
| 107 | | Uninstall key retention expires after seven days | `github.not_connected`, `github.app_remains`, `github.app_settings`, `github.reconnect`. No Check again. | |
| 108 | | Unreadable sealed key, typed reconnect | `github.reconnect_hint`, `github.reconnect`, `github.app_remains`, `github.app_settings`. | |
| 109 | | Retryable installation check/network/rate-limit failure | `github.check_failed`, `github.check_again` while a valid key is held; without one, the failed-setup case applies. | |
| 110 | | Verified suspension | `github.suspended`; an owner with a held key also gets `github.check_again`. | |
| 111 | | Projects group down after Disconnect or uninstall (branch B) | `github.group`, `github.not_connected`. | |
| 112 | | Projects group suspended (branch B) | `github.group`, `github.suspended`. | |
| 113 | | Pending Connect with more than 1000 repositories | `github.too_many`, `github.choose_repositories`, `github.check_again`. No `github.confirm` or count; recheck enables Connect only after a complete count within the limit. | |
| 114 | | Projects account group, complete current inventory | `github.group`; existing project controls and Available to add copy are reused. | |
| 115 | | Inventory stale or unknown after network or rate-limit failure | `github.group`, `github.stale`; no fake zero count or lost-access message. | |
| 116 | | Installation above 1000 repositories, snapshot unknown | `github.group`, `github.too_many`, `github.choose_repositories`; include `github.stale` if displaying an older snapshot. Never a partial current list. | |
| 117 | | Explicit GitHub miss or repository deselection, verified installation exists | `github.not_reachable`, `github.choose_repositories`. | |
| 118 | | Explicit GitHub miss, no verified installation | `github.not_connected`; owners get `github.setup_web`, members get `github.setup_owner`. | |
| 119 | | Valid rename/transfer with verified reach | `github.group` and the ordinary project row; no new notice. Invalidate the old read binding before re-cloning. | |
| 120 | | Transfer without verified destination reach | `github.not_reachable`; use the matching miss case above for its action. | |
| 121 | | Removed project or lost queued selection | Existing `projects.selection_lost`; if a subsequent explicit GitHub read is refused, `github.read_unavailable`. No GitHub settings action is invented for project deletion. | |
| 122 | | Any GitHub task, including move, retry, each specialist/worker and flag-off | `github.read_only`. No task is recorded, moved or dispatched. | |
| 123 | | Read with the instance flag off after data exists | `github.read_unavailable`. The setup section may be hidden, but the request still receives this refusal. | |
| 124 | | Old runner protocol | `github.runner_update`. | |
| 125 | | Other refused read or temporarily unavailable authorization | `github.read_unavailable`, unless a specific not-connected, suspended or not-reachable state above is known. | |
| 126 | | Native owner setup link | `github.setup_web`, plus the current state keys. | |
| 127 | | Native member without a connection | `github.not_connected`, `github.setup_owner`; no owner controls. | |
| 128 | |
| 129 | Implementation tests enumerate every typed state and these presentation cases, |
| 130 | assert their exact required key sets and nonempty rendering, and assert that |
| 131 | the union covers all 39 new keys with none unused. Existing reused keys are |
| 132 | listed separately. New typed states must add an explicit fixture rather than |
| 133 | fall through a generic default. Remove a state mapping to prove the contract |
| 134 | fails. Independently exchange the two redirect-expiry mappings and require |
| 135 | both the rendering assertions and conversion-count tests to fail. Include |
| 136 | personal-account and organization variants, any-current-owner actions, |
| 137 | flag-off data, the seven-day boundary and a 1001-repository fake response. |
| 138 | |