fix(ui): resolve backend-workspace typecheck break in apps/gittensory-ui - #3710
Conversation
apps/gittensory-ui/src/lib/registration-workspace.ts imports directly from src/signals/focus-manifest.ts, pulling backend code into the UI's own separate tsconfig — which never loaded worker-configuration.d.ts or src/env.d.ts, so every transitively-reached Env usage failed to resolve. Main's CI has been red since commit d333463 (bisected against main's own CI run history) with this exact failure, blocking every open PR's validate-code check. Fixes: - Include worker-configuration.d.ts + src/env.d.ts in the UI's own tsconfig so Env resolves fully (both ambient-global files merge into one Env interface; including only one left most fields missing). - error-capture.ts: explicitly type the addEventListener callbacks — the newly-visible Workers-runtime global addEventListener overload (keyed by WorkerGlobalScopeEventMap, which has no "unhandledrejection") collided with DOM's overload for that one call site, widening the inferred parameter to implicit any. - crypto.ts / orb/relay.ts / review/visual/shot.ts: cast a handful of Uint8Array values to Uint8Array<ArrayBuffer> at their Web Crypto / Response call sites. These buffers are never actually SharedArrayBuffer-backed; DOM's BufferSource/BodyInit types (only reachable from the UI's own DOM-lib tsconfig) exclude SharedArrayBuffer from the wider ArrayBufferLike default, which the backend's non-DOM tsconfig doesn't. Deliberately local casts, not signature changes — narrowing the function signatures themselves broke the root tsconfig's own typecheck the opposite way (its crypto.getRandomValues typing doesn't narrow to plain ArrayBuffer the way DOM's does).
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 1e29103 | Commit Preview URL Branch Preview URL |
Jul 06 2026, 05:28 AM |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-06 05:28:58 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 6 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3710 +/- ##
=======================================
Coverage 93.36% 93.36%
=======================================
Files 315 315
Lines 32204 32204
Branches 11812 11812
=======================================
Hits 30066 30066
Misses 1507 1507
Partials 631 631
🚀 New features to boost your workflow:
|
Summary
Main's CI has been red on
validate-codesince commit d333463 (bisected directly against main's own CI run history:c4c977bawas the last green run,d3334632the first red one, every commit since has stayed red), blocking every open PR — including PRs that never touched anything related to this.Root cause:
apps/gittensory-ui/src/lib/registration-workspace.tshas a long-standing import reaching directly into the backend —import { isFocusManifestPublicSafe } from "../../../../src/signals/focus-manifest". This pullsfocus-manifest.tsand its transitive dependencies into the UI package's own, separatetsconfig.json, which never loadedworker-configuration.d.tsorsrc/env.d.ts(the two files that together declare the globalEnvinterface). Every backend file that transitively referencesEnvfailed to resolve it under the UI's compile unit.Fix
apps/gittensory-ui/tsconfig.json: addworker-configuration.d.tsandsrc/env.d.tstoinclude. Both usedeclare global { interface Env {...} }and merge into one complete type — including only one left most fields missing (confirmed by testing each addition independently).apps/gittensory-ui/src/lib/error-capture.ts: explicitly type twoaddEventListenercallback parameters. Loadingworker-configuration.d.tsalso introduces a global Workers-runtimeaddEventListeneroverload (keyed byWorkerGlobalScopeEventMap, which has no"unhandledrejection"key) that collided with DOM's own overload for that one call site, widening the inferred parameter toany.src/utils/crypto.ts,src/orb/relay.ts,src/review/visual/shot.ts: cast a handful ofUint8Arrayvalues toUint8Array<ArrayBuffer>at their exact Web Crypto /Responsecall sites. These buffers are never actuallySharedArrayBuffer-backed; DOM'sBufferSource/BodyInittypes (only reachable once the UI's DOM-lib tsconfig transitively reaches these files) excludeSharedArrayBufferfrom the widerArrayBufferLikedefault that a bareUint8Arrayannotation carries.salt: Uint8Array<ArrayBuffer>), but that broke the root tsconfig's own typecheck in the opposite direction — the root config's owncrypto.getRandomValuestyping (fromworker-configuration.d.ts, no DOM lib) doesn't narrow its return type to plainArrayBufferthe way DOM's does, so a stricter parameter type rejected values that were previously accepted. Local casts avoid the ripple entirely.Validation
npx tsc --noEmit(root) clean.npx tsc --noEmitinsideapps/gittensory-ui— clean (was the failing job; verified with a realnpm ci, not just a partial local check).npx vitest run) — including the specific test files covering every touched function (crypto.test.ts,crypto-secret.test.ts,crypto-jwt.test.ts,orb-relay-policy.test.ts,visual-shot.test.ts,integration/orb-relay.test.ts, 122 tests total), confirming the casts are purely type-level with zero runtime behavior change.git diff --checkclean.npm audit --audit-level=moderate— 0 vulnerabilities.No linked issue — this isn't a feature, it's restoring main to green.