Skip to content

@opensaas/stack-rag exports two different ChunkingStrategy unions from its root and /runtime entry points #1374

Description

@borisno2

The problem

@opensaas/stack-rag exports two different types under the same name:

  • packages/rag/src/config/types.ts:5ChunkingStrategy = 'none' | 'recursive' | 'sentence' | 'sliding-window', exported from the package root.
  • packages/rag/src/runtime/chunking.ts:6ChunkingStrategy = 'recursive' | 'sentence' | 'sliding-window' | 'token-aware', exported from @opensaas/stack-rag/runtime.

Each carries a strategy?: ChunkingStrategy option on its own config type, so 'none' is accepted by the plugin config and rejected by chunkText, while 'token-aware' is the reverse. A user who reads one and passes it to the other gets a compile error for a value the package itself documents.

Provenance

Found during the review of PR #1324, whose shadowing check compares a documented redeclaration against the package's export of the same name. A block documenting the runtime union was reported as contradicting the package because the checker resolved the root one first. The checker is being fixed to key by specifier; the underlying inconsistency is a package defect and is filed here.

What to do

Decide whether the two are one type or two. If one, export a single union and make both consumers accept it (mapping 'none' and 'token-aware' explicitly where a consumer cannot honour one). If two, rename one so the name no longer promises they agree, and say on each which side accepts which value.

Any change here needs a minor changeset on @opensaas/stack-rag and the RAG docs' chunking sections re-checked by the doc-block checker once #1324 lands.

Context


🤖 Generated with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions