Skip to content

chore: fix TypeScript + ESLint no-redeclare + add CI workflow - #4

Merged
jaschadub merged 1 commit into
mainfrom
chore/fix-type-check-and-lint
Apr 23, 2026
Merged

chore: fix TypeScript + ESLint no-redeclare + add CI workflow#4
jaschadub merged 1 commit into
mainfrom
chore/fix-type-check-and-lint

Conversation

@jaschadub

Copy link
Copy Markdown
Contributor

Summary

Brings `npm run type-check`, `npm run build --workspaces`, and a new `.github/workflows/ci.yml` to a clean, green state. Fixes 16 long-standing TypeScript errors, unblocks the ESLint `no-redeclare` false-positive on the `@symbi/types` enum-like pattern, and wires CI for the repo (which had no workflows at all).

TypeScript fixes

`MarkdownMemoryStore` (1 error)

Narrow `currentSection` to the `'facts' | 'procedures' | 'learned_patterns'` union so indexing `ctx[currentSection]` is type-safe without casting.

`SkillScanner` (1 error)

Drop a bogus `as const` on an enum member reference.

Qdrant client (13 errors)

Align `CollectionManager`, `SearchEngine`, and `VectorOperations` with the qdrant-js 1.15.1 API surface:

  • `optimizer_config` → `optimizers_config` in `createCollection`
  • `getCollection` no longer returns `name`; use caller-supplied `collectionName`. Widen `status` (`"grey"` → `"red"`) and `optimizer_status` (`{error: string}` → `"error"`) to match our stricter `CollectionInfo` schema. Map `response.config` defensively through optional fields.
  • `createAlias` / `deleteAlias` removed from `QdrantClient`; rewrite to use `updateCollectionAliases({actions: [{create_alias|delete_alias}]})`.
  • `search({vector: {id}})` no longer supported; implement `searchByPointId` as retrieve-then-search.
  • `recommend` positive/negative now take IDs directly (`string | number` or raw vectors), not `{id}` wrappers.
  • `discover` renamed to `discoverPoints`; flatten context pairs; target accepted bare.
  • `VectorOperations.getPoint` / `scrollPoints`: narrow `point.id` through `String()`, `point.vector` through `Array.isArray`, cast payload through `Record<string,unknown>|undefined`; stringify `next_page_offset` when present.

All existing qdrant unit tests updated to match the new mock call shapes.

ESLint fixes

  • Add jest globals (`expect`, `test`, `describe`, `beforeEach`) plus `NodeJS` and `BufferEncoding` type globals. Brings error count from ~130 to ~43.

  • Turn off both `no-redeclare` and `@typescript-eslint/no-redeclare` in TS files. TypeScript already catches real redeclares at compile time, and both rules false-positive on the value+type enum-like pattern used throughout `@symbi/types`:

    ```ts
    export const WebhookProviderType = { ... } as const;
    export type WebhookProviderType = typeof WebhookProviderType[keyof typeof WebhookProviderType];
    ```

Remaining 43 lint errors are pre-existing unused-imports and `no-case-declarations` in CLI / tests — out of scope for this change, tracked as incremental cleanup.

CI workflow

New `.github/workflows/ci.yml`:

  • test job — matrix on Node 18 / 20 / 22:
    1. `npm ci`
    2. `npm run build --workspaces`
    3. `npm run type-check`
    4. `npm run lint --workspaces --if-present` (non-blocking; pre-existing debt)
    5. `npx vitest run`
  • build-artifact job (after test passes): packs each workspace package with `npm pack` plus the root package, uploads as a PR artifact so reviewers can spot publish-shape regressions.
  • `concurrency` cancels in-progress runs when a branch is re-pushed.

Test plan

  • `npm run type-check` — 0 errors (was 16)
  • `npm run build --workspaces` — all 9 packages build cleanly
  • `npx vitest run` — 1082/1082 tests pass across 35 files
  • `npx eslint packages/types/src/webhook.ts` — clean (was 2 no-redeclare errors)

Brings `npm run type-check` and `npm run build --workspaces` to a clean
state from ~16 long-standing TS errors, updates the ESLint config so
the TS value+type-namespace enum-like pattern stops flagging as
redeclares, and wires a CI workflow for the repo (which previously had
no .github/workflows/ at all).

Type-check fixes:

- MarkdownMemoryStore.parseMarkdown: narrow `currentSection` to the
  `ListSection` union so indexing `ctx[currentSection]` is type-safe
  without casting.
- SkillScanner: drop a bogus `as const` on an enum reference.
- Qdrant CollectionManager/SearchEngine/VectorOperations: align with
  the qdrant-js 1.15.1 API surface —
  - `optimizer_config` → `optimizers_config` in createCollection
  - `getCollection` no longer returns `name`; use caller-supplied
    collectionName; widen status ("grey" → "red") and optimizer_status
    ({error:string} → "error") to match our stricter CollectionInfo
    schema; map response.config defensively through optional fields
  - `createAlias` / `deleteAlias` removed from QdrantClient; rewrite
    to use `updateCollectionAliases({actions: [{create_alias|delete_alias}]})`
  - `search({vector: {id}})` no longer supported; implement
    `searchByPointId` as retrieve-then-search
  - `recommend` positive/negative now take IDs directly
    (`string | number` or raw vectors), not `{id}` wrappers
  - `discover` renamed to `discoverPoints`; flatten context pairs;
    target accepted bare
  - VectorOperations.getPoint/scrollPoints: narrow `point.id` through
    String(), `point.vector` through Array.isArray, and cast payload
    through `Record<string,unknown>|undefined`; stringify
    `next_page_offset` when present

All existing qdrant unit tests updated to match new mock call shapes
(CollectionManager alias/getInfo; SearchEngine searchByPointId/recommend/discover).
Tests: 1082/1082 pass across 35 files.

ESLint config:

- Add jest globals (expect/test/describe/beforeEach) plus NodeJS and
  BufferEncoding type globals, bringing ESLint error count from ~130 to
  ~43 (remaining are pre-existing unused-imports and no-case-declarations
  out of scope for this change).
- Turn off `no-redeclare` and `@typescript-eslint/no-redeclare` in TS
  files — TypeScript already catches actual redeclares at compile
  time, and both rules false-positive on the standard value+type
  enum-like pattern used in @symbi/types (`export const X = {...} as
  const; export type X = typeof X[keyof typeof X]`).

CI workflow (.github/workflows/ci.yml):

- Matrix on Node 18/20/22
- Install → build workspaces → type-check → lint (non-blocking while
  pre-existing lint debt is cleaned up incrementally) → vitest
- Second job builds and uploads per-package tarball artifacts for
  every PR, so reviewers can spot publish-shape regressions
@jaschadub
jaschadub merged commit 81fcc14 into main Apr 23, 2026
2 of 4 checks passed
@jaschadub
jaschadub deleted the chore/fix-type-check-and-lint branch April 23, 2026 19:12
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