Skip to content

fix: type-check clean against the 2.1.332 hooks API - #57

Open
ralphstodomingo wants to merge 1 commit into
mainfrom
fix/hooks-type-check
Open

ralphstodomingo wants to merge 1 commit into
mainfrom
fix/hooks-type-check

Conversation

@ralphstodomingo

Copy link
Copy Markdown
Contributor

tsc -p plugins/altimate-code --noEmit goes from 10 errors to 0 against the hooks API that Claude Code 2.1.332 declares. To get those types, load the plugin in a 2.1.332 session; it writes .claude-plugin/types/. The repo's CI runs only tests/*.sh, so nothing caught these.

Changes

  • hooks/feedback.ts: 2.1.332 types session.info().platform as optional, since a hook that answers session.info whole may leave it out. collectFacts now checks it for undefined before OS.has. No user-visible change: an undefined platform already gave unknown, because Set.has(undefined) is false.
  • Tests only:
    • (globalThis as any).setTimeout in features/cost.test.tsx and features/runs.test.tsx, as health.test.tsx already does, since the hook environment declares no setTimeout.
    • URLSearchParams.forEach in place of .keys(), which the environment doesn't declare.
    • A block body for onCall in health.test.tsx.
    • argv! in usage.test.tsx.
    • argv[0]?. and a FoundElement annotation in dbt-mods.test.tsx.

Checks

  • tsc -p plugins/altimate-code --noEmit on 2.1.332's types: 0 errors (10 on main).
  • claude plugin validate --strict . and claude plugin validate --strict ./plugins/altimate-code: both pass.
  • bash tests/*.sh: all 8 pass.
  • claude plugin test plugins/altimate-code on 2.1.332: 1481 pass, 2 fail. Both failures are the same on main without this change, on 2.1.332 and 2.1.322:
    • features/cost.test.tsx "a line with a great many dbt calls is not read call by call": its assertions pass, and the 10 s wall-clock bound comes out at 11 to 12 s on a quiet Linux machine.
    • features/runs.test.tsx "a dbt call that starts while another call reads its artifact: the first is left out, the later one is recorded": stored.get("runs") is undefined, so the later call isn't recorded. It passes at 2017923, where it was added, and first fails at e06c39b. That commit bounds the cost gate's session.cwd() wait at 80 ms; since 1c80847 the runs tests run with the cost feature on. I've left it alone here: whether a real session can hit it, or only the test's host, is a call for someone who knows the gate.

Internal only: no changelog entry or version bump.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BXxzvqLZuTJdDJ1Ku2ZMDY

- `collectFacts` checks the platform for undefined before `OS.has`: 2.1.332 types it optional. An undefined platform already gave `unknown`.
- Tests: `(globalThis as any).setTimeout` as elsewhere, `URLSearchParams.forEach` for the keys, a block body for `onCall`, a non-null `argv`, an optional `argv[0]`, and a `FoundElement` annotation

`tsc -p plugins/altimate-code` gives 0 errors on 2.1.332's types (10 before).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXxzvqLZuTJdDJ1Ku2ZMDY
@ralphstodomingo ralphstodomingo self-assigned this Nov 30, 2026
@ralphstodomingo
ralphstodomingo marked this pull request as ready for review November 30, 2026 10:41
@ralphstodomingo

ralphstodomingo commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Review log: claims and residuals

Claims (each can be violated by a concrete trace):

  • C1. collectFacts (hooks/feedback.ts) gives the same os as main for every session.info() answer. A platform in OS comes back as itself. Anything else comes back as unknown: a missing platform, unknown, a platform not in OS, or a failed call. The edit is the only change to shipped code.
  • C2. Every test asserts what it asserted on main. The test edits change only typing: (globalThis as any).setTimeout for setTimeout, URLSearchParams.forEach for .keys(), a block body for onCall, argv!, argv[0]?., and a FoundElement annotation.
  • C3. tsc -p plugins/altimate-code --noEmit reports 0 errors against the declarations Claude Code 2.1.332 writes to .claude-plugin/types/.

Disclosed residuals (accepted; instances are not findings):

  • R1. Two plugin tests fail on main and still fail here; this PR doesn't touch them. One is features/cost.test.tsx's 10 s wall-clock bound. The other is the features/runs.test.tsx overlapping-call case, which has failed since e06c39b.
  • R2. .claude-plugin/types/ isn't in the repo (the engine writes it), so C3 holds only once a 2.1.332 session has loaded the plugin. CI doesn't run tsc.

Rounds:

  • Codex round 1 on 1476acf: no findings.
  • Kilo on 1476acf: share the platform list with usage.ts (a cleanup that breaks no claim). Declined for a follow-up.

@ralphstodomingo

Copy link
Copy Markdown
Contributor Author

@codex review against the numbered claims and the disclosed residuals in the review-log comment on this PR: report only a reproducible trace that violates a numbered claim. Instances of the disclosed residuals are not findings. A round with no claim violation ends review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T10:44:58.607003Z 1476acf Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

$.session
.info()
.then(info => (OS.has(info.platform) ? info.platform : 'unknown'))
.then(info => (info.platform !== undefined && OS.has(info.platform) ? info.platform : 'unknown'))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: The platform → OS-name mapping is now duplicated.

OS on line 318 is a second copy of the identical set in usage.ts:36, and usage.ts:104 already performs this same mapping (platform && OS.has(platform) ? platform : 'unknown'). This file already imports from ./usage, so one exported helper there (for example osOf($)) could own the accepted-platform list and the 'unknown' fallback for both call sites, so the two copies cannot drift apart when a platform is added.

The guard itself is correct and behaviour-preserving: an undefined platform already produced 'unknown'.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this for a follow-up. This PR only makes the type check pass, and the guard here is the same one usage.ts:104 already uses, as you note. Moving the platform list into one helper changes two call sites in shipped code, which is a cleanup Harish may want to shape himself.

@kilo-code-bot

kilo-code-bot Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/feedback.ts 352 Platform → OS-name mapping and the OS allow-list are now duplicated between feedback.ts and usage.ts; one exported helper would keep them in sync.
Files Reviewed (7 files)
  • plugins/altimate-code/hooks/feedback.ts - 1 suggestion
  • plugins/altimate-code/hooks/feedback.test.tsx - no issues
  • plugins/altimate-code/hooks/health.test.tsx - no issues
  • plugins/altimate-code/hooks/usage.test.tsx - no issues
  • plugins/altimate-code/hooks/dbt-mods.test.tsx - no issues
  • plugins/altimate-code/hooks/features/cost.test.tsx - no issues
  • plugins/altimate-code/hooks/features/runs.test.tsx - no issues

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash-1017 · Input: 36.7K · Output: 12.5K · Cached: 598.9K

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 1476acf4d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant