Repository navigation
fix(riviere-extract-ts): preserve customTypes during module resolution - #152
Conversation
resolveModule and resolveModuleWithExtends were dropping customTypes from module config during resolution, making them unavailable for extraction. Changes: - resolveModule: Include customTypes from moduleConfig if defined - resolveModuleWithExtends: Merge customTypes from base and local configs (local overrides base for same type name) - Added 4 tests covering customTypes resolution scenarios Fixes #151 Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughResolve logic now preserves and propagates module-level Changes
Sequence Diagram(s)(omitted — changes are internal merging/resolution without multi-component runtime interaction) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
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: |
27f079c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://64d09abb.living-architecture.pages.dev |
| Branch Preview URL: | https://issue-151-fix-extract-ts-res.living-architecture.pages.dev |
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @packages/riviere-extract-ts/src/resolve-config.spec.ts:
- Around line 198-225: Add a unit test named something like "inherits
customTypes from base module when local has none" that uses a mocked
ConfigLoader (vi.fn() -> baseWithCustomTypes) where baseWithCustomTypes sets
Module.customTypes (e.g., service -> { find: 'classes', where: { nameEndsWith: {
suffix: 'Service' } } }) and the local module in the ExtractionConfig omits
customTypes; call resolveConfig(config, loader) and assert
result.modules[0]?.customTypes strictly equals the base customTypes to verify
mergeCustomTypes(base, undefined) returns the base.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
packages/riviere-extract-ts/src/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.ts
🧰 Additional context used
📓 Path-based instructions (4)
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/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.ts
**/*.{js,mjs,ts,tsx,json}
📄 CodeRabbit inference engine (CLAUDE.md)
Always use nx commands for build, test, lint operations. Do not run npm/pnpm directly in project folders
Files:
packages/riviere-extract-ts/src/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Use cross-project imports with package names (e.g.,import { X } from '@living-architecture/[pkg-name]'), not relative paths
When adding dependencies between projects, add"@living-architecture/[pkg-name]": "workspace:*"to the consuming project's package.json
Followdocs/conventions/software-design.mdwhen writing, editing, refactoring, or reviewing code
Look for and follow standard implementation patterns defined indocs/conventions/standard-patterns.md
Avoid anti-patterns documented in@docs/conventions/anti-patterns.md
Followdocs/conventions/testing.mdwhen writing tests. 100% test coverage is mandatory and enforced
Files:
packages/riviere-extract-ts/src/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Never commit secrets, API keys, or credentials. Use environment variables for sensitive configuration
Do not log sensitive data (passwords, tokens, PII). Validate and sanitize all external input
Files:
packages/riviere-extract-ts/src/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.ts
🧠 Learnings (23)
📓 Common learnings
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-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-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-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
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-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: 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
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: 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: 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
📚 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-ts/src/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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-ts/src/resolve-config.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 `Custom(type)` decorator to annotate components with custom types not covered by standard decorators
Applied to files:
packages/riviere-extract-ts/src/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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/resolve-config.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 glob pattern matching for module-based organization of extraction rules
Applied to files:
packages/riviere-extract-ts/src/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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-ts/src/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.ts
📚 Learning: 2026-01-13T11:37:59.334Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T11:37:59.334Z
Learning: Applies to vitest.config.ts : Add vitest.config.ts if tests are needed with 100% coverage as the default
Applied to files:
packages/riviere-extract-ts/src/resolve-config.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-ts/src/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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-ts/src/resolve-config.spec.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/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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-ts/src/resolve-config.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*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Applied to files:
packages/riviere-extract-ts/src/resolve-config.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: 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/resolve-config.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-ts/src/resolve-config.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/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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-ts/src/resolve-config.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-ts/src/resolve-config.spec.tspackages/riviere-extract-ts/src/resolve-config.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/resolve-config.ts
🧬 Code graph analysis (1)
packages/riviere-extract-ts/src/resolve-config.ts (1)
packages/riviere-extract-config/src/types.ts (2)
Module(93-103)ModuleConfig(76-87)
⏰ 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: main
🔇 Additional comments (6)
packages/riviere-extract-ts/src/resolve-config.ts (3)
74-84: LGTM! Clean pure function for merging customTypes.The
mergeCustomTypeshelper correctly handles all edge cases:
- Both undefined → returns undefined
- One undefined → spreading undefined yields
{}, so the defined value propagates- Both defined → shallow merge with local overriding base
This is a well-structured pure function consistent with the coding guidelines. Based on learnings, extraction logic should be pure functions with no side effects, which this follows.
46-46: LGTM!Correct use of conditional spreading to include
customTypesonly when defined, avoiding pollution of the returned object withundefinedvalues.
60-71: LGTM!The extends resolution correctly computes merged customTypes and conditionally includes them in the result. The merge is performed before constructing the return object, keeping the logic clear.
packages/riviere-extract-ts/src/resolve-config.spec.ts (3)
66-96: LGTM!Good test coverage for the non-extends scenario with customTypes. The assertion correctly verifies that customTypes are preserved in the resolved module.
227-268: LGTM!Excellent test for the merge behavior with distinct keys from base and local customTypes.
270-307: LGTM!Good coverage of the override scenario where local customType with the same name takes precedence over the inherited one.
Add test case for inheriting base module customTypes when local module omits them, verifying mergeCustomTypes(base, undefined) returns base. Addresses CodeRabbit feedback. Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/riviere-extract-ts/src/resolve-config.spec.ts (1)
65-340: Consider adding edge case tests for emptycustomTypesobjects.The current test suite covers the main scenarios well. Per testing conventions, you might want to add tests for edge cases like:
- Empty
customTypes: {}in local module- Empty
customTypes: {}in base module when merging- Nested edge cases (e.g., merge of empty base with populated local)
These would ensure the merging logic handles degenerate cases gracefully.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
packages/riviere-extract-ts/src/resolve-config.spec.ts
🧰 Additional context used
📓 Path-based instructions (4)
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/resolve-config.spec.ts
**/*.{js,mjs,ts,tsx,json}
📄 CodeRabbit inference engine (CLAUDE.md)
Always use nx commands for build, test, lint operations. Do not run npm/pnpm directly in project folders
Files:
packages/riviere-extract-ts/src/resolve-config.spec.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Use cross-project imports with package names (e.g.,import { X } from '@living-architecture/[pkg-name]'), not relative paths
When adding dependencies between projects, add"@living-architecture/[pkg-name]": "workspace:*"to the consuming project's package.json
Followdocs/conventions/software-design.mdwhen writing, editing, refactoring, or reviewing code
Look for and follow standard implementation patterns defined indocs/conventions/standard-patterns.md
Avoid anti-patterns documented in@docs/conventions/anti-patterns.md
Followdocs/conventions/testing.mdwhen writing tests. 100% test coverage is mandatory and enforced
Files:
packages/riviere-extract-ts/src/resolve-config.spec.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Never commit secrets, API keys, or credentials. Use environment variables for sensitive configuration
Do not log sensitive data (passwords, tokens, PII). Validate and sanitize all external input
Files:
packages/riviere-extract-ts/src/resolve-config.spec.ts
🧠 Learnings (26)
📓 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: 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-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-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 unit tests for each predicate type in isolation with positive and negative cases
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
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: 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
📚 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/resolve-config.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-ts/src/resolve-config.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} : Implement unit tests for each predicate type in isolation with positive and negative cases
Applied to files:
packages/riviere-extract-ts/src/resolve-config.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 `Custom(type)` decorator to annotate components with custom types not covered by standard decorators
Applied to files:
packages/riviere-extract-ts/src/resolve-config.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: 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/resolve-config.spec.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/resolve-config.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/resolve-config.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} : Reject invalid extraction configs at load time, not during extraction phase
Applied to files:
packages/riviere-extract-ts/src/resolve-config.spec.ts
📚 Learning: 2026-01-13T11:37:59.334Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T11:37:59.334Z
Learning: Applies to vitest.config.ts : Add vitest.config.ts if tests are needed with 100% coverage as the default
Applied to files:
packages/riviere-extract-ts/src/resolve-config.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/resolve-config.spec.ts
📚 Learning: 2026-01-11T22:42:12.408Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/anti-patterns.md:0-0
Timestamp: 2026-01-11T22:42:12.408Z
Learning: Applies to docs/conventions/**/packages/*/src/index.{ts,tsx} : Never export test fixtures from a package's public API for use by other packages. Each package should create its own local test fixtures to avoid fragile cross-package coupling.
Applied to files:
packages/riviere-extract-ts/src/resolve-config.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-ts/src/resolve-config.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} : Avoid implementation coupling in tests. Test behavior outcomes, not internal implementation details. For example, assert on result values rather than mock method call signatures.
Applied to files:
packages/riviere-extract-ts/src/resolve-config.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/resolve-config.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-ts/src/resolve-config.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 glob pattern matching for module-based organization of extraction rules
Applied to files:
packages/riviere-extract-ts/src/resolve-config.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-ts/src/resolve-config.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-ts/src/resolve-config.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-ts/src/resolve-config.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*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Applied to files:
packages/riviere-extract-ts/src/resolve-config.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: 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/resolve-config.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-ts/src/resolve-config.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/resolve-config.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-ts/src/resolve-config.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-ts/src/resolve-config.spec.ts
🧬 Code graph analysis (1)
packages/riviere-extract-ts/src/resolve-config.spec.ts (3)
packages/riviere-extract-config/src/types.ts (2)
ExtractionConfig(109-112)Module(93-103)packages/riviere-extract-ts/src/resolve-config.ts (2)
resolveConfig(21-29)ConfigLoader(13-13)packages/riviere-extract-ts/src/index.ts (2)
resolveConfig(6-6)ConfigLoader(6-6)
⏰ 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 (5)
packages/riviere-extract-ts/src/resolve-config.spec.ts (5)
66-96: LGTM!This test correctly verifies that
customTypesdefined in a non-extends module are preserved through resolution. The assertion properly validates the complete structure of the custom type definition.
198-225: LGTM!Test properly validates that local
customTypesare included when extending a base module that lacks its own custom types.
227-258: LGTM!This test validates the inheritance scenario where the local module omits
customTypesand inherits them entirely from the base module.
260-301: LGTM!Test correctly validates the merge behavior when both base and local modules define different
customTypes. The assertion confirms both entries are present in the merged result.
303-340: LGTM!Test validates the override semantics correctly: when a local
customTypeshares a key with an inherited one, the local definition takes precedence.
|



User description
Closes #151
Fixes #151
Summary
resolveModule and resolveModuleWithExtends were dropping customTypes from module config during resolution, making them unavailable for extraction.
Changes
Verification
PR Type
Bug fix
Description
Preserve customTypes in resolveModule function
Merge customTypes from base and local configs
Local customTypes override base for same names
Add comprehensive test coverage for customTypes resolution
Diagram Walkthrough
File Walkthrough
resolve-config.ts
Preserve and merge customTypes in module resolutionpackages/riviere-extract-ts/src/resolve-config.ts
customTypes
resolve-config.spec.ts
Add customTypes resolution test coveragepackages/riviere-extract-ts/src/resolve-config.spec.ts
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.