Skip to content

Remove Alliance defaults from core config#123

Merged
jonathanMLDev merged 6 commits into
cppalliance:mainfrom
jonathanMLDev:fix/require-pinecone-index-name
Jun 2, 2026
Merged

Remove Alliance defaults from core config#123
jonathanMLDev merged 6 commits into
cppalliance:mainfrom
jonathanMLDev:fix/require-pinecone-index-name

Conversation

@jonathanMLDev
Copy link
Copy Markdown
Collaborator

@jonathanMLDev jonathanMLDev commented Jun 1, 2026

Pull Request

Summary

Moves C++ Alliance deployment defaults (rag-hybrid, bge-reranker-v2-m3) out of generic core resolveConfig and into Alliance resolveAllianceConfig. Core now requires an explicit Pinecone index and treats rerank as opt-in; the published CLI and setupAllianceServer still apply Alliance defaults when env/CLI omit index/rerank, so API-key-only MCP configs are unchanged.

Completes the core/alliance config boundary started in Week 4 PR A. Blocks issue_01 (ServerContext refactor) — merge before that PR to avoid moving Alliance defaults twice.

Changes

File Change
src/core/config.ts Remove DEFAULT_INDEX_NAME / DEFAULT_RERANK_MODEL; throw if index missing; optional rerankModel; export trimOptional
src/core/index.ts Stop exporting removed constants
src/alliance/config.ts ALLIANCE_DEFAULT_INDEX_NAME, ALLIANCE_DEFAULT_RERANK_MODEL, real resolveAllianceConfig; remove applyAllianceRerankDefault
src/alliance/index.ts Export Alliance defaults + resolveAllianceConfig
src/index.ts CLI uses resolveAllianceConfig
src/alliance/setup.ts Fallback resolveAllianceConfig({}) when config omitted
src/core/server/config-context.ts JSDoc: Alliance apps pass config from resolveAllianceConfig
src/core/config.test.ts Throw on missing index; no core rerank default
src/alliance/config.test.ts Alliance defaults when env omits index/rerank
examples/alliance/.env.example Alliance deployment env template
examples/alliance/preset.ts ALLIANCE_INDEX_NAME, ALLIANCE_RERANK_MODEL for demos
examples/alliance/README.md CLI defaults + .env.example pointer
examples/alliance/library-embedding-demo.ts Comment: resolveAllianceConfig
.env.example Index required; rerank optional for core
README.md Core vs Alliance configuration table
docs/CONFIGURATION.md resolveConfig vs resolveAllianceConfig table
docs/MIGRATION.md Unreleased migration: core strict, Alliance CLI unchanged
CHANGELOG.md [Unreleased] breaking (core) + Alliance CLI note
src/cli.ts Help text documents Alliance CLI defaults
src/types.ts JSDoc: required index, optional rerank in core

Behavior

Path Index unset Rerank unset
Core resolveConfig / setupCoreServer Throws Missing Pinecone index name… Omitted → rerank disabled
Alliance CLI / resolveAllianceConfig rag-hybrid bge-reranker-v2-m3

Acceptance criteria

  • DEFAULT_INDEX_NAME removed from core (not exported from package root)
  • DEFAULT_RERANK_MODEL removed from core (not exported from package root)
  • Core resolveConfig: PINECONE_INDEX_NAME required with clear error
  • Core resolveConfig: no default rerank model when unset
  • Alliance resolveAllianceConfig: ALLIANCE_DEFAULT_* when env/CLI omit values
  • CLI and setupAllianceServer use resolveAllianceConfig
  • examples/alliance/.env.example + README core vs Alliance docs
  • Tests: core throw/optional-rerank; alliance default cases
  • CHANGELOG: breaking for core importers; Alliance CLI backward compatible

Breaking change (core only)

  • resolveConfig({ apiKey }) without indexName / PINECONE_INDEX_NAME throws.
  • Package root no longer exports DEFAULT_INDEX_NAME or DEFAULT_RERANK_MODEL.
  • Core embedders must set PINECONE_RERANK_MODEL (or rerankModel) to enable reranking.

Unchanged: MCP stdio / CLI with only PINECONE_API_KEY (Alliance resolver applies defaults).

Downstream

  • issue_01 (ServerContext): merge this PR first; config lives in resolveConfig / resolveAllianceConfig until singleton refactor.
  • issue_06 (split MCP instructions, suggest-flow on core): out of scope; separate PR.
  • No conflict with issue_04 (tests on other modules).

Test plan

  • npm run ci — typecheck, lint, format, build, test:coverage
  • npm run docs:link-check
  • Core: resolveConfig({ apiKey: 'x' }, { PINECONE_API_KEY: 'x' }) throws index error
  • Core: index set, no rerank env → cfg.rerankModel === undefined
  • Alliance: resolveAllianceConfig({ apiKey: 'x' }, { PINECONE_API_KEY: 'x' })rag-hybrid, bge-reranker-v2-m3
  • CLI smoke: PINECONE_API_KEY=… node dist/index.js logs Alliance index and rerank
  • Reviewer: README / CONFIGURATION core vs Alliance table is clear for third-party embedders

Checklist

  • Core/alliance boundary enforced in code, not docs only
  • [Unreleased] CHANGELOG updated
  • Migration notes in docs/MIGRATION.md
  • No secrets or local-only files included
  • CI green on PR branch

Related Issue

Summary by CodeRabbit

  • Breaking Changes

    • Pinecone index name is now required; startup will fail if omitted.
    • Reranking is opt-in; leave rerank model unset to disable reranking.
    • Package no longer exposes prior built-in default index/rerank constants.
  • Documentation

    • Updated configuration, migration, README, and changelog for v0.2.0 with new defaults and troubleshooting.
  • Examples

    • Alliance example env, presets, and demo samples updated to show Alliance defaults and usage.

@jonathanMLDev jonathanMLDev self-assigned this Jun 1, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

Warning

Review limit reached

@jonathanMLDev, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 36 minutes and 36 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 60afe7ab-c790-4abf-8a82-131b0b973300

📥 Commits

Reviewing files that changed from the base of the PR and between 323bf66 and fc78c6c.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • README.md
  • docs/MIGRATION.md
  • examples/alliance/.env.example
📝 Walkthrough

Walkthrough

Core resolveConfig now requires a trimmed non-empty Pinecone indexName and makes rerankModel optional. Alliance adds ALLIANCE_DEFAULT_INDEX_NAME / ALLIANCE_DEFAULT_RERANK_MODEL and delegates to core. CLI, exports, tests, docs, examples, and changelog updated to reflect the new contract.

Changes

Configuration Resolution and Defaulting

Layer / File(s) Summary
Core configuration contract: required indexName, optional rerankModel
src/core/config.ts, src/core/config.test.ts, src/core/index.ts
ServerConfig.rerankModel is optional; resolveConfig() trims inputs and throws when indexName is missing; trimOptional() exported; removed DEFAULT_INDEX_NAME/DEFAULT_RERANK_MODEL; tests updated for throw/omit behavior.
Alliance defaults and delegation
src/alliance/config.ts, src/alliance/config.test.ts, src/alliance/index.ts, src/alliance/setup.ts
Adds ALLIANCE_DEFAULT_INDEX_NAME='rag-hybrid' and ALLIANCE_DEFAULT_RERANK_MODEL='bge-reranker-v2-m3'; resolveAllianceConfig trims overrides/env, applies Alliance defaults when unset, then calls core resolveConfig; exports/tests/wiring updated.
CLI and entry point wiring
src/index.ts, src/cli.ts
Entry point and CLI now use resolveAllianceConfig for defaulting; help text and examples updated to document --index-name, --sparse-index-name, and --rerank-model and their env var counterparts.
JSDoc and constants
src/types.ts, src/constants.ts, src/core/server/config-context.ts
JSDoc updated to state required vs optional fields and resolver differences; SERVER_INSTRUCTIONS updated to mention required index + API key and Alliance defaults.

User Documentation and Examples

Layer / File(s) Summary
Environment and README updates
.env.example, README.md
Root .env.example now contains PINECONE_INDEX_NAME=your-index-name; README reworks configuration quick-reference, includes --index-name in examples, updates embedding demos, and adds “Missing Index Name” troubleshooting.
Alliance example files
examples/alliance/.env.example, examples/alliance/preset.ts, examples/alliance/README.md, examples/alliance/library-embedding-demo.ts
New Alliance .env.example with PINECONE_INDEX_NAME=rag-hybrid; preset.ts exports demo constants; Alliance README adds .env copy instruction; demo code switched to resolveAllianceConfig.
Configuration and migration docs
docs/CONFIGURATION.md, docs/MIGRATION.md
CONFIGURATION.md documents resolver precedence and a Core vs Alliance behavior table; MIGRATION.md adds guidance for core authors to set PINECONE_INDEX_NAME and to only set PINECONE_RERANK_MODEL when reranking is desired.
Changelog
CHANGELOG.md
Unreleased entry documents breaking core change: required indexName, removed default exports, rerank opt-in; Alliance CLI remains backward-compatible via its defaults.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • AuraMindNest
  • wpak-ai
  • whisper67265

🐰 A tidy config split, so clear and bright,
Alliance gets defaults, core stays tight;
No silent fallbacks to rag-hybrid land,
Each layer knows just where it stands.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the primary change: removing Alliance defaults from core config, which is the main objective of this PR.
Linked Issues check ✅ Passed The PR fully addresses all coding requirements from issue #118: removes DEFAULT_INDEX_NAME/DEFAULT_RERANK_MODEL from core, makes core require PINECONE_INDEX_NAME with error handling, makes rerankModel optional, implements ALLIANCE_DEFAULT_INDEX_NAME/ALLIANCE_DEFAULT_RERANK_MODEL, updates CLI/setupAllianceServer to use resolveAllianceConfig, and updates all tests/docs.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the core/alliance boundary separation objective: configuration handling, exports, CLI/setup wiring, tests, documentation, and examples. No unrelated modifications are present.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@b166af8). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #123   +/-   ##
=======================================
  Coverage        ?   81.47%           
=======================================
  Files           ?       38           
  Lines           ?     1306           
  Branches        ?      445           
=======================================
  Hits            ?     1064           
  Misses          ?      240           
  Partials        ?        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/MIGRATION.md (1)

3-5: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify version authority to match the new Unreleased migration section.

This intro still says the [0.2.0] changelog section is authoritative, but this document now adds an Unreleased migration block. Please update the intro so readers know whether to follow Unreleased vs 0.2.0 guidance for this page revision.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/MIGRATION.md` around lines 3 - 5, Update the opening paragraph in
MIGRATION.md to clarify which changelog section is authoritative for this
revision: state that if an "Unreleased" migration block exists in CHANGELOG.md
it takes precedence and should be followed, otherwise fall back to the [0.2.0]
section; reference the "Unreleased" heading and the "[0.2.0]" changelog entry by
name so readers know which guidance to apply.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/alliance/library-embedding-demo.ts`:
- Line 5: The docstring references resolveAllianceConfig(...) but the example
code still calls resolveConfig(...) and requires PINECONE_INDEX_NAME; update the
example so code and comment match by either (A) replacing resolveConfig(...)
with resolveAllianceConfig(...) and removing the hard dependency on
PINECONE_INDEX_NAME, or (B) changing the docstring to reference
resolveConfig(...) and keep the existing Pinecone requirement; ensure the used
symbol (resolveAllianceConfig or resolveConfig) is consistent in both the
comment and the code and that any environment variable requirements
(PINECONE_INDEX_NAME) reflect the chosen resolver's contract.

In `@src/alliance/config.ts`:
- Around line 29-33: The bug is that trimOptional is applied after the
nullish-coalescing, so blank/whitespace overrides (e.g., overrides.indexName ===
'   ') short-circuit env and go straight to ALLIANCE defaults; fix by trimming
each source before coalescing: call trimOptional on overrides.indexName and on
env['PINECONE_INDEX_NAME'] separately, then use ?? to fall back to
ALLIANCE_DEFAULT_INDEX_NAME (similarly for rerankModel using
env['PINECONE_RERANK_MODEL'] and ALLIANCE_DEFAULT_RERANK_MODEL), ensuring
trimOptional converts blank strings to undefined before the ?? checks.

In `@src/constants.ts`:
- Line 35: Update the SERVER_INSTRUCTIONS string in src/constants.ts to scope
the startup config requirement to the core entrypoint (or explicitly mention the
Alliance fallback) so it no longer states that PINECONE_INDEX_NAME/--index-name
is always required; change the sentence around "The server process requires
`PINECONE_INDEX_NAME` (or `--index-name`)" to say that this is required for the
core server entrypoint but that the Alliance resolver will default the index
when omitted, preserving the rest of the guidance (references: the
SERVER_INSTRUCTIONS constant).

In `@src/core/config.test.ts`:
- Around line 33-36: The test "uses indexName from overrides when set" is
leaking real process.env and can fail if PINECONE_SPARSE_INDEX_NAME is set;
update the test around resolveConfig(...) to temporarily clear or set
process.env.PINECONE_SPARSE_INDEX_NAME (e.g., save original, delete or set to
undefined, call resolveConfig, then restore) so the assertion on
cfg.sparseIndexName === 'override-index-sparse' is deterministic; reference the
test block that calls resolveConfig and the env var name
PINECONE_SPARSE_INDEX_NAME to locate where to add the setup/teardown.

---

Outside diff comments:
In `@docs/MIGRATION.md`:
- Around line 3-5: Update the opening paragraph in MIGRATION.md to clarify which
changelog section is authoritative for this revision: state that if an
"Unreleased" migration block exists in CHANGELOG.md it takes precedence and
should be followed, otherwise fall back to the [0.2.0] section; reference the
"Unreleased" heading and the "[0.2.0]" changelog entry by name so readers know
which guidance to apply.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b261c715-81ed-4294-92b1-9db0bc9a8609

📥 Commits

Reviewing files that changed from the base of the PR and between 6a07fd8 and 33c6875.

📒 Files selected for processing (21)
  • .env.example
  • CHANGELOG.md
  • README.md
  • docs/CONFIGURATION.md
  • docs/MIGRATION.md
  • examples/alliance/.env.example
  • examples/alliance/README.md
  • examples/alliance/library-embedding-demo.ts
  • examples/alliance/preset.ts
  • src/alliance/config.test.ts
  • src/alliance/config.ts
  • src/alliance/index.ts
  • src/alliance/setup.ts
  • src/cli.ts
  • src/constants.ts
  • src/core/config.test.ts
  • src/core/config.ts
  • src/core/index.ts
  • src/core/server/config-context.ts
  • src/index.ts
  • src/types.ts

Comment thread examples/alliance/library-embedding-demo.ts
Comment thread src/alliance/config.ts
Comment thread src/constants.ts Outdated
Comment thread src/core/config.test.ts
Comment thread README.md Outdated
@jonathanMLDev jonathanMLDev requested a review from wpak-ai June 2, 2026 17:03
@jonathanMLDev jonathanMLDev merged commit eb467ba into cppalliance:main Jun 2, 2026
12 checks passed
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.

Remove Alliance defaults from core config

3 participants