Skip to content

feat(carbon): add carbon footprint tracking as core capability#5

Merged
faical-yannick-congo merged 3 commits into
mainfrom
feat/carbon-footprint
Mar 25, 2026
Merged

feat(carbon): add carbon footprint tracking as core capability#5
faical-yannick-congo merged 3 commits into
mainfrom
feat/carbon-footprint

Conversation

@faical-yannick-congo

Copy link
Copy Markdown
Collaborator

Summary

  • Add CARBON_KNOWLEDGE.md and CARBON_SKILL.md — agent-readable reference files for zero-code CO₂ calculation
  • New packages/carbon workspace with full TypeScript calculator (resolveModelKey, calculateCO2, getAnalogy, CarbonSession, compareFrameworks)
  • 55 unit tests covering all exported functions, edge cases, and the CARBON_KNOWLEDGE.md worked example
  • Responsive "Carbon Footprint" section in site/index.html with live model selector, framework comparison bars, and EcoLogits attribution

Test plan

  • All 55 carbon tests pass on Node 20 and Node 22
  • Existing scorer/schema/engine tests still pass (no regressions)
  • tsc --noEmit clean on packages/carbon
  • Site carbon panel renders correctly on mobile (≤640px) and desktop
  • Framework comparison bars update on model change
  • Merge only after CI green on both Node versions

🤖 Generated with Claude Code

Knowledge & skill files:
  - CARBON_KNOWLEDGE.md — agent-readable reference table (EcoLogits 2026-03)
    gCO₂eq rates for 11 models + DEFAULT, formula, analogies, framework
    efficiency table, output format spec, honest caveats
  - CARBON_SKILL.md — transversal skill definition: carbon_tracker v0.1.0
    inputs/outputs schema, 5-step execution, comparison sub-skill

packages/carbon (new):
  - src/index.ts — zero-dependency TypeScript calculator
    · RATE_TABLE with 11 models + DEFAULT (EcoLogits 2026-03)
    · resolveModelKey(): substring matching, priority-ordered
    · calculateCO2(): formula, range bands, per-100k normalisation
    · getAnalogy(): human-readable CO₂ comparisons
    · CarbonSession: accumulator for multi-call tracking
    · compareFrameworks(): sorts by efficiency, savings %, baseline detection
  - src/__tests__/carbon.test.ts — 55 tests across all exported functions
    · RATE_TABLE structure, completeness, output/input ratio
    · resolveModelKey: all models, priority order, case-insensitive, DEFAULT
    · calculateCO2: worked example, zero tokens, all models, range bands
    · getAnalogy: all scale boundaries, edge cases
    · CarbonSession: accumulation, reset, multi-call consistency
    · compareFrameworks: sorting, savings, baseline detection, edge cases

site/index.html:
  - New "Carbon Footprint" section with responsive two-column layout
    (single column on ≤1024px / mobile)
  - Live carbon panel: model selector, per-100k metric, session estimate,
    framework comparison bar chart, analogy, caveats
  - Framework savings table (4D / Linear / Cyclic vs baseline)
  - Nav + footer links for #carbon
  - window.fluentlySetCarbonModel / fluentlyUpdateCarbonTokens hooks
    for future wiring to the Try It runner

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

❌ Test Suite Failed — PR cannot be merged

What failed

The test suite did not pass on Node.js 20. All tests must pass before this PR can be merged.

Test output (first 4000 characters)

> fluently@0.1.0 test
> npm run -ws test --run


> fluently-cli@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/cli�[39m

 �[32m✓�[39m __tests__/commands.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 85�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m9 passed�[39m�[22m�[90m (9)�[39m
�[2m   Start at �[22m 23:52:24
�[2m   Duration �[22m 341ms�[2m (transform 82ms, setup 0ms, import 121ms, tests 85ms, environment 0ms)�[22m


> fluently-mcp-server@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/mcp-server�[39m

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mgetKnowledge�[2m > �[22m�[2mloads entries from the connector on first call
�[22m�[39m[fluently] Loaded 2 cycles from mock

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mgetKnowledge�[2m > �[22m�[2mreturns cached result on second call (no reload)
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mreloads even when cache is warm
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mreloads even when cache is warm
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to stale cache when connector fails after first load
�[22m�[39m[fluently] Loaded 1 cycles from mock

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to stale cache when connector fails after first load
�[22m�[39m[fluently] Load failed (failing): Network unavailable
[fluently] Using stale cache (1 entries)

 �[32m✓�[39m src/__tests__/ranking.test.ts �[2m(�[22m�[2m17 tests�[22m�[2m)�[22m�[32m 11�[2mms�[22m�[39m
�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to bundled knowledge when connector fails and cache is cold
�[22m�[39m[fluently] Load failed (failing): Network unavailable
[fluently] Falling back to bundled knowledge

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2minvalidateCache�[2m > �[22m�[2mforces a reload on next getKnowledge call
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2minvalidateCache�[2m > �[22m�[2mforces a reload on next getKnowledge call
�[22m�[39m[fluently] Loaded 1 cycles from counted

 �[32m✓�[39m src/__tests__/knowledge.test.ts �[2m(�[22m�[2m6 tests�[22m�[2m)�[22m�[32m 35�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m2 passed�[39m�[22m�[90m (2)�[39m
�[2m      Tests �[22m �[1m�[32m23 passed�[39m�[22m�[90m (23)�[39m
�[2m   Start at �[22m 23:52:25
�[2m   Duration �[22m 253ms�[2m (transform 102ms, setup 0ms, import 148ms, tests 46ms, environment 0ms)�[22m


> fluently-scorer@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/scorer�[39m

 �[32m✓�[39m src/__tests__/privacy.test.ts �[2m(�[22m�[2m19 tests�[22m�[2m)�[22m�[32m 20�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/framework-schema.test.ts �[2m(�[22m�[2m21 tests�[22m�[2m)�[22m�[32m 22�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/engine.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 40�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/schema.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 14�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m4 passed�[39m�[22m�[90m (4)�[39m
�[2m      Tests �[22m �[1m�[32m58 passed�[39m�[22m�[90m (58)�[39m
�[2m   Start at �[22m 23:52:26
�[2m   Duration �[22m 501ms�[2m (transform 210ms, setup 0ms, import 408ms, tests 96ms, environment 0ms)�[22m


> fluently-carbon@0.1.0 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m

How to fix

  1. Pull the latest changes from this branch locally.
  2. Run npm test -- --run in the repository root to reproduce the failures.
  3. Fix the failing tests or the code that causes them to fail.
  4. Push your fixes — CI will re-run automatically.

Note: ALL tests must pass before this PR can be merged.

@github-actions

Copy link
Copy Markdown
Contributor

❌ Test Suite Failed — PR cannot be merged

What failed

The test suite did not pass on Node.js 22. All tests must pass before this PR can be merged.

Test output (first 4000 characters)

> fluently@0.1.0 test
> npm run -ws test --run


> fluently-cli@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/cli�[39m

 �[32m✓�[39m __tests__/commands.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 91�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m9 passed�[39m�[22m�[90m (9)�[39m
�[2m   Start at �[22m 23:52:25
�[2m   Duration �[22m 336ms�[2m (transform 78ms, setup 0ms, import 117ms, tests 91ms, environment 0ms)�[22m


> fluently-mcp-server@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/mcp-server�[39m

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mgetKnowledge�[2m > �[22m�[2mloads entries from the connector on first call
�[22m�[39m[fluently] Loaded 2 cycles from mock

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mgetKnowledge�[2m > �[22m�[2mreturns cached result on second call (no reload)
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mreloads even when cache is warm
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mreloads even when cache is warm
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to stale cache when connector fails after first load
�[22m�[39m[fluently] Loaded 1 cycles from mock

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to stale cache when connector fails after first load
�[22m�[39m[fluently] Load failed (failing): Network unavailable
[fluently] Using stale cache (1 entries)

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to bundled knowledge when connector fails and cache is cold
�[22m�[39m[fluently] Load failed (failing): Network unavailable
[fluently] Falling back to bundled knowledge

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2minvalidateCache�[2m > �[22m�[2mforces a reload on next getKnowledge call
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2minvalidateCache�[2m > �[22m�[2mforces a reload on next getKnowledge call
�[22m�[39m[fluently] Loaded 1 cycles from counted

 �[32m✓�[39m src/__tests__/knowledge.test.ts �[2m(�[22m�[2m6 tests�[22m�[2m)�[22m�[32m 42�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/ranking.test.ts �[2m(�[22m�[2m17 tests�[22m�[2m)�[22m�[32m 14�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m2 passed�[39m�[22m�[90m (2)�[39m
�[2m      Tests �[22m �[1m�[32m23 passed�[39m�[22m�[90m (23)�[39m
�[2m   Start at �[22m 23:52:26
�[2m   Duration �[22m 254ms�[2m (transform 78ms, setup 0ms, import 125ms, tests 56ms, environment 0ms)�[22m


> fluently-scorer@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/scorer�[39m

 �[32m✓�[39m src/__tests__/privacy.test.ts �[2m(�[22m�[2m19 tests�[22m�[2m)�[22m�[32m 21�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/engine.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 34�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/framework-schema.test.ts �[2m(�[22m�[2m21 tests�[22m�[2m)�[22m�[32m 24�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/schema.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 12�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m4 passed�[39m�[22m�[90m (4)�[39m
�[2m      Tests �[22m �[1m�[32m58 passed�[39m�[22m�[90m (58)�[39m
�[2m   Start at �[22m 23:52:26
�[2m   Duration �[22m 456ms�[2m (transform 191ms, setup 0ms, import 374ms, tests 91ms, environment 1ms)�[22m


> fluently-carbon@0.1.0 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/

How to fix

  1. Pull the latest changes from this branch locally.
  2. Run npm test -- --run in the repository root to reproduce the failures.
  3. Fix the failing tests or the code that causes them to fail.
  4. Push your fixes — CI will re-run automatically.

Note: ALL tests must pass before this PR can be merged.

…Registry

Replace hardcoded RateTableProvider with a pluggable provider architecture:

EmissionsProvider (interface)
  - Contract every calculation method must satisfy
  - calculate() returns null for unsupported models — registry falls through

RateTableProvider (class, implements EmissionsProvider)
  - Existing EcoLogits bottom-up calculation, now encapsulated
  - Accepts a custom rateTable in constructor: no subclassing needed
  - providerId stamped on every CarbonResult

EmissionsRegistry (class)
  - Holds named providers in registration order
  - First provider returning non-null wins; falls back to default
  - register/unregister/setDefault/get/list API
  - calculate() accepts optional providerId for explicit routing

defaultRegistry (module-level singleton)
  - Pre-loaded with RateTableProvider as default
  - Consumer registers new providers once; all call sites pick them up:
      defaultRegistry.register(new AnthropicSDKProvider(), true)

calculateCO2 / CarbonSession / compareFrameworks
  - Optional provider parameter at every level
  - Omit for global default; inject for per-call or per-session override

CarbonResult now carries providerId field.
ComparisonResult now carries providerId field.

Tests: 72 tests (was 55), covering:
  - EmissionsRegistry: register, unregister, default, order, fallback, errors
  - RateTableProvider: custom rate table injection, all models
  - calculateCO2 / CarbonSession / compareFrameworks with injected providers
  - Custom provider end-to-end: model-specific routing, confidence preference

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

❌ Test Suite Failed — PR cannot be merged

What failed

The test suite did not pass on Node.js 22. All tests must pass before this PR can be merged.

Test output (first 4000 characters)

> fluently@0.1.0 test
> npm run -ws test --run


> fluently-cli@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/cli�[39m

 �[32m✓�[39m __tests__/commands.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 104�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m9 passed�[39m�[22m�[90m (9)�[39m
�[2m   Start at �[22m 23:57:48
�[2m   Duration �[22m 393ms�[2m (transform 85ms, setup 0ms, import 133ms, tests 104ms, environment 0ms)�[22m


> fluently-mcp-server@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/mcp-server�[39m

 �[32m✓�[39m src/__tests__/ranking.test.ts �[2m(�[22m�[2m17 tests�[22m�[2m)�[22m�[32m 12�[2mms�[22m�[39m
�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mgetKnowledge�[2m > �[22m�[2mloads entries from the connector on first call
�[22m�[39m[fluently] Loaded 2 cycles from mock

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mgetKnowledge�[2m > �[22m�[2mreturns cached result on second call (no reload)
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mreloads even when cache is warm
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mreloads even when cache is warm
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to stale cache when connector fails after first load
�[22m�[39m[fluently] Loaded 1 cycles from mock

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to stale cache when connector fails after first load
�[22m�[39m[fluently] Load failed (failing): Network unavailable
[fluently] Using stale cache (1 entries)

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to bundled knowledge when connector fails and cache is cold
�[22m�[39m[fluently] Load failed (failing): Network unavailable
[fluently] Falling back to bundled knowledge

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2minvalidateCache�[2m > �[22m�[2mforces a reload on next getKnowledge call
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2minvalidateCache�[2m > �[22m�[2mforces a reload on next getKnowledge call
�[22m�[39m[fluently] Loaded 1 cycles from counted

 �[32m✓�[39m src/__tests__/knowledge.test.ts �[2m(�[22m�[2m6 tests�[22m�[2m)�[22m�[32m 35�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m2 passed�[39m�[22m�[90m (2)�[39m
�[2m      Tests �[22m �[1m�[32m23 passed�[39m�[22m�[90m (23)�[39m
�[2m   Start at �[22m 23:57:49
�[2m   Duration �[22m 273ms�[2m (transform 84ms, setup 0ms, import 123ms, tests 47ms, environment 0ms)�[22m


> fluently-scorer@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/scorer�[39m

 �[32m✓�[39m src/__tests__/privacy.test.ts �[2m(�[22m�[2m19 tests�[22m�[2m)�[22m�[32m 24�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/framework-schema.test.ts �[2m(�[22m�[2m21 tests�[22m�[2m)�[22m�[32m 21�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/engine.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 28�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/schema.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 12�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m4 passed�[39m�[22m�[90m (4)�[39m
�[2m      Tests �[22m �[1m�[32m58 passed�[39m�[22m�[90m (58)�[39m
�[2m   Start at �[22m 23:57:49
�[2m   Duration �[22m 447ms�[2m (transform 184ms, setup 0ms, import 378ms, tests 85ms, environment 0ms)�[22m


> fluently-carbon@0.1.0 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90

How to fix

  1. Pull the latest changes from this branch locally.
  2. Run npm test -- --run in the repository root to reproduce the failures.
  3. Fix the failing tests or the code that causes them to fail.
  4. Push your fixes — CI will re-run automatically.

Note: ALL tests must pass before this PR can be merged.

@github-actions

Copy link
Copy Markdown
Contributor

❌ Test Suite Failed — PR cannot be merged

What failed

The test suite did not pass on Node.js 20. All tests must pass before this PR can be merged.

Test output (first 4000 characters)

> fluently@0.1.0 test
> npm run -ws test --run


> fluently-cli@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/cli�[39m

 �[32m✓�[39m __tests__/commands.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 82�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m9 passed�[39m�[22m�[90m (9)�[39m
�[2m   Start at �[22m 23:57:49
�[2m   Duration �[22m 342ms�[2m (transform 84ms, setup 0ms, import 124ms, tests 82ms, environment 0ms)�[22m


> fluently-mcp-server@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/mcp-server�[39m

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mgetKnowledge�[2m > �[22m�[2mloads entries from the connector on first call
�[22m�[39m[fluently] Loaded 2 cycles from mock

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mgetKnowledge�[2m > �[22m�[2mreturns cached result on second call (no reload)
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mreloads even when cache is warm
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mreloads even when cache is warm
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to stale cache when connector fails after first load
�[22m�[39m[fluently] Loaded 1 cycles from mock

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to stale cache when connector fails after first load
�[22m�[39m[fluently] Load failed (failing): Network unavailable
[fluently] Using stale cache (1 entries)

 �[32m✓�[39m src/__tests__/ranking.test.ts �[2m(�[22m�[2m17 tests�[22m�[2m)�[22m�[32m 11�[2mms�[22m�[39m
�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2mrefreshKnowledge�[2m > �[22m�[2mfalls back to bundled knowledge when connector fails and cache is cold
�[22m�[39m[fluently] Load failed (failing): Network unavailable
[fluently] Falling back to bundled knowledge

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2minvalidateCache�[2m > �[22m�[2mforces a reload on next getKnowledge call
�[22m�[39m[fluently] Loaded 1 cycles from counted

�[90mstderr�[2m | src/__tests__/knowledge.test.ts�[2m > �[22m�[2minvalidateCache�[2m > �[22m�[2mforces a reload on next getKnowledge call
�[22m�[39m[fluently] Loaded 1 cycles from counted

 �[32m✓�[39m src/__tests__/knowledge.test.ts �[2m(�[22m�[2m6 tests�[22m�[2m)�[22m�[32m 35�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m2 passed�[39m�[22m�[90m (2)�[39m
�[2m      Tests �[22m �[1m�[32m23 passed�[39m�[22m�[90m (23)�[39m
�[2m   Start at �[22m 23:57:50
�[2m   Duration �[22m 244ms�[2m (transform 107ms, setup 0ms, import 144ms, tests 46ms, environment 0ms)�[22m


> fluently-scorer@0.3.2 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/runner/work/fluently/fluently/packages/scorer�[39m

 �[32m✓�[39m src/__tests__/privacy.test.ts �[2m(�[22m�[2m19 tests�[22m�[2m)�[22m�[32m 30�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/framework-schema.test.ts �[2m(�[22m�[2m21 tests�[22m�[2m)�[22m�[32m 27�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/engine.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 38�[2mms�[22m�[39m
 �[32m✓�[39m src/__tests__/schema.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 14�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m4 passed�[39m�[22m�[90m (4)�[39m
�[2m      Tests �[22m �[1m�[32m58 passed�[39m�[22m�[90m (58)�[39m
�[2m   Start at �[22m 23:57:50
�[2m   Duration �[22m 495ms�[2m (transform 182ms, setup 0ms, import 408ms, tests 109ms, environment 1ms)�[22m


> fluently-carbon@0.1.0 test
> vitest


�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90

How to fix

  1. Pull the latest changes from this branch locally.
  2. Run npm test -- --run in the repository root to reproduce the failures.
  3. Fix the failing tests or the code that causes them to fail.
  4. Push your fixes — CI will re-run automatically.

Note: ALL tests must pass before this PR can be merged.

- Add packages/carbon/vitest.config.ts (mirrors scorer config) to
  resolve CJS/ESM conflict when vitest processes carbon tests
- Fix "output rate is 5× input rate" test: use toBeCloseTo(5, 10)
  instead of toBe(5) — floating-point division (e.g. 0.000005/0.000001)
  produces 5.000000000000001 due to IEEE 754 representation

All 202 tests passing locally on Node 20.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@faical-yannick-congo
faical-yannick-congo merged commit 858dde3 into main Mar 25, 2026
5 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.

1 participant