Commit dbcbe7a
authored
feat(observability+resilience): MCPP_VERBOSE in all CI + cold index-update retry (#182)
* feat(observability+resilience): MCPP_VERBOSE env + cold index-update retry
Two changes prompted by an opaque, repeatedly-reproducing CI failure in
75_index_status_offline.sh (a cold `mcpp self env` in a fresh MCPP_HOME whose
index/sandbox bootstrap fails fast — root cause swallowed in non-verbose logs;
verified NOT related to the feature/capability work, it fails identically on
main):
1. MCPP_VERBOSE env override (src/cli.cppm): MCPP_VERBOSE=<non-empty,!=0> turns
on verbose logging for EVERY mcpp invocation, including those nested inside
e2e test scripts that call $MCPP without flags. An explicit --quiet still
wins. Set MCPP_VERBOSE: "1" in all CI workflows (ci-linux, ci-linux-e2e,
ci-macos, ci-windows, cross-build-test, ci-fresh-install,
ci-aarch64-fresh-install) so failures carry full diagnostics. Complements the
existing MCPP_LOG_LEVEL (which only sets the FILE log level, not stderr).
2. update_index retry (src/xlings.cppm): the index sync is a network git op;
a single transient blip otherwise fails cold init outright. Bounded retry
with linear backoff (3 attempts, 2s/4s). Success returns on the first
attempt — zero added latency in steady state; only a real failure pays the
backoff. Retry notices go through mcpp::log::verbose (file always, stderr
under MCPP_VERBOSE).
This PR's own e2e CI run carries MCPP_VERBOSE=1, so it surfaces the real cause
of the 75 bootstrap failure for a targeted follow-up.
* feat(resilience): auto-detect best index mirror at first init (the real stability fix)
Implements TODO(mirror-default) option (b). The first-init seed used a hardcoded
"CN" mirror, which strands overseas users and GitHub-hosted CI behind a
slow/unreachable gitcode mirror — the actual root cause behind the repeated
75_index_status_offline.sh cold-bootstrap failures (a US runner seeding CN can't
reach gitcode, so the index clone fails fast and the index reports 'missing').
detect_best_mirror() runs a short, tight-timeout HEAD probe to github.com
(GLOBAL) and gitcode.com (CN), and pins the lower-latency reachable one into
.xlings.json. Priority matches the intended design:
explicit --mirror (config) > lower-latency auto-probe > GLOBAL fallback
An explicit `mcpp self config --mirror CN|GLOBAL` always wins; the probe only
runs on a fresh init with no explicit choice. Falls back to GLOBAL (reachable
nearly everywhere) if neither host answers.
Verified locally: on a CN host the probe picks CN (gitcode 150ms < github 380ms)
and logs 'mirror: probe github=380ms gitcode=150ms -> CN' under MCPP_VERBOSE; a
US CI runner will symmetrically pick GLOBAL. e2e 75/80/81 green.
* fix(mirror): seed "auto" so xlings' own region detection runs (remove curl probe)
Replaces the curl-based mcpp-side probe (per review: don't reinvent in mcpp;
mirror selection is xlings' job, and it already does it via tinyhttps).
Root cause of the repeated 75_index_status_offline.sh CI failures, now proven:
mcpp seeded a hardcoded "CN" into a fresh .xlings.json. xlings' normalize_mirror_
accepts only "GLOBAL"/"CN" as valid, so "CN" was used DIRECTLY (gitcode) —
bypassing xlings' own detect_install_mirror_(), which probes github vs gitcode
latency (tinyhttps::probe_latency) and picks the reachable/faster region. On a
GitHub-hosted (US) runner gitcode is slow/unreachable, so the cold index/sandbox
bootstrap failed and the index reported 'missing'.
Fix: seed "auto". normalize_mirror_("auto") -> nullopt (invalid) -> xlings
treats the mirror as unset -> runs detect_install_mirror_() -> picks GLOBAL on a
US runner, CN on a China link. mcpp no longer overrides xlings' region choice.
The existing-config guard (config.cppm: only seed when .xlings.json is absent)
already means an explicit `mcpp self config --mirror CN|GLOBAL` is never clobbered.
Empirically confirmed via the curl-probe build's verbose CI run: on the US runner
'probe github=70ms gitcode=1060ms -> GLOBAL' then patchelf/ninja bootstrap
succeeded and 75 PASSED — proving the mirror region is the cause. This commit
hands that region choice back to xlings instead of doing it in mcpp.
* fix(ci): adjust for mirror=auto default; don't force verbose in e2e-suite jobs
Follow-up to the mirror=auto fix and MCPP_VERBOSE rollout, fixing 3 e2e
regressions surfaced by the previous CI run (75 itself now PASSES):
- 38_self_config_mirror.sh: the default seed is now "auto" (defer to xlings'
region detection), not "CN". Updated the assertion; explicit --mirror
GLOBAL/cn/BAD checks unchanged.
- 48_build_error_output.sh / 53_namespaced_cache_label.sh assert mcpp's DEFAULT
(quiet) output. Forcing MCPP_VERBOSE=1 in CI broke them. Removed MCPP_VERBOSE
from the workflows that run the e2e suite (ci-linux-e2e, ci-macos, ci-windows);
kept it where it's diagnostic and safe (ci-fresh-install,
ci-aarch64-fresh-install — the cold bootstrap path — plus ci-linux unit tests
and cross-build). A test that needs verbose passes --verbose itself.
Verified locally: 38/48/53 green.
* release: v0.0.70 — cold-init mirror auto-detection + observability
Bump mcpp.toml + MCPP_VERSION to 0.0.70. CHANGELOG: seed "auto" so xlings'
region detection runs (fixes overseas/CI cold bootstrap), MCPP_VERBOSE env,
update_index retry.1 parent dea776e commit dbcbe7a
14 files changed
Lines changed: 100 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
6 | 31 | | |
7 | 32 | | |
8 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
104 | 112 | | |
105 | 113 | | |
106 | 114 | | |
| |||
0 commit comments