fix: restore missing src/types/index.ts (measured: SDK bump does NOT fix the 145 drift errors) - #49
Conversation
…fig typing src/types/index.ts does not exist on origin/main, causing 3 TS2307 errors (device-flow.ts, config/manager.ts, output/index.ts) plus cascading TS18046 'unknown' errors — 5 errors total stemmed from this one gap. Recovered the exact type shapes from an unmerged historical commit (382adee, branch fix/remediation-af8a172e-5f3f12, PR #19 closed unmerged) and verified each field against current call-site usage: - DeviceAuthResponse / TokenResponse match every field device-flow.ts reads (verification_uri, user_code, verification_uri_complete, etc.) - WaveConfig matches waveConfigSchema in config/schema.ts exactly - OutputFormat matches the "table" | "json" | "yaml" union used everywhere Restoring WaveConfig as a real interface (not implicit any) surfaced one genuine new error: src/commands/config/index.ts's getNestedValue/ setNestedValue helpers were typed as Record<string, unknown>, which a nominal WaveConfig is not assignable to. Retyped both helpers' parameter as `object` (they already narrow via typeof/instanceof internally) since they are intentionally generic reflection utilities over arbitrary nested config paths — no `any`, no `@ts-ignore`, no loosened tsconfig. Verified: SDK pin bump (2.0.14 -> 2.1.3) was tested separately and does NOT reduce the ~145 API-surface-drift errors (148 -> 152, i.e. it makes things worse by breaking vitest's ambient types) — that group is left untouched pending a dedicated pass against the real 2.0.14 client surface. type-check: 148 -> 142 errors (all 3 TS2307 gone, zero new regressions introduced beyond the one WaveConfig assignability fixed above) build: passes (tsup transpiles without typechecking) test: 4 files / 11 tests passing
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
ⓘ Qodo reviews are paused because your workspace is out of credits. Ask your workspace admin to add credits to resume reviews. Manage billing |
There was a problem hiding this comment.
Sorry @yakimoto, this account has used its review budget of 2,500,000 diff characters for the last 7 days.
You can request another review in 2 hours and 1 minute by commenting @sourcery-ai review.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_1aab45b8-1a62-46a6-9cc2-3e4f0410e087) |
Reviewer's GuideRestores the missing shared type module with verified DeviceAuthResponse, TokenResponse, WaveConfig, and OutputFormat definitions, and updates configuration reflection helpers to work with the nominal WaveConfig type. Type-check errors drop from 148 to 142, while build and tests pass; the remaining SDK API-surface drift is intentionally out of scope and dependency pins are unchanged. Flow diagram for restored type-checking pathflowchart LR
Imports["Device flow, config manager, output imports"] --> Types["src/types/index.ts restored"]
Types --> Typed["DeviceAuthResponse, TokenResponse, WaveConfig, OutputFormat"]
Typed --> Reflection["getNestedValue / setNestedValue accept object"]
Reflection --> TypeCheck["Type-check errors: 148 → 142"]
Types --> Build["npm run build passes"]
Types --> Tests["npm run test passes"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. 📜 Recent review details⏰ Context from checks skipped due to timeout. (3)
🔇 Additional comments (2)
📝 SummarySummary by CodeRabbit
WalkthroughThe change adds exported TypeScript types for authentication, configuration, and output formats. It also updates configuration helper parameter types and adds explicit casts for indexed access. Runtime behavior remains unchanged. ChangesConfiguration and Type Definitions
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This restores exported SDK type contracts and adjusts internal helper typing without changing runtime behavior. No current merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — This is a narrowly scoped type-only restoration and annotation correction; the added declarations and casts are erased from the production bundle, while existing configuration, authentication, and output behavior remain unchanged. Both modified files are within the author's ownership area. Not approved because:
Review your spending limits in Billing settings. You can add or adjust custom eligibility rules. Learn more. |
|
Note Automatic reviews are paused because your team has used its included automatic processing for this billing period (headroom scales with your seat count). You can still comment "Gitar review" to run one anytime, and automatic reviews resume on their own by October 1. Add seats for more headroom. Code Review ✅ ApprovedRestores the missing OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
The two-experiment numbers (measured, not guessed)
Baseline on
origin/main(5899f5b),npm ci --include=dev && npm run type-check:148 errors, split into ~145 SDK-API-surface-drift errors across
src/commands/**/index.tsand 3
TS2307: Cannot find module '../../types/index.js'errors.Experiment:
npm install --no-save @wave-av/sdk@2.1.3 --@wave-av:registry=https://registry.npmjs.org/(the repo's scoped registry config points
@wave-avat GitHub Packages, which 404s on thispackage — had to force the public npm registry for the one-off install) then
npm run type-check:152 errors. A line-by-line diff of the two error lists shows the bump fixed zero of the
145 original SDK-drift errors and added 4 new ones (
Cannot find module 'vitest'— thereinstall perturbed vitest's ambient type resolution as a side effect). Net: strictly worse.
Decision (per the brief's own rule): the count did not drop, so the pin is NOT the cause. Did
not bump it.
package.jsonandpackage-lock.jsonare untouched by this PR — no collisionwith PR #47 which also touches
package.json. The 145 SDK-drift errors need call-site fixesagainst the currently-pinned
2.0.14client surface, which is a much larger, separate pass (see"What remains red" below) — not attempted here to keep this PR reviewable and avoid guessing at
35 files of unfamiliar SDK surface under time pressure.
Task 2 — the 3 missing-module errors (fixed)
src/types/index.tsdoes not exist onorigin/mainat all, but an unmerged commit(
382adee, branchorigin/fix/remediation-af8a172e-5f3f12, was part of PR #19 which was closedwithout merging) contains exactly this file. I read all three importing files
(
src/lib/auth/device-flow.ts,src/lib/config/manager.ts,src/lib/output/index.ts) andverified every field that commit's version of the file exports is actually used, and used
consistently, at every call site:
DeviceAuthResponse/TokenResponse— every field device-flow.ts reads(
verification_uri,user_code,verification_uri_complete,device_code,interval,expires_in,access_token, etc.) is present and correctly typed.WaveConfig— matcheswaveConfigSchemainsrc/lib/config/schema.tsfield-for-field(version, currentProject, projects, defaults, telemetry).
OutputFormat— matches the"table" | "json" | "yaml"union used throughoutoutput/.Recreated
src/types/index.tswith this verified content rather than guessing or stubbingany.Restoring
WaveConfigas a real nominal type (instead of an implicitanyfrom the unresolvedmodule) surfaced one genuine new error:
src/commands/config/index.ts'sgetNestedValue/setNestedValuehelpers were typed asRecord<string, unknown>, and a nominalWaveConfiginterface (no index signature) is not assignable to that. These two functions are intentionally
generic reflection utilities that walk arbitrary dot-separated config paths — they already
narrow with
typeof/inchecks internally — so I retyped their parameters asobjectand castonly inside the function body where the reflective indexing actually happens. No
any, no@ts-ignore, no@ts-expect-error, notsconfig.jsonchanges.Results (measured)
npm run type-check: 148 → 142 errors. All 3TS2307errors gone. The 2 extra beyond"3 fixed" are cascading
TS18046 'X' is of type 'unknown'errors that only existed becauseTS treated the import as
anywhen the module couldn't resolve; fixing the module resolutionfixed those for free. One new, genuine error appeared (the
WaveConfig/Recordassignabilityabove) and was fixed in the same commit — net trace shows zero unaccounted regressions.
npm run build(tsup): passes, exit 0,dist/index.jsemitted (158.82 KB). This is thesame "which is exactly why version 1.0.8 shipped printing 1.0.0" mechanism named in the brief:
tsup transpiles without typechecking, so a source tree that fails
tsc --noEmitby 142 errorsstill builds and can still be published — the red type-check is invisible to the release
pipeline unless something gates on it explicitly.
npm run test(vitest): passes, 4 test files / 11 tests, 8.12s.What remains red, and why
142 errors remain, essentially all of the original ~145 SDK-API-surface-drift group, spread
across 35 files under
src/commands/**/index.ts(zoom, podcast, drm, audience, signage, stream,vault, studio, phone, notify, edge, search, distribution, creator, collab, voice, usb, slides,
sentiment, scene, prism, org, mesh, ghost, editor, desktop, connect, clips, chapters, captions,
analytics, ai, transcribe, qr, marketplace, fleet). Breakdown by error code: 119×
TS2339(property does not exist), 9×
TS2551(property does not exist, "did you mean X"), 8×TS2353(unknown object-literal property), 3×
TS2554(arg count mismatch), 2×TS2345, 1×TS2561.These are not left red out of avoidance — I checked whether they're a quick win. The
@wave-av/sdk@2.0.14.d.tssurface is 8,628 lines across the package; TS's "did you mean X"suggestions for the
TS2551cases (e.g.DistributionAPI.destinations→listDestinations,PhoneAPI.conferences→getConference) are not confirmed 1:1 renames — several look like alist-vs-single-item shape change (
conferencesplural vsgetConferencesingular), which meansblind-applying the suggestion risks silently changing behavior rather than fixing a typo. Fixing
this class correctly requires reading each command's business logic against the actual SDK
method signatures file-by-file, which is a legitimately separate, larger pass — not something to
rush through here per the "never silence, only real fixes" instruction. Confirmed via
git status --porcelainthat this PR touches exactlysrc/types/index.ts(new) andsrc/commands/config/index.ts(2-line type fix) — nothing else.Relation to the live 1.0.8-prints-1.0.0 defect
Confirms the brief's hypothesis directly:
npm run buildsucceeds with 148 (now 142) redtype-check errors because
tsupnever runstsc. Anything that silently drifted from the SDK'sreal shape — including whatever produced the version-string defect — ships anyway. This PR does
not add a type-check gate to CI (out of scope / owned by PR #46
VER-001, which is the actualfix for the version-surface defect and derives every version string from
package.json); itnarrows the type-check red count so that gate, whenever it lands, has less legacy debt to clear.
Peer-PR collision check (done before editing)
Checked
gh pr view --json filesfor all 4 open PRs before touching anything: #48 (release.ymllint-step removal), #47 (
package.json/package-lock.json/license files — LEGAL-001), #46(
src/cli.ts,src/cli.test.ts,src/commands/api/index.ts,src/lib/api-client.ts,src/lib/version.ts— VER-001), #45 (release.yml— trusted publishing). None of those fileswere in this PR's baseline error list (
src/commands/api/index.tshas zero type-check errors)and none overlap the two files this PR touches.
package.json/package-lock.jsonareuntouched here since the measurement showed bumping the SDK pin is not the right move — no
collision with #47 either.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Type-only restoration and narrow signature tweaks to generic config helpers; no runtime behavior or auth/data-path changes.
Overview
Restores the missing
src/types/index.tsmodule so imports in auth, config, and output resolve again. The file definesDeviceAuthResponse,TokenResponse,WaveConfig, andOutputFormatto match existing call sites and the config schema.In
src/commands/config/index.ts,getNestedValue/setNestedValuenow takeobjectinstead ofRecord<string, unknown>, with reflective indexing cast inside the body, so a nominalWaveConfigcan be passed without assignability errors.Reviewed by Cursor Bugbot for commit 0406bfe. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by Sourcery
Restore the shared type definitions and align configuration helpers with the typed configuration model without attempting the separate SDK API migration.
Bug Fixes:
Enhancements:
Tests: