[PR #1376] [MERGED] fix(staffml): unblock staffml-preview-dev type check + build #6503

Closed
opened 2026-04-21 22:22:48 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1376
Author: @profvjreddi
Created: 4/17/2026
Status: Merged
Merged: 4/17/2026
Merged by: @profvjreddi

Base: devHead: fix/staffml-preview-ts


📝 Commits (3)

  • 40957e3 fix(staffml): map @staffml/vault-types to workspace path in tsconfig
  • 53df5a3 fix(staffml): type adapter input as enriched VaultQuestion
  • ec99c5c fix(staffml): align ChainBadge wiring with corpus ChainInfo + analytics API

📊 Changes

4 files changed (+19 additions, -10 deletions)

View changed files

📝 interviews/staffml/src/app/practice/page.tsx (+1 -2)
📝 interviews/staffml/src/components/ChainBadge.tsx (+3 -3)
📝 interviews/staffml/src/lib/corpus-vault.ts (+13 -4)
📝 interviews/staffml/tsconfig.json (+2 -1)

📄 Description

Summary

staffml-preview-dev.yml has been failing its `Type check` step since the vault-architecture merge (#1348). Five TS errors, three root causes, all fixed here in atomic commits.

Root causes

  1. @staffml/vault-types unresolved — the shared types package at `interviews/staffml-vault-types/` was never wired into the staffml app. No tsconfig path, no workspace entry. Added tsconfig path mapping.
  2. Adapter read non-existent fields — `corpus-vault.ts:adapt()` reads `v.track`, `v.level`, `v.zone`, but the vault-types `Question` (correctly) omits these because classification is path-encoded (per `vault_cli/models.py` comment). Introduced a local `EnrichedVaultQuestion` type for the API-returned shape.
  3. ChainBadge + ChainInfo drift — `practice/page.tsx` passed `chainInfo.id` and `chainInfo.name` to ``, but `ChainInfo` exports `chainId` (not `id`) and has no `name`. `ChainBadge.tsx` also imported `trackEvent` but `analytics.ts` exports `track`.

Commits

  • `40957e3f0` — fix(staffml): map @staffml/vault-types to workspace path in tsconfig
  • `53df5a347` — fix(staffml): type adapter input as enriched VaultQuestion
  • `ec99c5c9b` — fix(staffml): align ChainBadge wiring with corpus ChainInfo + analytics API

Verification

Local against Node.js 20 + Next 15:

```
$ cd interviews/staffml
$ npm install → 217 packages, 0 vulnerabilities
$ npx tsc --noEmit → exit 0
$ npm test → Test Files 2 passed (2), Tests 34 passed (34)
$ npm run build → exit 0, 12 routes compiled
```

Out of scope

  • AnalyticsEvent union doesn't yet include `chain_badge_shown` / `chain_badge_clicked` — ChainBadge casts via `as any`. Adding those to the union is a small follow-up.
  • The `@staffml/vault-types` package is referenced via tsconfig path only, not as an installed workspace package. Proper pnpm-workspace wiring (per index.ts comment) remains a follow-up — tsconfig path is sufficient for the type-only imports here.

Test plan

  • CI `Type check` step passes
  • CI `Run tests` step passes
  • CI `Build StaffML` step passes
  • Dev-site deploy succeeds and the StaffML badge recovers

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1376 **Author:** [@profvjreddi](https://github.com/profvjreddi) **Created:** 4/17/2026 **Status:** ✅ Merged **Merged:** 4/17/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `fix/staffml-preview-ts` --- ### 📝 Commits (3) - [`40957e3`](https://github.com/harvard-edge/cs249r_book/commit/40957e3f0145101e036bfa251cc9ec5ef43c3709) fix(staffml): map @staffml/vault-types to workspace path in tsconfig - [`53df5a3`](https://github.com/harvard-edge/cs249r_book/commit/53df5a347ec143f906425ed3d451869a1ab11f7a) fix(staffml): type adapter input as enriched VaultQuestion - [`ec99c5c`](https://github.com/harvard-edge/cs249r_book/commit/ec99c5c9b1d267cd9d14659dd90a9fe879b5a60d) fix(staffml): align ChainBadge wiring with corpus ChainInfo + analytics API ### 📊 Changes **4 files changed** (+19 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `interviews/staffml/src/app/practice/page.tsx` (+1 -2) 📝 `interviews/staffml/src/components/ChainBadge.tsx` (+3 -3) 📝 `interviews/staffml/src/lib/corpus-vault.ts` (+13 -4) 📝 `interviews/staffml/tsconfig.json` (+2 -1) </details> ### 📄 Description ## Summary `staffml-preview-dev.yml` has been failing its \`Type check\` step since the vault-architecture merge (#1348). Five TS errors, three root causes, all fixed here in atomic commits. ## Root causes 1. **`@staffml/vault-types` unresolved** — the shared types package at \`interviews/staffml-vault-types/\` was never wired into the staffml app. No tsconfig path, no workspace entry. Added tsconfig path mapping. 2. **Adapter read non-existent fields** — \`corpus-vault.ts:adapt()\` reads \`v.track\`, \`v.level\`, \`v.zone\`, but the vault-types \`Question\` (correctly) omits these because classification is path-encoded (per \`vault_cli/models.py\` comment). Introduced a local \`EnrichedVaultQuestion\` type for the API-returned shape. 3. **ChainBadge + ChainInfo drift** — \`practice/page.tsx\` passed \`chainInfo.id\` and \`chainInfo.name\` to \`<ChainBadge>\`, but \`ChainInfo\` exports \`chainId\` (not \`id\`) and has no \`name\`. \`ChainBadge.tsx\` also imported \`trackEvent\` but \`analytics.ts\` exports \`track\`. ## Commits - \`40957e3f0\` — fix(staffml): map @staffml/vault-types to workspace path in tsconfig - \`53df5a347\` — fix(staffml): type adapter input as enriched VaultQuestion - \`ec99c5c9b\` — fix(staffml): align ChainBadge wiring with corpus ChainInfo + analytics API ## Verification Local against Node.js 20 + Next 15: \`\`\` $ cd interviews/staffml $ npm install → 217 packages, 0 vulnerabilities $ npx tsc --noEmit → exit 0 $ npm test → Test Files 2 passed (2), Tests 34 passed (34) $ npm run build → exit 0, 12 routes compiled \`\`\` ## Out of scope - AnalyticsEvent union doesn't yet include \`chain_badge_shown\` / \`chain_badge_clicked\` — ChainBadge casts via \`as any\`. Adding those to the union is a small follow-up. - The \`@staffml/vault-types\` package is referenced via tsconfig path only, not as an installed workspace package. Proper pnpm-workspace wiring (per index.ts comment) remains a follow-up — tsconfig path is sufficient for the type-only imports here. ## Test plan - [ ] CI \`Type check\` step passes - [ ] CI \`Run tests\` step passes - [ ] CI \`Build StaffML\` step passes - [ ] Dev-site deploy succeeds and the StaffML badge recovers --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-21 22:22:48 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#6503