Skip to content

refactor(types): drop branches and assertions the types already exclude - #4975

Merged
thymikee merged 1 commit into
mainfrom
refactor/type-coverage-cleanup
Nov 22, 2026
Merged

thymikee merged 1 commit into
mainfrom
refactor/type-coverage-cleanup

Conversation

@thymikee

@thymikee thymikee commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Removes code the type checker already proves redundant. No behavior change.

  • C7: multiTouchRefusalSubject indexes the total Record<AppleOS, string> directly. The touch result extras read result.target without re-checking its kind. warns && judged and two device.kind ? checks on a required DeviceKind are gone.
  • C6: SessionAction.positionals and .flags are required, so the ?. and ?? [] / ?? {} guards on them are dropped.
  • C8: no-op type assertions and ! on non-optional members removed, as listed by type-aware lint (no-unnecessary-type-assertion).

Skipped: C7.3 (--out branches in validateObservationPerfFlags) is unreachable only through a parser invariant in another module, not through types, and a reader test pins it. Reason-related casts are untouched.

Value

Measured on the diff against origin/main:

  • Files: 46. Lines: +122 / −142 (net −20).
  • Guards on positionals / flags: 70 removed lines, 3 added.
  • Type and non-null assertions: 44 removed lines, 1 added.

Validation

  • Tested head: 2074cc5. pnpm typecheck passes.
  • Focused vitest over the touched packages passes (4003 tests in the first batch).
  • oxlint on touched files is clean. pnpm format is applied.
  • fallow audit --base origin/main reports no issues. check:daemon-wire-compat passes.
  • No test was removed.

🤖 Generated with Claude Code

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

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.52 MB 6.52 MB -418 B
Package (unpacked) 6.52 MB 6.52 MB -418 B
Package (download) 1.99 MB 1.99 MB -111 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 17.3 ms 17.9 ms +0.6 ms
CLI --help 38.8 ms 37.6 ms -1.3 ms

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 2074cc5

No open findings.

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

💬 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

This PR is ready at 2074cc5. The guards and casts it removes trace back to types that already exclude those cases, and the review found no code problem. Not blocking: buildSafeActionFlags in session-event-action.ts still casts action.flags to Record<string, unknown>; this cast changes the type, so leaving it is fine, and passing the flags directly would only work if projectSafeFlags accepts Partial<CommandFlags>. These notes can be taken or left. CI passes except three Body rules jobs (one failed, two cancelled), which check the PR body and not the code, and the diff touches no body-rule files. No conflicts. Before merge, the Body rules check needs to pass; read its log for the failed rule and edit the PR body to match. Not verified here: typecheck, tests and lint were not run locally, and the exact Body rules failure was not seen.

@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 098c178 into main Nov 22, 2026
21 of 24 checks passed
@thymikee
thymikee deleted the refactor/type-coverage-cleanup branch November 22, 2026 19:21
thymikee added a commit that referenced this pull request Nov 22, 2026
…asons

* 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)

# Conflicts:
#	packages/kernel/src/errors.ts
#	src/platform-runtime-gateway.ts
thymikee added a commit that referenced this pull request Nov 22, 2026
…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)
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