Skip to content

refactor(reasons): declare the boot failure reasons in ReasonTable rows - #4982

Merged
thymikee merged 3 commits into
mainfrom
refactor/r7-boot-failures
Nov 23, 2026
Merged

thymikee merged 3 commits into
mainfrom
refactor/r7-boot-failures

Conversation

@thymikee

@thymikee thymikee commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Third R7 PR for #4937 (after #4976 and #4978). It declares the ten boot failure classifications as BOOT_FAILURE_REASONS rows in provision-kit/boot-diagnostics, which every boot producer already loads.

  • BootFailureReason derives from the rows.
  • classifyBootFailure, bootFailureHint, the Android emulator path and the iOS simulator retry path read the table.
  • apple-runner loads provision-kit only through its host port. So runner-lease's IOS_RUNNER_OWNED_BY_OTHER_DAEMON checks its literal against the derived type with satisfies, and its startup paths keep their literals, which are already typed as BootFailureReason.
  • The infrastructure subset in contracts/boot-failure stays a name list: contracts sits below provision-kit and cannot read the table.

Value

Measure base head
Documented boot failure reasons 0 10
Reason table rows 464 474
R89 untyped reason sites 58 58

The R89 site count does not change, because the scan still counts runner-lease's literal checked with satisfies.

Before / after

No observable change. Wire spellings stay byte-identical.

Validation

Head c62ccb8: typecheck, oxlint, format, generate:reasons, the repo guards, the eager-closure gate, wire-compat and fallow audit (0 issues) pass. Tests pass for provision-kit, platform-android, platform-apple core, apple-runner and replay-port (about 4,300 tests).

🤖 Generated with Claude Code


Get evidence
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

Declares the ten boot failure classifications as BOOT_FAILURE_REASONS rows
in provision-kit boot-diagnostics, which every boot producer loads.
BootFailureReason derives from the rows; the classifier, hints, Android
emulator and iOS simulator paths read the table, and the Apple runner lease
checks its literal against the derived type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.53 MB 6.53 MB +703 B
Package (unpacked) 6.53 MB 6.53 MB +703 B
Package (download) 1.99 MB 1.99 MB +96 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 21.3 ms 20.1 ms -1.3 ms
CLI --help 42.8 ms 44.6 ms +1.8 ms

@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

The code at c62ccb8 looks correct, and CI is green at this head (the two superseded 'Body rules' runs were cancelled). No conflicts. No live device run is on record. The diff swaps literals for row properties on the iOS simulator boot, Android emulator boot and runner startup paths, and unit tests cover those through the real classifier, so a device run does not look required. Not verified here: the test, guard and count claims were taken from the green CI at this head, not rerun locally.

Not blocking, and these can be taken or left: (1) boot-diagnostics.ts:8 declares the table in provision-kit, but contracts is the lowest package every producer depends on, and contracts/src/boot-failure.ts already owns the infrastructure subset, so the strings now live in two packages and runner-lease.ts keeps one literal with a satisfies. #4937 R7 asks for the lowest contract package and every producer moved in the same PR. (2) contracts/src/boot-failure.ts:1: BootFailureReason now derives from the rows, but INFRASTRUCTURE_BOOT_FAILURE_REASONS is still a hand-written list that nothing checks against them, so a typo there would silently change isInfrastructureBootFailureReason with no compile or test failure. The export type { InfrastructureBootFailureReason } in boot-diagnostics.ts has no importer. (3) Three new row descriptions are slightly narrow in the generated docs: IOS_RUNNER_CONNECT_TIMEOUT also covers xcodebuild exiting early, CI_RESOURCE_STARVATION_SUSPECTED also matches a killed process, and ANDROID_BOOT_TIMEOUT is also published for any adb command timeout. The hints still lead callers to a fix that works. Rewording those rows and rerunning pnpm generate:reasons would close it.

Could the table instead live in packages/contracts/src/boot-failure.ts, with both BootFailureReason and InfrastructureBootFailureReason derived there, provision-kit importing it, and runner-lease.ts reading BOOT_FAILURE_REASONS.iosRunnerOwnedByOtherDaemon.reason? That removes the satisfies line and its comment, the separate hand-written subset and the one unmoved producer, with the same 10 rows and docs page, and likely fewer production lines than +71/-31. Contracts already hosts 30+ ReasonTables, so no ADR looks needed.

Nothing blocks merge. The maintainer decision is whether to move the table to contracts or accept provision-kit with the lease literal.

thymikee and others added 2 commits November 22, 2026 21:07
…ures

* origin/main:
  refactor(types): drop branches and assertions the types already exclude (#4975)
  refactor(reasons): declare the durable capture outcomes in ReasonTable rows (#4978)
  feat(harmonyos): verify foreground after open instead of trusting the launch line (#4293)
  fix(remote): give each session its own saved-connection file (#4925)
… to them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Addressed in 4ab43df, which also merges main:

  • Row text (3): IOS_RUNNER_CONNECT_TIMEOUT now includes xcodebuild exiting before the runner is ready. CI_RESOURCE_STARVATION_SUSPECTED includes a killed boot process. ANDROID_BOOT_TIMEOUT includes an adb command timing out during boot. The page is regenerated.
  • Subset (2): a provision-kit test lists all ten spellings typed as BootFailureReason, so a spelling no row declares does not compile. It asserts that isInfrastructureBootFailureReason accepts exactly the seven infrastructure reasons and rejects the other three, so a typo in the contracts list now fails a test. I dropped the unused InfrastructureBootFailureReason re-export.
  • Table in contracts (1): I tried it, with BootFailureReason and the subset derived in contracts/boot-failure.ts and runner-lease plus the runner startup reading the row. The eager-closure gate refused it. contracts/boot-failure.ts is not in the closures of platform-android/mechanics, the platform-apple app-lifecycle, doctor and runner-operations facades, or apple-runner/index at the merge-base, and every route to the table (through boot-diagnostics, or directly) adds it. Provision-kit is the module those producers already load, so the table stays there and runner-lease keeps its satisfies literal.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 4ab43df

Since the review of c62ccb8: 0 new · 0 still open · 0 no longer raised

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (098c1780b9e5).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

The code looks good at 4ab43df, and the earlier evidence request is now satisfied. CI is green: 21 checks, none failing. Not verified here: the eager-closure gate refusal for a contracts-hosted table was not rerun, and tests and gates were not run locally. Nothing else needs to happen before merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 22, 2026
@thymikee
thymikee merged commit 7506fec into main Nov 23, 2026
21 checks passed
@thymikee
thymikee deleted the refactor/r7-boot-failures branch November 23, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant