| 1 | # GitHub egress check, 2026-11-23 |
| 2 | |
| 3 | Base: main `f623151c`. Branch: `github/egress-check`. |
| 4 | |
| 5 | The command `equipo check-github` runs before configuration, database, mail |
| 6 | and serving. It sends one unauthenticated GET to |
| 7 | `https://api.github.com/meta`, directly, with a five-second overall timeout. |
| 8 | It refuses redirects, verifies TLS, bounds response headers to 16 KiB and |
| 9 | reads no response body. It has no configurable target, credentials, cookies, |
| 10 | environment proxy or retry. No production command has been run by this branch. |
| 11 | |
| 12 | Output contains only verified TLS reachability, numeric HTTP status, elapsed |
| 13 | time and the connected TLS peer's IP and port. Status is zero without an HTTP |
| 14 | response; peer is `-` without a verified TLS connection. Reachability means a |
| 15 | response over verified TLS, including a refused redirect or HTTP failure. |
| 16 | Exit zero additionally requires HTTP 2xx and successful output. All other |
| 17 | outcomes exit one, without printing raw errors, headers or body text. |
| 18 | |
| 19 | ## Run after the controller deploys this version |
| 20 | |
| 21 | ```sh |
| 22 | carlos run --app equipo --account oficina \ |
| 23 | --console https://console.carloku.com \ |
| 24 | --instance equipo.bds.oncarlos.com --timeout 15s -- check-github |
| 25 | ``` |
| 26 | |
| 27 | The values are `APP`, `ACCOUNT`, `CONSOLE` and `HOST` in |
| 28 | `scripts/upgrade-thin.sh:47`. `carlos run --help` confirms that `--instance` |
| 29 | takes the instance host and arguments following `--` go to the app binary. |
| 30 | The public alias is not used as the instance identifier. The separate staging |
| 31 | values live in `scripts/staging-thin.py:48` (app `equipo-staging`, account |
| 32 | `bds`, host `equipo-staging.bds.oncarlos.com`). This branch neither deploys |
| 33 | nor claims that CARLOS egress has passed; the controller records that result. |
| 34 | |
| 35 | ## Tests and mutations |
| 36 | |
| 37 | Tests were written before implementation. Against compiling empty stubs, |
| 38 | `TestCheckGitHubCommand`, `TestCheckGitHubRefusesRedirect`, |
| 39 | `TestCheckGitHubDoesNotReadBody` and `TestCheckGitHubRequiresVerifiedTLS` |
| 40 | failed at runtime. The entry-point test first failed with the normal missing |
| 41 | instance-key boot refusal, then passed with command dispatch before boot. |
| 42 | |
| 43 | Commands use `GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0`. Each mutation is applied |
| 44 | alone, run with `go test ./cmd/equipo -run '^<test>$' -count=1 -timeout=20s`, |
| 45 | and restored. Compilation failures do not count. |
| 46 | |
| 47 | | Mutation | Killing test | |
| 48 | | --- | --- | |
| 49 | | Match `serve` instead of `check-github` | `TestCheckGitHubCommand` | |
| 50 | | Change the fixed path to `/zen` | `TestCheckGitHubCommand` | |
| 51 | | Send POST instead of GET | `TestCheckGitHubCommand` | |
| 52 | | Follow redirects | `TestCheckGitHubRefusesRedirect` | |
| 53 | | Copy the response body to output | `TestCheckGitHubCommand` | |
| 54 | | Drain the response body | `TestCheckGitHubDoesNotReadBody` | |
| 55 | | Remove the overall timeout | `TestCheckGitHubFailureIsBoundedAndPrivate` | |
| 56 | | Use the environment proxy | `TestCheckGitHubFailureIsBoundedAndPrivate` | |
| 57 | | Remove the response-header bound | `TestCheckGitHubFailureIsBoundedAndPrivate` | |
| 58 | | Accept a TLS response without a verified chain | `TestCheckGitHubUnverifiedPeerAndHTTPFailure` | |
| 59 | | Report an unverified TLS peer | `TestCheckGitHubUnverifiedPeerAndHTTPFailure` | |
| 60 | | Omit the resolved peer | `TestCheckGitHubCommand` | |
| 61 | | Accept HTTP 503 as success | `TestCheckGitHubUnverifiedPeerAndHTTPFailure` | |
| 62 | | Ignore failed output | `TestCheckGitHubOutputFailure` | |
| 63 | | Run boot before the diagnostic | `TestCheckGitHubBypassesBoot` | |
| 64 | |
| 65 | Fake servers bind loopback and use generated test TLS certificates. No real |
| 66 | GitHub App, key or token is used. The tests also check absent authorization |
| 67 | and cookies, one request, one output line, no header/body sentinel, TLS |
| 68 | certificate rejection, cancellation and the exact command argument boundary. |
| 69 | |
| 70 | ## Copy |
| 71 | |
| 72 | Only `CopyGitHubEgress` is new: |
| 73 | |
| 74 | ```text |
| 75 | GitHub reachable: %t; status: %d; latency: %s; TLS peer: %s\n |
| 76 | ``` |
| 77 | |
| 78 | It was marked pending with `scripts/copy-status.py pending`. The controller |
| 79 | returned Luna's verdict in message `08a0554d-dcc7-4ef9-8aa6-0121e13a9a88`: |
| 80 | |
| 81 | > Luna: APPROVED as is. Mark it `// COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)`, then carry on. |
| 82 | |
| 83 | The exact accepted value, inventory row and bounded release-test key reflect |
| 84 | that verdict. The `accept` command was not invoked. |
| 85 | |
| 86 | ## Gates |
| 87 | |
| 88 | Results are recorded below before handoff. No device routes, OpenAPI changes, |
| 89 | wire fields, protocol changes, migrations or connector behavior are added. |
| 90 | Only measured size ceilings change: equipo 22109 to 22112 source lines for |
| 91 | copy; plan3test 11899 to 11900 test lines for the accepted key. No time budget |
| 92 | changes. Existing test assertions and names are unchanged. |
| 93 | |
| 94 | - All 15 mutations above failed at runtime; restored tests passed. |
| 95 | - `make fmt-check budget migration-check copy-release-check lanes-check spacing`: passed. |
| 96 | - `make gitleaks`: passed on base history; repeated after committing below. |
| 97 | - `go test -tags testbuild ./cmd/equipo ./internal/equipo ./internal/equipo/chat ./internal/thintest -count=1`: passed (1.210s, 31.465s, 5.717s, 171.974s). |
| 98 | - `go test -tags testbuild ./internal/plan3test -run 'TestPersonAPI|TestPlan3Release' -count=1`: passed (12.877s). |
| 99 | - `go test ./internal/testci -run TestBudgetRecordsAreShort -count=1`: passed. |
| 100 | - `go vet ./cmd/equipo` and pinned staticcheck v0.7.0 for that package: passed. |
| 101 | - `python3 native/scripts/check-fixtures.py`: passed (11 API fixtures, 3586 Markdown fixtures, 32000 seeded differential cases). |
| 102 | - Post-commit reference scan, committed-history secret scan and Linux CI are reported with the pushed SHA in the handoff. |
| 103 | |