Repository navigation
feat(riviere-extract-config): add customTypes support to extraction config - #143
Conversation
…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]>
📝 WalkthroughWalkthroughAdds module-level Changes
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||||
Deploying living-architecture with
|
| 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 |
Remove export keyword from createMinimalModule as it's only used internally within test-fixtures.ts Co-Authored-By: Claude Opus 4.5 <[email protected]>
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
There was a problem hiding this comment.
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
📒 Files selected for processing (6)
packages/riviere-extract-config/extraction-config.schema.jsonpackages/riviere-extract-config/src/types.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/riviere-extract-ts/src/extractor.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.ts
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Follow eslint configuration rules defined in
eslint.config.mjsfor all linting
Files:
packages/riviere-extract-config/src/types.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-config/extraction-config.schema.jsonpackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-config/extraction-config.schema.jsonpackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-config/extraction-config.schema.jsonpackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-config/extraction-config.schema.jsonpackages/riviere-extract-ts/src/test-fixtures.tspackages/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.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-ts/src/test-fixtures.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/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.tspackages/riviere-extract-config/extraction-config.schema.jsonpackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-config/extraction-config.schema.jsonpackages/riviere-extract-ts/src/test-fixtures.tspackages/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.tspackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-config/extraction-config.schema.jsonpackages/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.tspackages/riviere-extract-config/src/validation.spec.tspackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/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.tspackages/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.tspackages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/riviere-extract-ts/src/extractor.spec.tspackages/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
CustomTypestype correctly mirrors the JSON schema'scustomTypesproperty definition usingadditionalPropertieswithdetectionRulereference. Based on learnings, TypeScript types must mirror the schema definition to maintain consistency.
81-81: OptionalcustomTypesfield correctly added to both interfaces.The field is appropriately optional in both
ModuleConfig(for config files) andModule(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
additionalPropertieswith$reftodetectionRuleproperly allows any string key while enforcing that each value must be a valid detection rule withfindandwhereproperties.Note that an empty
customTypes: {}object would be valid. If this is not desired, consider addingminProperties: 1.packages/riviere-extract-ts/src/extractor.ts (5)
20-20: Type widening tostringenables custom type support.Changing
DraftComponent.typefrom theComponentTypeunion tostringis 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
undefinedcase for modules without custom types and usesObject.entriesto 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.
extractWithRuleprovides a single entry point for rule-based extraction, routing to the appropriate handler based onrule.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. TheisDetectionRuleguard correctly filters outnotUsedmarkers before processing.packages/riviere-extract-ts/src/test-fixtures.ts (2)
8-22: Well-designed minimal module factory with override support.The
NOT_USEDconstant andcreateMinimalModulewith spread overrides provide a clean, composable API for test fixtures. This follows the pattern fromvalidation-fixtures.tswhile adding override capability for test flexibility.
28-42: Clean helper for custom type test configurations.
createConfigWithCustomTypescorrectly composes withcreateMinimalModuleto 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, andcreateConfigWithCustomTypesimproves test maintainability by centralizing configuration creation.
297-381: Comprehensive test coverage for custom type extraction.The new test suite covers all three
findtargets (functions, classes, methods) for custom types, verifying that:
- Custom type names appear in the extracted component's
typefield- 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 usecreateConfigWithRulehelper.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
There was a problem hiding this comment.
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
📒 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.mjsfor 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 typesyntax correctly indicates these are type-only imports.
8-22: LGTM!Clean implementation of the fixture helper pattern. The
NOT_USEDsentinel andcreateMinimalModulewith 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
customTypesfeature with a clean factory pattern.
61-66: LGTM!Clean convenience factory for a common test scenario. The detection rule structure correctly uses the
find/wherepattern withhasDecoratorpredicate.
- 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]>
|
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
packages/riviere-extract-config/src/validation.spec.tspackages/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.mjsfor all linting
Files:
packages/riviere-extract-config/src/validation.spec.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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.tspackages/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 typefor type-only imports, which aligns with the coding guidelines.
9-23: LGTM!The
NOT_USEDsentinel andcreateMinimalModulehelper follow good patterns:
- The sentinel correctly uses
notUsed: trueas 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
customTypesfeature. Correctly separated fromcreateConfigWithRulesince custom types use a different structure (aRecord<string, DetectionRule>rather than a single component type field).
45-60: LGTM!The function correctly constrains
componentTypeto theComponentTypeenum, ensuring type safety for built-in component types. Custom types are properly handled separately viacreateConfigWithCustomTypes.
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
customTypesfeature 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/orpredicate validation tests. Testing with exactly one item correctly validates the minimum items constraint.
314-336: LGTM!Comprehensive negative test coverage for
customTypesvalidation. The parameterized approach efficiently covers missing required properties and invalid values.



User description
Closes #142
Summary
customTypesproperty to module config for user-defined component typesDraftComponent.typefromComponentTypeenum tostringto support custom valuesTest plan
Generated with Claude Code
PR Type
Enhancement
Description
Add
customTypesproperty to module config for user-defined component typesEnable custom type detection using same rules as built-in types
Change
DraftComponent.typefrom enum to string for flexibilityRefactor extractor to process custom types alongside built-in types
Improve test fixtures with reusable helper functions
Diagram Walkthrough
File Walkthrough
types.ts
Add CustomTypes type and module interfacespackages/riviere-extract-config/src/types.ts
CustomTypestype asRecordcustomTypesoptional property toModuleConfiginterfacecustomTypesoptional property toModuleinterfaceextractor.ts
Refactor extractor for custom type supportpackages/riviere-extract-ts/src/extractor.ts
DraftComponent.typefromComponentTypeenum tostringextractCustomTypes()function to process custom type rulesextractComponentType()to use newextractWithRule()helpervalidation.spec.ts
Add customTypes validation testpackages/riviere-extract-config/src/validation.spec.ts
predicates
extractor.spec.ts
Add custom type extraction testspackages/riviere-extract-ts/src/extractor.spec.ts
classes, methods)
createConfigWithRule()andcreateConfigWithCustomTypes()test-fixtures.ts
Refactor test fixtures with helper functionspackages/riviere-extract-ts/src/test-fixtures.ts
createMinimalModule()helper for reusable module creationcreateConfigWithRule()helper for single-rule config creationcreateConfigWithCustomTypes()helper for custom type configcreation
createOrdersUseCaseConfig()to use new helpersNOT_USEDconstant to reduce duplicationextraction-config.schema.json
Add customTypes to JSON schemapackages/riviere-extract-config/extraction-config.schema.json
customTypesproperty to module schema as object typeSummary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.