Skip to content

🩼 fix: Keep OpenRouter Category Override Test Type-Safe - #16229

Merged
danny-avila merged 1 commit into
devfrom
lia/openrouter-attribution-typecheck
Sep 23, 2026
Merged

danny-avila merged 1 commit into
devfrom
lia/openrouter-attribution-typecheck

Conversation

@lia-by-librechat

Copy link
Copy Markdown
Contributor

Summary

The OpenRouter category attribution change in #16228 merged before its TypeScript CI check finished. That check then failed with TS7053 because the new override test indexes configOptions.defaultHeaders as though it were always a plain record, but its type also allows Headers and header tuples. Check the same exact override using Jest's object matcher so the workspace typechecks without changing runtime attribution or the test's intended assertion.

How it works

- expect(result.configOptions?.defaultHeaders?.['X-OpenRouter-Categories']).toBe('general-chat');
+ expect(result.configOptions?.defaultHeaders).toMatchObject({
+   'X-OpenRouter-Categories': 'general-chat',
+ });

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • node scripts/static-checks.mts --against origin/dev --only prettier,imports
  • git diff origin/dev...HEAD --check
  • The original attribution PR's GitHub CI passed its API Jest shards, build, static checks, integration tests, and Lighthouse, but TypeScript failed on the expression removed here. This PR reruns the CI typecheck against the correction. Local Jest/typecheck could not run because the shared local node_modules is missing dependencies and @types definitions.

Test Configuration:

  • Dev-based worktree; no runtime behavior changes.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes (local install is incomplete; CI verifies)

@lia-by-librechat

Copy link
Copy Markdown
Contributor Author

Review handoff for head e2ebc2dfb5247ab53bff81a362f9c90d051a2d97: #16228 merged before its TypeScript check finished; TS7053 comes from indexing the defaultHeaders union in the new override assertion. This PR changes only that assertion to toMatchObject, preserving the checked header value and runtime behavior. CI will verify the TypeScript check on this exact head.

@danny-avila
danny-avila merged commit 7ea6148 into dev Sep 23, 2026
28 checks passed
@danny-avila
danny-avila deleted the lia/openrouter-attribution-typecheck branch September 23, 2026 03:07
KinseyD pushed a commit to KinseyD/LibreChat that referenced this pull request Sep 24, 2026
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.

2 participants