Skip to content

feat(riviere-extract-config): add customTypes support to extraction config - #143

Merged
NTCoding merged 3 commits into
mainfrom
issue-142-feat-add-custom-type-support-t
Jan 13, 2026
Merged

NTCoding merged 3 commits into
mainfrom
issue-142-feat-add-custom-type-support-t

Conversation

@NTCoding

@NTCoding NTCoding commented Jan 13, 2026 •

Copy link
Copy Markdown
Owner

User description

Closes #142

Summary

  • Adds customTypes property to module config for user-defined component types
  • Enables users to define domain-specific component types (e.g., backgroundJob, saga, policy)
  • Custom types use the same detection rules as built-in types (find + where predicates)
  • Changes DraftComponent.type from ComponentType enum to string to support custom values

Test plan

  • Schema validates customTypes configuration
  • Extractor processes custom types alongside built-in types
  • Tests verify custom type detection with find/where predicates
  • All existing tests pass with type system changes

Generated with Claude Code


PR Type

Enhancement


Description

  • Add customTypes property to module config for user-defined component types

  • Enable custom type detection using same rules as built-in types

  • Change DraftComponent.type from enum to string for flexibility

  • Refactor extractor to process custom types alongside built-in types

  • Improve test fixtures with reusable helper functions


Diagram Walkthrough

flowchart LR
  A["Module Config"] -->|"customTypes property"| B["CustomTypes Record"]
  B -->|"Detection Rules"| C["Custom Type Detection"]
  D["DraftComponent.type"] -->|"Changed to string"| E["Support Custom Values"]
  F["Extractor"] -->|"Process both"| G["Built-in + Custom Types"]
Loading

File Walkthrough

Relevant files
Enhancement
types.ts
Add CustomTypes type and module interfaces                             

packages/riviere-extract-config/src/types.ts

  • Add CustomTypes type as Record
  • Add customTypes optional property to ModuleConfig interface
  • Add customTypes optional property to Module interface
+5/-0     
extractor.ts
Refactor extractor for custom type support                             

packages/riviere-extract-ts/src/extractor.ts

  • Change DraftComponent.type from ComponentType enum to string
  • Add extractCustomTypes() function to process custom type rules
  • Refactor extractComponentType() to use new extractWithRule() helper
  • Update all extraction functions to accept string component type
  • Combine built-in and custom component extraction results
+39/-18 
Tests
validation.spec.ts
Add customTypes validation test                                                   

packages/riviere-extract-config/src/validation.spec.ts

  • Add test case validating module with customTypes detection rule
  • Test verifies schema accepts customTypes with find and where
    predicates
+17/-0   
extractor.spec.ts
Add custom type extraction tests                                                 

packages/riviere-extract-ts/src/extractor.spec.ts

  • Add three new test cases for custom type extraction (functions,
    classes, methods)
  • Refactor existing tests to use new test fixture helpers
  • Reduce test boilerplate by using createConfigWithRule() and
    createConfigWithCustomTypes()
  • Verify custom types work with all detection rule types
+120/-172
test-fixtures.ts
Refactor test fixtures with helper functions                         

packages/riviere-extract-ts/src/test-fixtures.ts

  • Extract createMinimalModule() helper for reusable module creation
  • Add createConfigWithRule() helper for single-rule config creation
  • Add createConfigWithCustomTypes() helper for custom type config
    creation
  • Refactor createOrdersUseCaseConfig() to use new helpers
  • Define NOT_USED constant to reduce duplication
+52/-23 
Configuration changes
extraction-config.schema.json
Add customTypes to JSON schema                                                     

packages/riviere-extract-config/extraction-config.schema.json

  • Add customTypes property to module schema as object type
  • Define additionalProperties as detectionRule references
  • Allow flexible custom type definitions in config files
+7/-0     

Summary by CodeRabbit

  • New Features

    • Modules can declare user-defined component types with configurable detection rules; extractor now recognizes and returns custom component kinds alongside built-ins.
  • Tests

    • Expanded coverage for custom type extraction (functions, classes, methods) and validation of custom type rules; introduced reusable test helpers/fixtures to simplify scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

…onfig

Adds customTypes property to module config for user-defined component types
like backgroundJob, saga, policy. Custom types use the same detection rules
as built-in types (find + where predicates).

Changes:
- Add customTypes property to extraction-config.schema.json
- Add CustomTypes type and update Module/ModuleConfig interfaces
- Update extractor to process customTypes alongside built-in types
- Change DraftComponent.type from ComponentType to string

Closes #142

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jan 13, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds module-level customTypes to schema and types, updates validation/tests, introduces rule-driven custom type extraction in the TypeScript extractor (including generic dispatch), and generalizes DraftComponent.type to a string.

Changes

Cohort / File(s) Summary
Schema
packages/riviere-extract-config/extraction-config.schema.json
Add customTypes object property on module schema with additionalProperties: { "$ref": "#/$defs/detectionRule" }.
Config Types
packages/riviere-extract-config/src/types.ts
Add CustomTypes type and optional customTypes?: CustomTypes on ModuleConfig and Module.
Validation Tests
packages/riviere-extract-config/src/validation.spec.ts
Parameterize and extend tests to cover valid/invalid customTypes entries and improved error mapping assertions.
Extractor Logic
packages/riviere-extract-ts/src/extractor.ts
Add extractCustomTypes and generic extractWithRule dispatch; accept rules for classes/functions/methods; change DraftComponent.type from ComponentType to string.
Test Fixtures
packages/riviere-extract-ts/src/test-fixtures.ts
Add factories: createMinimalModule, createResolvedConfig, createConfigWithRule, createConfigWithCustomTypes, createOrdersUseCaseConfig, and NOT_USED sentinel.
Extractor Tests
packages/riviere-extract-ts/src/extractor.spec.ts
Replace inline configs with factory helpers, add custom-type extraction tests, and import new helpers.

Sequence Diagram(s)

sequenceDiagram
    participant Config as Extraction Config
    participant Extractor as Extractor
    participant Dispatcher as Rule Dispatcher
    participant Detector as Detection Engine
    participant Collector as Components Collector

    Config->>Extractor: provide modules (built-in types + customTypes)
    Extractor->>Dispatcher: iterate module types and rules
    Dispatcher->>Detector: apply detection rule (classes / functions / methods)
    Detector->>Collector: emit DraftComponent { type: string, id, ... }
    Extractor->>Collector: aggregate built-in + custom components
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰
I hop through modules, sniffing rules,
I mark the classes, methods, and tools,
Custom types sprout where configs sing,
I clip their tags and watch them spring,
Hooray — new components take to wing!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding customTypes support to the extraction config, which aligns perfectly with the PR's primary objective of enabling custom component type definitions.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #142: updates the JSON schema to include customTypes property, updates types.ts with CustomTypes and ModuleConfig/Module interfaces, extends extractor.ts with custom type extraction logic, and changes DraftComponent.type to string.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing customTypes support as specified in issue #142. Test refactoring (validation.spec.ts, extractor.spec.ts) and test fixture additions are necessary supporting changes for validating and testing the feature.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

@qodo-code-review

qodo-code-review Bot commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟢
🎫 #142
🟢 Add a customTypes property to the module definition in the extraction config schema to
allow user-defined component types.
Ensure customTypes supports mapping arbitrary type names to detection rules (same find +
where predicate structure as built-in types).
Update riviere-extract-ts so it processes custom types using the same detection logic as
built-in component types.
Ensure custom types appear in extraction output using their custom type name (e.g.,
backgroundJob, saga, policy).
Codebase Duplication Compliance
⚪
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

⚪
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Unvalidated customTypes: extractCustomTypes() assumes module.customTypes entries are valid DetectionRule objects
and may throw at runtime if malformed config data bypasses validation.

Referred Code
function extractCustomTypes(
  sourceFile: SourceFile,
  filePath: string,
  module: Module,
): DraftComponent[] {
  if (module.customTypes === undefined) {
    return []
  }
  return Object.entries(module.customTypes).flatMap(([typeName, rule]) =>
    extractWithRule(sourceFile, filePath, module.name, typeName, rule),
  )
}

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Unrestricted map keys: The customTypes schema allows arbitrary object keys via additionalProperties, which may
require explicit key sanitization (e.g., blocking proto/constructor) depending on how
configs are merged/handled elsewhere.

Referred Code
"customTypes": {
  "type": "object",
  "description": "User-defined component types with their detection rules",
  "additionalProperties": {
    "$ref": "#/$defs/detectionRule"
  }
}

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jan 13, 2026 •

Copy link
Copy Markdown

Deploying living-architecture with  Cloudflare Pages  Cloudflare Pages

Latest commit: eb1c08b
Status: ✅  Deploy successful!
Preview URL: https://638a52ec.living-architecture.pages.dev
Branch Preview URL: https://issue-142-feat-add-custom-ty.living-architecture.pages.dev

View logs

Remove export keyword from createMinimalModule as it's only used
internally within test-fixtures.ts

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@qodo-code-review

qodo-code-review Bot commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
✅ Restrict config rule types
Suggestion Impact:The commit changed createConfigWithRule's componentType parameter from `keyof Module` to a more specific `ComponentType` type imported from the config package, improving type safety and likely preventing invalid keys such as `customTypes` from being passed.

code diff:

 export function createConfigWithRule(
   moduleName: string,
   modulePath: string,
-  componentType: keyof Module,
+  componentType: ComponentType,
   rule: DetectionRule,

In the createConfigWithRule test helper, restrict the componentType parameter to
Exclude<keyof Module, 'customTypes'> to improve type safety and prevent
accidental misuse.

packages/riviere-extract-ts/src/test-fixtures.ts [44-59]

 export function createConfigWithRule(
   moduleName: string,
   modulePath: string,
-  componentType: keyof Module,
+  componentType: Exclude<keyof Module, 'customTypes'>,
   rule: DetectionRule,
 ): ResolvedExtractionConfig { ... }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: This is a valuable suggestion that improves the type safety of the test helper createConfigWithRule. By excluding customTypes from the componentType parameter, it prevents misuse and makes the function's intent clearer.

Medium
Possible issue
Validate custom type detection rules

In the extractCustomTypes function, add a validation check using isDetectionRule
to ensure that custom type rules are correctly formed before processing them.

packages/riviere-extract-ts/src/extractor.ts [105-116]

 function extractCustomTypes(
   sourceFile: SourceFile,
   filePath: string,
   module: Module,
 ): DraftComponent[] {
   if (module.customTypes === undefined) {
     return []
   }
-  return Object.entries(module.customTypes).flatMap(([typeName, rule]) =>
-    extractWithRule(sourceFile, filePath, module.name, typeName, rule),
-  )
+  return Object.entries(module.customTypes).flatMap(([typeName, rule]) => {
+    if (!isDetectionRule(rule)) {
+      return []
+    }
+    return extractWithRule(sourceFile, filePath, module.name, typeName, rule)
+  })
 }
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: This is a good defensive programming suggestion that improves robustness by adding a runtime check for custom type rules, mirroring the existing check for built-in types and preventing potential errors from malformed configurations.

Low
Throw error on unsupported find target

In the extractWithRule function, replace the silent return [] fallback with
throw new Error(...) to explicitly handle unsupported find target values.

packages/riviere-extract-ts/src/extractor.ts [135-136]

 /* istanbul ignore next -- @preserve: unreachable with valid FindTarget type; defensive fallback */
-return []
+throw new Error(`Unsupported find target: ${rule.find}`)
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: This suggestion improves maintainability by advocating for a "fail-fast" approach. Throwing an error for an unexpected find value makes configuration or code errors more apparent than silently failing, which could hide issues.

Low
  • Update

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @packages/riviere-extract-config/src/validation.spec.ts:
- Around line 157-173: Add negative tests in validation.spec.ts that call
validateExtractionConfig with modules using createMinimalModule where
customTypes entries are malformed: (1) missing the find property, (2) missing
the where property, and (3) have an invalid find value (e.g., a number or
unsupported string). For each case assert result.valid is false and optionally
assert result.errors contains a message referencing the offending field
(customTypes, find, or where) to ensure schema rejects these invalid
configurations.

In @packages/riviere-extract-ts/src/test-fixtures.ts:
- Around line 44-59: The componentType parameter in createConfigWithRule is too
broad (keyof Module) and may allow keys like name/path/customTypes that can't
hold a DetectionRule; narrow its type to only the module properties that accept
a DetectionRule (e.g., use an explicit union 'api' | 'useCase' | 'domainOp' |
'event' | 'eventHandler' | 'ui' or derive it with keyof Pick<Module, 'api' |
'useCase' | 'domainOp' | 'event' | 'eventHandler' | 'ui'>), then ensure the
createMinimalModule call still uses the narrowed componentType to set the rule
without type errors.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e0a8459 and 12f439a.

📒 Files selected for processing (6)
  • packages/riviere-extract-config/extraction-config.schema.json
  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
🧰 Additional context used
📓 Path-based instructions (6)
packages/riviere-extract-config/**/*.ts

📄 CodeRabbit inference engine (packages/riviere-extract-config/CLAUDE.md)

Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency

Files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Follow eslint configuration rules defined in eslint.config.mjs for all linting

Files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
**/*.{ts,tsx,js,jsx,css,scss,html}

📄 CodeRabbit inference engine (CLAUDE.md)

All UI and UX design must conform to global brand guidelines in /docs/brand/ (logo, colors, typography, icons)

Files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Do not log sensitive data (passwords, tokens, PII) in any code
Validate and sanitize all external input

Files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use cross-project imports with package names (e.g., import { X } from '@living-architecture/[pkg-name]') rather than relative paths

Files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
packages/riviere-extract-ts/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/riviere-extract-ts/CLAUDE.md)

packages/riviere-extract-ts/**/*.{ts,tsx}: Use ts-morph for TypeScript AST parsing instead of other parsers
Implement extraction logic as pure functions with no side effects
Compose detection rules via and/or logic for predicates
Reject invalid extraction configs at load time, not during extraction phase
Use glob pattern matching for module-based organization of extraction rules

Files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
🧠 Learnings (32)
📓 Common learnings
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Applies to packages/riviere-extract-conventions/**/*.ts : Use `Custom(type)` decorator to annotate components with custom types not covered by standard decorators
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Import and use the default extraction config from `living-architecture/riviere-extract-conventions/default-config` in extraction tooling to detect all 6 component types
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Applies to packages/riviere-extract-config/**/*.ts : Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Extraction config schemas must define all six required component types per module: api, useCase, domainOp, event, eventHandler, and ui. Unused component types must be explicitly marked with `notUsed: true` rather than omitted
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use ts-morph for TypeScript AST parsing instead of other parsers
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use the Rivière Builder Node.js library to programmatically construct the schema graph when implementing custom extraction code
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: packages/riviere-cli/src/commands/extract/config-loader.ts:31-39
Timestamp: 2026-01-11T14:38:35.637Z
Learning: In packages/riviere-cli/src/commands/extract/config-loader.ts, the isExtendedConfig type guard intentionally performs minimal validation (checks for non-null object and validates modules is an array if present) because comprehensive validation is handled downstream by the schema validator. The type guard's purpose is basic type narrowing to support both module-array and top-level-rules formats, not comprehensive validation. This follows the layered validation pattern where type guards are minimal and schema validation occurs at system boundaries.
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Extraction config must support exactly eight predicate types that can be composed with and/or logic to filter architectural components
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Applies to packages/riviere-extract-conventions/**/*.ts : Use `Custom(type)` decorator to annotate components with custom types not covered by standard decorators

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-config/extraction-config.schema.json
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Applies to packages/riviere-extract-config/**/*.ts : Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-config/extraction-config.schema.json
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-config/extraction-config.schema.json
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-11T14:38:35.637Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: packages/riviere-cli/src/commands/extract/config-loader.ts:31-39
Timestamp: 2026-01-11T14:38:35.637Z
Learning: In packages/riviere-cli/src/commands/extract/config-loader.ts, the isExtendedConfig type guard intentionally performs minimal validation (checks for non-null object and validates modules is an array if present) because comprehensive validation is handled downstream by the schema validator. The type guard's purpose is basic type narrowing to support both module-array and top-level-rules formats, not comprehensive validation. This follows the layered validation pattern where type guards are minimal and schema validation occurs at system boundaries.

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-config/extraction-config.schema.json
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use ts-morph for TypeScript AST parsing instead of other parsers

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Compose detection rules via and/or logic for predicates

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Import and use the default extraction config from `living-architecture/riviere-extract-conventions/default-config` in extraction tooling to detect all 6 component types

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/extraction-config.schema.json
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-config/extraction-config.schema.json
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Extraction config schemas must define all six required component types per module: api, useCase, domainOp, event, eventHandler, and ui. Unused component types must be explicitly marked with `notUsed: true` rather than omitted

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-config/extraction-config.schema.json
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-11T18:47:09.232Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: apps/eclair/src/components/SchemaModal/SchemaModal.cssModule.spec.ts:13-19
Timestamp: 2026-01-11T18:47:09.232Z
Learning: Encourage using const for declarations by default in TypeScript/JavaScript files and only use let when a variable must be reassigned. Do not rely on var. This improves immutability and clarity. If a variable needs mutation (e.g., counters in loops, reassigned values), use let, but prefer const whenever possible and refactor reassigned logic to avoid mutations where feasible.

Applied to files:

  • packages/riviere-extract-config/src/types.ts
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement unit tests for each predicate type in isolation with positive and negative cases

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T12:57:19.167Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 67
File: packages/riviere-extract-ts/tsconfig.spec.json:5-22
Timestamp: 2026-01-08T12:57:19.167Z
Learning: In tsconfig.spec.json files, use expanded types array ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest"] for complete test type coverage. Include patterns should cover .test and .spec files, config files (vitest.config.ts/mts, vite.config.ts/mts), multiple extensions (.ts, .tsx, .js, .jsx), and .d.ts files to ensure proper TypeScript coverage across the testing environment.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-08T06:46:00.609Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 66
File: packages/riviere-extract-conventions/src/eslint/require-component-decorator.spec.ts:19-21
Timestamp: 2026-01-08T06:46:00.609Z
Learning: In test files using typescript-eslint/rule-tester's RuleTester.run(), ensure there is an explicit it() block with at least one expect() assertion (e.g., expect(rule).toBeDefined()) to satisfy sonarjs/no-empty-test-file and sonarjs/assertions-in-tests lint rules, which don’t recognize RuleTester's internal test blocks. Apply this pattern to all spec.ts test files to maintain consistency and pass lint checks.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-09T20:08:30.350Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.spec.ts:33-38
Timestamp: 2026-01-09T20:08:30.350Z
Learning: In test files, keep type guard implementations like isExtractionOutput(value: unknown): value is ExtractionOutput focused on narrowing types for TypeScript. Do not perform comprehensive runtime shape validation in type guards; rely on explicit test assertions (e.g., expect(result).toMatchObject(...)) for shape checks. This keeps type guards simple and rely on assertion-based tests for thorough validation.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: All validation of extraction config must occur at config load time, not during extraction. Invalid configs should fail fast with clear error messages that include paths and descriptive information

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-10T08:54:09.466Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 96
File: apps/docs/.vitepress/theme/eclairLinkHandler.spec.ts:229-249
Timestamp: 2026-01-10T08:54:09.466Z
Learning: In jsdom test environments, window.location.assign cannot be spied on due to TypeError: Cannot redefine property. Use Object.defineProperty to mock the entire window.location object, replacing it with a controlled mock, and restore the original in afterEach. Ensure to clean up the mock after each test to avoid side effects.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-11T18:47:09.232Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: apps/eclair/src/components/SchemaModal/SchemaModal.cssModule.spec.ts:13-19
Timestamp: 2026-01-11T18:47:09.232Z
Learning: In test files matching *.spec.ts or *.test.ts, avoid using try/catch blocks for testing error conditions. Prefer assertion library matchers like expect(...).toThrow() or expect(...).rejects.toThrow() to assert errors.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Use ts-morph's in-memory file system (`useInMemoryFileSystem: true`) for fast isolated tests

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*-fixtures.ts : Create fixture files with pattern '<module>-fixtures.ts' alongside '<module>.spec.ts' to reduce test duplication. Use a buildArgs helper to define defaults and override specific values in tests.

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use the Rivière Builder Node.js library to programmatically construct the schema graph when implementing custom extraction code

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: All extraction rules should come from validated ExtractionConfig provided by riviere-extract-config

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T22:39:00.431Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 84
File: packages/riviere-extract-ts/src/extractor.ts:168-187
Timestamp: 2026-01-08T22:39:00.431Z
Learning: In ts-morph usage within the riviere-extract-ts package, MethodDeclaration.getName() always returns a string (never undefined) because methods cannot be anonymous in TypeScript. Only ClassDeclaration.getName() and FunctionDeclaration.getName() can return undefined. Therefore, remove undefined guards for MethodDeclaration when implementing createMethodComponent, and only keep guards for components that can actually be undefined (class/function components). Apply this guidance to all .ts files under packages/riviere-extract-ts/ (i.e., **/packages/riviere-extract-ts/**/*.ts).

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-10T10:14:57.499Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-10T10:14:57.499Z
Learning: Applies to **/vitest.config.ts : When creating new projects with tests, add vitest.config.ts with 100% coverage as the default

Applied to files:

  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-06T08:11:15.403Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 53
File: packages/riviere-extract-config/vitest.config.mts:20-20
Timestamp: 2026-01-06T08:11:15.403Z
Learning: In packages/riviere-extract-config/vitest.config.mts, the explicit tuple type assertion for the reporter configuration (`as ['text', ['lcov', { projectRoot: string }]]`) is necessary because vitest's CoverageReporter type requires the exact tuple shape; neither inference nor 'as const' produces a compatible type.

Applied to files:

  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Systematically test edge cases for collections: empty collections, single element, duplicates, nested structures, circular references, large collections, sparse arrays, and mixed types.

Applied to files:

  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Applies to packages/riviere-extract-conventions/**/*.ts : Use `UseCase`, `Event`, or `UI` class-level decorators to mark the class itself as a component

Applied to files:

  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*.{ts,tsx} : Apply decorators from `living-architecture/riviere-extract-conventions` to mark all classes as architectural components

Applied to files:

  • packages/riviere-extract-ts/src/extractor.spec.ts
🧬 Code graph analysis (4)
packages/riviere-extract-config/src/validation.spec.ts (4)
packages/riviere-extract-config/src/index.ts (1)
  • validateExtractionConfig (4-4)
packages/riviere-extract-config/src/validation.ts (1)
  • validateExtractionConfig (73-86)
packages/riviere-extract-ts/src/test-fixtures.ts (1)
  • createMinimalModule (10-22)
packages/riviere-extract-config/src/validation-fixtures.ts (1)
  • createMinimalModule (29-40)
packages/riviere-extract-ts/src/test-fixtures.ts (2)
packages/riviere-extract-config/src/validation-fixtures.ts (2)
  • createMinimalModule (29-40)
  • createResolvedConfig (46-48)
packages/riviere-extract-config/src/types.ts (4)
  • Module (88-98)
  • ResolvedExtractionConfig (113-116)
  • CustomTypes (64-64)
  • DetectionRule (55-58)
packages/riviere-extract-ts/src/extractor.spec.ts (3)
packages/riviere-extract-ts/src/index.ts (1)
  • extractComponents (2-2)
packages/riviere-extract-ts/src/test-fixtures.ts (4)
  • createResolvedConfig (24-26)
  • createOrdersUseCaseConfig (61-66)
  • createConfigWithRule (44-59)
  • createConfigWithCustomTypes (28-42)
packages/riviere-extract-config/src/validation-fixtures.ts (1)
  • createResolvedConfig (46-48)
packages/riviere-extract-ts/src/extractor.ts (2)
packages/riviere-extract-config/src/types.ts (3)
  • Module (88-98)
  • DetectionRule (55-58)
  • ComponentType (5-5)
packages/riviere-extract-ts/src/index.ts (1)
  • DraftComponent (2-2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: main
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (13)
packages/riviere-extract-config/src/types.ts (2)

63-64: Type definition aligns with schema.

The CustomTypes type correctly mirrors the JSON schema's customTypes property definition using additionalProperties with detectionRule reference. Based on learnings, TypeScript types must mirror the schema definition to maintain consistency.


81-81: Optional customTypes field correctly added to both interfaces.

The field is appropriately optional in both ModuleConfig (for config files) and Module (for resolved configs), maintaining consistency between partial and resolved module representations.

Also applies to: 97-97

packages/riviere-extract-config/extraction-config.schema.json (1)

68-75: Schema extension correctly supports arbitrary custom type names.

The use of additionalProperties with $ref to detectionRule properly allows any string key while enforcing that each value must be a valid detection rule with find and where properties.

Note that an empty customTypes: {} object would be valid. If this is not desired, consider adding minProperties: 1.

packages/riviere-extract-ts/src/extractor.ts (5)

20-20: Type widening to string enables custom type support.

Changing DraftComponent.type from the ComponentType union to string is necessary to support arbitrary user-defined type names. This is a deliberate tradeoff: consumers lose compile-time checking for built-in types but gain extensibility for custom types.


98-102: Clean composition of built-in and custom components.

The extraction flow correctly processes built-in component types first, then custom types, and combines the results. The spread operator creates a new array, maintaining immutability.


105-116: Custom type extraction implemented as a pure function.

The function correctly handles the undefined case for modules without custom types and uses Object.entries to iterate over the type definitions. This follows the coding guideline to implement extraction logic as pure functions with no side effects.


118-137: Generic rule dispatch consolidates extraction logic.

extractWithRule provides a single entry point for rule-based extraction, routing to the appropriate handler based on rule.find. This reduces duplication between built-in and custom type extraction paths.

The defensive fallback at line 136 is appropriate given the type guards earlier in the flow.


139-150: Built-in component extraction refactored to use shared dispatch.

The refactoring maintains the existing behavior while delegating to extractWithRule, reducing code duplication. The isDetectionRule guard correctly filters out notUsed markers before processing.

packages/riviere-extract-ts/src/test-fixtures.ts (2)

8-22: Well-designed minimal module factory with override support.

The NOT_USED constant and createMinimalModule with spread overrides provide a clean, composable API for test fixtures. This follows the pattern from validation-fixtures.ts while adding override capability for test flexibility.


28-42: Clean helper for custom type test configurations.

createConfigWithCustomTypes correctly composes with createMinimalModule to create valid resolved configs with custom types. This enables focused tests for custom type extraction.

packages/riviere-extract-ts/src/extractor.spec.ts (3)

6-11: Test imports updated to use fixture helpers.

The refactoring to use createResolvedConfig, createOrdersUseCaseConfig, createConfigWithRule, and createConfigWithCustomTypes improves test maintainability by centralizing configuration creation.


297-381: Comprehensive test coverage for custom type extraction.

The new test suite covers all three find targets (functions, classes, methods) for custom types, verifying that:

  • Custom type names appear in the extracted component's type field
  • Detection predicates (hasJSDoc, nameEndsWith, hasDecorator) work correctly with custom types
  • Domain and location information is correctly populated

This follows the guideline to implement integration tests for end-to-end extraction from TypeScript code to JSON output.


174-177: Consistent refactoring to use createConfigWithRule helper.

The inline configuration objects are replaced with calls to createConfigWithRule, improving test readability and reducing duplication. The semantics remain unchanged.

Also applies to: 203-206, 230-233, 278-281

Comment thread packages/riviere-extract-config/src/validation.spec.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @packages/riviere-extract-ts/src/test-fixtures.ts:
- Around line 44-59: createConfigWithRule currently types componentType as keyof
Module which allows keys like "name" or "path" that don't hold DetectionRule;
restrict componentType to only the Module keys that map to DetectionRule (e.g.
define a new union type like ComponentRuleKey = /* keys in Module whose value is
DetectionRule */ or derive it with a mapped/extracted type) and change the
signature to use that type instead of keyof Module; update the
createMinimalModule call to use this narrowed componentType so the computed
property assignment [componentType]: rule is type-safe and prevents assigning
DetectionRule to non-rule fields.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 12f439a and 9fc93bb.

📒 Files selected for processing (1)
  • packages/riviere-extract-ts/src/test-fixtures.ts
🧰 Additional context used
📓 Path-based instructions (5)
packages/riviere-extract-ts/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/riviere-extract-ts/CLAUDE.md)

packages/riviere-extract-ts/**/*.{ts,tsx}: Use ts-morph for TypeScript AST parsing instead of other parsers
Implement extraction logic as pure functions with no side effects
Compose detection rules via and/or logic for predicates
Reject invalid extraction configs at load time, not during extraction phase
Use glob pattern matching for module-based organization of extraction rules

Files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Follow eslint configuration rules defined in eslint.config.mjs for all linting

Files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
**/*.{ts,tsx,js,jsx,css,scss,html}

📄 CodeRabbit inference engine (CLAUDE.md)

All UI and UX design must conform to global brand guidelines in /docs/brand/ (logo, colors, typography, icons)

Files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Do not log sensitive data (passwords, tokens, PII) in any code
Validate and sanitize all external input

Files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use cross-project imports with package names (e.g., import { X } from '@living-architecture/[pkg-name]') rather than relative paths

Files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
🧠 Learnings (22)
📓 Common learnings
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Applies to packages/riviere-extract-conventions/**/*.ts : Use `Custom(type)` decorator to annotate components with custom types not covered by standard decorators
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Import and use the default extraction config from `living-architecture/riviere-extract-conventions/default-config` in extraction tooling to detect all 6 component types
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Applies to packages/riviere-extract-config/**/*.ts : Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: packages/riviere-cli/src/commands/extract/config-loader.ts:31-39
Timestamp: 2026-01-11T14:38:35.637Z
Learning: In packages/riviere-cli/src/commands/extract/config-loader.ts, the isExtendedConfig type guard intentionally performs minimal validation (checks for non-null object and validates modules is an array if present) because comprehensive validation is handled downstream by the schema validator. The type guard's purpose is basic type narrowing to support both module-array and top-level-rules formats, not comprehensive validation. This follows the layered validation pattern where type guards are minimal and schema validation occurs at system boundaries.
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use ts-morph for TypeScript AST parsing instead of other parsers
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use the Rivière Builder Node.js library to programmatically construct the schema graph when implementing custom extraction code
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Extraction config schemas must define all six required component types per module: api, useCase, domainOp, event, eventHandler, and ui. Unused component types must be explicitly marked with `notUsed: true` rather than omitted
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 67
File: packages/riviere-extract-ts/tsconfig.spec.json:5-22
Timestamp: 2026-01-08T12:57:19.167Z
Learning: In tsconfig.spec.json files, use expanded types array ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest"] for complete test type coverage. Include patterns should cover .test and .spec files, config files (vitest.config.ts/mts, vite.config.ts/mts), multiple extensions (.ts, .tsx, .js, .jsx), and .d.ts files to ensure proper TypeScript coverage across the testing environment.
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*-fixtures.ts : Create fixture files with pattern '<module>-fixtures.ts' alongside '<module>.spec.ts' to reduce test duplication. Use a buildArgs helper to define defaults and override specific values in tests.

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Use ts-morph's in-memory file system (`useInMemoryFileSystem: true`) for fast isolated tests

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Applies to packages/riviere-extract-config/**/*.ts : Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Applies to packages/riviere-extract-conventions/**/*.ts : Use `Custom(type)` decorator to annotate components with custom types not covered by standard decorators

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-11T14:38:35.637Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: packages/riviere-cli/src/commands/extract/config-loader.ts:31-39
Timestamp: 2026-01-11T14:38:35.637Z
Learning: In packages/riviere-cli/src/commands/extract/config-loader.ts, the isExtendedConfig type guard intentionally performs minimal validation (checks for non-null object and validates modules is an array if present) because comprehensive validation is handled downstream by the schema validator. The type guard's purpose is basic type narrowing to support both module-array and top-level-rules formats, not comprehensive validation. This follows the layered validation pattern where type guards are minimal and schema validation occurs at system boundaries.

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Applies to packages/riviere-extract-conventions/**/*.ts : Use `Ignore` decorator to exclude classes or methods from architectural extraction analysis

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Compose detection rules via and/or logic for predicates

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T22:39:00.431Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 84
File: packages/riviere-extract-ts/src/extractor.ts:168-187
Timestamp: 2026-01-08T22:39:00.431Z
Learning: In ts-morph usage within the riviere-extract-ts package, MethodDeclaration.getName() always returns a string (never undefined) because methods cannot be anonymous in TypeScript. Only ClassDeclaration.getName() and FunctionDeclaration.getName() can return undefined. Therefore, remove undefined guards for MethodDeclaration when implementing createMethodComponent, and only keep guards for components that can actually be undefined (class/function components). Apply this guidance to all .ts files under packages/riviere-extract-ts/ (i.e., **/packages/riviere-extract-ts/**/*.ts).

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-09T20:08:30.350Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.spec.ts:33-38
Timestamp: 2026-01-09T20:08:30.350Z
Learning: In test files (*.spec.ts, *.test.ts), type guards like `isExtractionOutput(value: unknown): value is ExtractionOutput` should focus on narrowing types for TypeScript rather than comprehensive validation. Actual shape validation is handled through explicit test assertions (e.g., `expect(result).toMatchObject(...)`). This keeps type guards simple while maintaining thorough validation through assertion-based testing.

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Configure ESLint to enforce component decorators on classes using the `require-component-decorator` rule from `living-architecture/riviere-extract-conventions/eslint-plugin`

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Applies to packages/riviere-extract-conventions/**/*.ts : Use `UseCase`, `Event`, or `UI` class-level decorators to mark the class itself as a component

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Import and use the default extraction config from `living-architecture/riviere-extract-conventions/default-config` in extraction tooling to detect all 6 component types

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: All extraction rules should come from validated ExtractionConfig provided by riviere-extract-config

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use the Rivière Builder Node.js library to programmatically construct the schema graph when implementing custom extraction code

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-11T18:47:09.232Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: apps/eclair/src/components/SchemaModal/SchemaModal.cssModule.spec.ts:13-19
Timestamp: 2026-01-11T18:47:09.232Z
Learning: Encourage using const for declarations by default in TypeScript/JavaScript files and only use let when a variable must be reassigned. Do not rely on var. This improves immutability and clarity. If a variable needs mutation (e.g., counters in loops, reassigned values), use let, but prefer const whenever possible and refactor reassigned logic to avoid mutations where feasible.

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
packages/riviere-extract-ts/src/test-fixtures.ts (5)

1-6: LGTM!

Imports use proper package name imports per coding guidelines, and the import type syntax correctly indicates these are type-only imports.


8-22: LGTM!

Clean implementation of the fixture helper pattern. The NOT_USED sentinel and createMinimalModule with spread overrides follows the recommended pattern for test fixtures. This aligns with the project's requirement that all six component types must be explicitly defined per module. Based on learnings, this pattern reduces test boilerplate effectively.


24-26: LGTM!

Simple, pure factory function for creating a minimal default config.


28-42: LGTM!

Correctly supports the new customTypes feature with a clean factory pattern.


61-66: LGTM!

Clean convenience factory for a common test scenario. The detection rule structure correctly uses the find/where pattern with hasDecorator predicate.

Comment thread packages/riviere-extract-ts/src/test-fixtures.ts
- Add negative tests for invalid customTypes configs
- Restrict createConfigWithRule componentType to ComponentType
- Consolidate test cases to reduce file size

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @packages/riviere-extract-config/src/validation.spec.ts:
- Around line 390-408: Split the combined test of mapAjvErrors into three
focused specs: one named e.g. "maps instancePath to path" asserting that
mapAjvErrors([{ instancePath: '/modules/0', message: 'test' }])[0]?.path ===
'/modules/0'; one named e.g. "converts empty instancePath to root '/'" asserting
that mapAjvErrors([{ instancePath: '', message: 'test' }])[0]?.path === '/'; and
one named e.g. "defaults missing message to 'unknown error'" asserting that
mapAjvErrors([{ instancePath: '/test' }])[0]?.message === 'unknown error'.
Ensure each spec calls mapAjvErrors with only the relevant input and uses a
descriptive it() name so failures point to the specific mapping behavior.
- Around line 378-382: The test case mixes two distinct validation scenarios for
parseExtractionConfig: validating a missing modules property and validating an
empty modules array; split the single spec into two focused tests so each
asserts one behavior—create one test that calls parseExtractionConfig({}) and
expects ExtractionConfigValidationError with /Invalid extraction config/, and a
separate test that calls parseExtractionConfig({ modules: [] }) and expects an
error mentioning '/modules' (or the specific message used by the validator);
ensure both tests reference parseExtractionConfig and
ExtractionConfigValidationError so the intention is clear.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9fc93bb and eb1c08b.

📒 Files selected for processing (2)
  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
🧰 Additional context used
📓 Path-based instructions (6)
packages/riviere-extract-config/**/*.ts

📄 CodeRabbit inference engine (packages/riviere-extract-config/CLAUDE.md)

Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency

Files:

  • packages/riviere-extract-config/src/validation.spec.ts
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Follow eslint configuration rules defined in eslint.config.mjs for all linting

Files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
**/*.{ts,tsx,js,jsx,css,scss,html}

📄 CodeRabbit inference engine (CLAUDE.md)

All UI and UX design must conform to global brand guidelines in /docs/brand/ (logo, colors, typography, icons)

Files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Do not log sensitive data (passwords, tokens, PII) in any code
Validate and sanitize all external input

Files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use cross-project imports with package names (e.g., import { X } from '@living-architecture/[pkg-name]') rather than relative paths

Files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
packages/riviere-extract-ts/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/riviere-extract-ts/CLAUDE.md)

packages/riviere-extract-ts/**/*.{ts,tsx}: Use ts-morph for TypeScript AST parsing instead of other parsers
Implement extraction logic as pure functions with no side effects
Compose detection rules via and/or logic for predicates
Reject invalid extraction configs at load time, not during extraction phase
Use glob pattern matching for module-based organization of extraction rules

Files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
🧠 Learnings (40)
📓 Common learnings
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Applies to packages/riviere-extract-conventions/**/*.ts : Use `Custom(type)` decorator to annotate components with custom types not covered by standard decorators
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Import and use the default extraction config from `living-architecture/riviere-extract-conventions/default-config` in extraction tooling to detect all 6 component types
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Applies to packages/riviere-extract-config/**/*.ts : Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: packages/riviere-cli/src/commands/extract/config-loader.ts:31-39
Timestamp: 2026-01-11T14:38:35.637Z
Learning: In packages/riviere-cli/src/commands/extract/config-loader.ts, the isExtendedConfig type guard intentionally performs minimal validation (checks for non-null object and validates modules is an array if present) because comprehensive validation is handled downstream by the schema validator. The type guard's purpose is basic type narrowing to support both module-array and top-level-rules formats, not comprehensive validation. This follows the layered validation pattern where type guards are minimal and schema validation occurs at system boundaries.
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Extraction config schemas must define all six required component types per module: api, useCase, domainOp, event, eventHandler, and ui. Unused component types must be explicitly marked with `notUsed: true` rather than omitted
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Use Zod for runtime validation. In TypeScript, use Zod schemas for parsing external data, API responses, and user input. Type inference from schemas keeps types and validation in sync.
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Wrap all primitives and strings. Create value objects, encapsulate validation logic, and make domain concepts explicit.
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Parse, don't validate. Use Zod schemas at system boundaries to parse external data once. Don't scatter `isX(unknown): x is T` type guards throughout the codebase.
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 67
File: packages/riviere-extract-ts/tsconfig.spec.json:5-22
Timestamp: 2026-01-08T12:57:19.167Z
Learning: In tsconfig.spec.json files, use expanded types array ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest"] for complete test type coverage. Include patterns should cover .test and .spec files, config files (vitest.config.ts/mts, vite.config.ts/mts), multiple extensions (.ts, .tsx, .js, .jsx), and .d.ts files to ensure proper TypeScript coverage across the testing environment.
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/standard-patterns.md:0-0
Timestamp: 2026-01-02T17:46:32.292Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Use Zod for creating branded types
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Applies to packages/riviere-extract-config/**/*.ts : Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement unit tests for each predicate type in isolation with positive and negative cases

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-11T14:38:35.637Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: packages/riviere-cli/src/commands/extract/config-loader.ts:31-39
Timestamp: 2026-01-11T14:38:35.637Z
Learning: In packages/riviere-cli/src/commands/extract/config-loader.ts, the isExtendedConfig type guard intentionally performs minimal validation (checks for non-null object and validates modules is an array if present) because comprehensive validation is handled downstream by the schema validator. The type guard's purpose is basic type narrowing to support both module-array and top-level-rules formats, not comprehensive validation. This follows the layered validation pattern where type guards are minimal and schema validation occurs at system boundaries.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T12:57:19.167Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 67
File: packages/riviere-extract-ts/tsconfig.spec.json:5-22
Timestamp: 2026-01-08T12:57:19.167Z
Learning: In tsconfig.spec.json files, use expanded types array ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest"] for complete test type coverage. Include patterns should cover .test and .spec files, config files (vitest.config.ts/mts, vite.config.ts/mts), multiple extensions (.ts, .tsx, .js, .jsx), and .d.ts files to ensure proper TypeScript coverage across the testing environment.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/vitest.config.mts : Enforce 100% code coverage using Vitest with v8 coverage and thresholds configured in vitest.config.mts

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-09T20:08:30.350Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.spec.ts:33-38
Timestamp: 2026-01-09T20:08:30.350Z
Learning: In test files, keep type guard implementations like isExtractionOutput(value: unknown): value is ExtractionOutput focused on narrowing types for TypeScript. Do not perform comprehensive runtime shape validation in type guards; rely on explicit test assertions (e.g., expect(result).toMatchObject(...)) for shape checks. This keeps type guards simple and rely on assertion-based tests for thorough validation.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Systematically test edge cases for collections: empty collections, single element, duplicates, nested structures, circular references, large collections, sparse arrays, and mixed types.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-08T06:46:00.609Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 66
File: packages/riviere-extract-conventions/src/eslint/require-component-decorator.spec.ts:19-21
Timestamp: 2026-01-08T06:46:00.609Z
Learning: In test files using typescript-eslint/rule-tester's RuleTester.run(), ensure there is an explicit it() block with at least one expect() assertion (e.g., expect(rule).toBeDefined()) to satisfy sonarjs/no-empty-test-file and sonarjs/assertions-in-tests lint rules, which don’t recognize RuleTester's internal test blocks. Apply this pattern to all spec.ts test files to maintain consistency and pass lint checks.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Systematically test null and undefined cases: null input, undefined input, missing optional properties, and explicit undefined vs missing key distinction.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Systematically test edge cases for numbers: zero, negative numbers, very large/small numbers, decimal precision (0.1 + 0.2), NaN, Infinity/-Infinity, and boundary values.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: All validation of extraction config must occur at config load time, not during extraction. Invalid configs should fail fast with clear error messages that include paths and descriptive information

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Extraction config schemas must define all six required component types per module: api, useCase, domainOp, event, eventHandler, and ui. Unused component types must be explicitly marked with `notUsed: true` rather than omitted

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Extraction config must support exactly eight predicate types that can be composed with and/or logic to filter architectural components

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Write one concept per test. Each test should verify one behavior. If you need 'and' in your test name, split it into multiple tests.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: The `where` field in extraction config describes filter predicates that qualify components. Predicates must directly match the extraction target (e.g., `hasDecorator` for decorated items, `inClassWith` for methods within qualifying classes)

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Assert specific values, not types. Use expect(result).toEqual(['First.', ' Second.']) not expect(result).toBeDefined(). Specific assertions catch specific bugs.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : When testing errors, test both error type and message in a single test—they represent one error condition. For example: expect(() => loadConfig('nonexistent.json')).toThrow(ConfigurationError) and expect(() => loadConfig('nonexistent.json')).toThrow('Config file not found')

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Compose detection rules via and/or logic for predicates

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-09T20:08:44.180Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.ts:109-114
Timestamp: 2026-01-09T20:08:44.180Z
Learning: Applies to packages/riviere-cli/src/commands/extract/**/*.{ts,tsx} : CLI extraction commands should only catch and format expected validation errors as structured JSON. System-level exceptions (disk I/O failures, OOM, AST parse errors) should fail loudly with stack traces for debugging rather than being wrapped in try-catch and converted to JSON errors. This follows the fail-fast principle: validate inputs explicitly, then let unexpected failures surface clearly.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-10T08:54:09.466Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 96
File: apps/docs/.vitepress/theme/eclairLinkHandler.spec.ts:229-249
Timestamp: 2026-01-10T08:54:09.466Z
Learning: In jsdom test environments, window.location.assign cannot be spied on due to TypeError: Cannot redefine property. Use Object.defineProperty to mock the entire window.location object, replacing it with a controlled mock, and restore the original in afterEach. Ensure to clean up the mock after each test to avoid side effects.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-11T18:47:09.232Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: apps/eclair/src/components/SchemaModal/SchemaModal.cssModule.spec.ts:13-19
Timestamp: 2026-01-11T18:47:09.232Z
Learning: In test files matching *.spec.ts or *.test.ts, avoid using try/catch blocks for testing error conditions. Prefer assertion library matchers like expect(...).toThrow() or expect(...).rejects.toThrow() to assert errors.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
📚 Learning: 2026-01-11T18:47:09.232Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: apps/eclair/src/components/SchemaModal/SchemaModal.cssModule.spec.ts:13-19
Timestamp: 2026-01-11T18:47:09.232Z
Learning: Encourage using const for declarations by default in TypeScript/JavaScript files and only use let when a variable must be reassigned. Do not rely on var. This improves immutability and clarity. If a variable needs mutation (e.g., counters in loops, reassigned values), use let, but prefer const whenever possible and refactor reassigned logic to avoid mutations where feasible.

Applied to files:

  • packages/riviere-extract-config/src/validation.spec.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*-fixtures.ts : Create fixture files with pattern '<module>-fixtures.ts' alongside '<module>.spec.ts' to reduce test duplication. Use a buildArgs helper to define defaults and override specific values in tests.

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Use ts-morph's in-memory file system (`useInMemoryFileSystem: true`) for fast isolated tests

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Applies to packages/riviere-extract-conventions/**/*.ts : Use `Custom(type)` decorator to annotate components with custom types not covered by standard decorators

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-09T20:08:30.350Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.spec.ts:33-38
Timestamp: 2026-01-09T20:08:30.350Z
Learning: In test files (*.spec.ts, *.test.ts), type guards like `isExtractionOutput(value: unknown): value is ExtractionOutput` should focus on narrowing types for TypeScript rather than comprehensive validation. Actual shape validation is handled through explicit test assertions (e.g., `expect(result).toMatchObject(...)`). This keeps type guards simple while maintaining thorough validation through assertion-based testing.

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-07T08:54:48.071Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/workflow/code-review.md:0-0
Timestamp: 2026-01-07T08:54:48.071Z
Learning: Applies to docs/workflow/**/*.{ts,tsx,js,jsx} : Check lint rules (eslint.config.mjs) before providing feedback to ensure suggestions don't contradict lint rules. Never suggest using banned keywords like 'as' or 'let'.

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T22:39:00.431Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 84
File: packages/riviere-extract-ts/src/extractor.ts:168-187
Timestamp: 2026-01-08T22:39:00.431Z
Learning: In ts-morph usage within the riviere-extract-ts package, MethodDeclaration.getName() always returns a string (never undefined) because methods cannot be anonymous in TypeScript. Only ClassDeclaration.getName() and FunctionDeclaration.getName() can return undefined. Therefore, remove undefined guards for MethodDeclaration when implementing createMethodComponent, and only keep guards for components that can actually be undefined (class/function components). Apply this guidance to all .ts files under packages/riviere-extract-ts/ (i.e., **/packages/riviere-extract-ts/**/*.ts).

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Strive for maximum type-safety. No `any`. No `as` (except `as const` which is allowed). Type escape hatches defeat TypeScript's purpose.

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-07T08:54:48.071Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/workflow/code-review.md:0-0
Timestamp: 2026-01-07T08:54:48.071Z
Learning: Applies to docs/workflow/**/*.{ts,tsx,js,jsx} : Review usage of `/* v8 ignore next -- preserve */` coverage skip directives. This is only acceptable for unreachable code needed to satisfy the compiler. Most cases should be solved by extracting code or writing tests to mock behavior.

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Import and use the default extraction config from `living-architecture/riviere-extract-conventions/default-config` in extraction tooling to detect all 6 component types

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: All extraction rules should come from validated ExtractionConfig provided by riviere-extract-config

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use the Rivière Builder Node.js library to programmatically construct the schema graph when implementing custom extraction code

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: main
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (10)
packages/riviere-extract-ts/src/test-fixtures.ts (6)

1-7: LGTM!

The imports correctly use cross-project package names and import type for type-only imports, which aligns with the coding guidelines.


9-23: LGTM!

The NOT_USED sentinel and createMinimalModule helper follow good patterns:

  • The sentinel correctly uses notUsed: true as required by the extraction config schema for marking unused component types.
  • The helper follows the recommended fixture pattern of defining defaults with overrides, reducing boilerplate across test configurations.

25-27: LGTM!

Simple, pure factory function providing a baseline valid configuration for tests.


29-43: LGTM!

Clean factory function supporting the new customTypes feature. Correctly separated from createConfigWithRule since custom types use a different structure (a Record<string, DetectionRule> rather than a single component type field).


45-60: LGTM!

The function correctly constrains componentType to the ComponentType enum, ensuring type safety for built-in component types. Custom types are properly handled separately via createConfigWithCustomTypes.


62-67: LGTM!

Useful convenience function that reduces test boilerplate for a common orders/useCase test scenario, properly delegating to createConfigWithRule.

packages/riviere-extract-config/src/validation.spec.ts (4)

41-48: LGTM!

Good use of parameterized tests to consolidate similar negative test cases. The descriptive labels make test output readable.


150-178: LGTM!

Good coverage for the new customTypes feature with both a valid detection rule and the edge case of an empty object. The tests align with the schema requirements (find + where).


259-275: LGTM!

Good consolidation of the and/or predicate validation tests. Testing with exactly one item correctly validates the minimum items constraint.


314-336: LGTM!

Comprehensive negative test coverage for customTypes validation. The parameterized approach efficiently covers missing required properties and invalid values.

Comment thread packages/riviere-extract-config/src/validation.spec.ts
Comment thread packages/riviere-extract-config/src/validation.spec.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add custom type support to extraction config schema

1 participant