Repository navigation
fix(riviere-extract-ts): handle absolute paths in module matching - #138
Conversation
Fixes path matching bug where findMatchingModule() receives absolute file paths but matches against relative glob patterns. The module paths in extraction config are relative (e.g., 'orders/**'), but CLI passes absolute source file paths, causing match failures. Changes: - Add optional configDir parameter to extractComponents() - Convert absolute paths to relative in findMatchingModule() when configDir provided - Pass configDir from CLI extract command - Add tests for absolute path handling (Unix and Windows) This ensures module path matching works regardless of whether source file paths are relative or absolute. Co-Authored-By: Claude Opus 4.5 <[email protected]>
📝 WalkthroughWalkthroughAdds an optional Changes
Sequence Diagram(s)sequenceDiagram
participant CLI
participant Extractor
participant Matcher
participant FS as FileSystem
CLI->>Extractor: extractComponents(project, sourceFilePaths, config, configDir)
Extractor->>FS: read each source file
Extractor->>Matcher: findMatchingModule(filePath, modules, configDir)
Matcher->>Matcher: normalize configDir -> compute relative path -> minimatch
Matcher-->>Extractor: matching module or undefined
Extractor-->>CLI: return DraftComponent[] results
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
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
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (5)packages/riviere-extract-ts/**/*.{ts,tsx}📄 CodeRabbit inference engine (packages/riviere-extract-ts/CLAUDE.md)
Files:
**/*.{js,ts,jsx,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx,css,scss,html}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (18)📓 Common learnings📚 Learning: 2026-01-08T17:19:17.148ZApplied to files:
📚 Learning: 2026-01-08T07:05:01.766ZApplied to files:
📚 Learning: 2026-01-06T23:01:34.751ZApplied to files:
📚 Learning: 2026-01-08T17:19:17.148ZApplied to files:
📚 Learning: 2026-01-08T22:20:13.250ZApplied to files:
📚 Learning: 2026-01-08T22:20:13.250ZApplied to files:
📚 Learning: 2026-01-08T17:19:17.148ZApplied to files:
📚 Learning: 2026-01-08T17:19:17.148ZApplied to files:
📚 Learning: 2026-01-08T17:19:17.148ZApplied to files:
📚 Learning: 2026-01-08T22:20:13.250ZApplied to files:
📚 Learning: 2026-01-07T08:54:48.071ZApplied to files:
📚 Learning: 2026-01-08T19:36:17.306ZApplied to files:
📚 Learning: 2026-01-08T17:19:17.148ZApplied to files:
📚 Learning: 2026-01-08T12:57:19.167ZApplied to files:
📚 Learning: 2026-01-10T10:14:57.499ZApplied to files:
📚 Learning: 2026-01-08T22:39:00.431ZApplied to files:
📚 Learning: 2026-01-11T18:47:09.232ZApplied to files:
🧬 Code graph analysis (1)packages/riviere-extract-ts/src/extractor.ts (1)
⏰ 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)
🔇 Additional comments (4)
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: |
c2ef877
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2c836567.living-architecture.pages.dev |
| Branch Preview URL: | https://issue-48-m5-d5-1-update-ecom.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/extractor.ts:
- Around line 240-251: The path normalization logic in findMatchingModule is
defensive but unclear; replace the use of path.relative plus manual replaceAll
with an explicit POSIX-relative call: import/use path.posix.relative to compute
pathToMatch (and keep the initial normalization of filePath via replaceAll or
use path.posix.normalize if preferred), then call minimatch against modules as
before—i.e., use path.posix.relative(normalizedConfigDir, normalized) so
returned paths are consistently forward-slash across platforms and remove the
post-call replaceAll cleanup.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
packages/riviere-cli/src/commands/extract/extract.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 (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.tspackages/riviere-extract-ts/src/extractor.tspackages/riviere-extract-ts/src/extractor.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-ts/src/test-fixtures.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.tspackages/riviere-extract-ts/src/extractor.spec.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.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.tspackages/riviere-extract-ts/src/extractor.spec.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.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.tspackages/riviere-extract-ts/src/extractor.spec.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.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.tspackages/riviere-extract-ts/src/extractor.spec.ts
🧠 Learnings (29)
📓 Common learnings
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: 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: 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/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase
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.
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
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
📚 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.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.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} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Applied to files:
packages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.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 glob pattern matching for module-based organization of extraction rules
Applied to files:
packages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.tspackages/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 `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-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.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.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} : Reject invalid extraction configs at load time, not during extraction phase
Applied to files:
packages/riviere-extract-ts/src/test-fixtures.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.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.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-ts/src/test-fixtures.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.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} : Implement unit tests for each predicate type in isolation with positive and negative cases
Applied to files:
packages/riviere-extract-ts/src/test-fixtures.tspackages/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/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: 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/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.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.tspackages/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: 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.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.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.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: 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.tspackages/riviere-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.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-cli/src/commands/extract/extract.tspackages/riviere-extract-ts/src/extractor.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: In packages/riviere-cli/src/commands/extract/**/*.{ts,tsx}, CLI extraction commands should only catch and format expected validation errors as structured JSON. Do not wrap or convert system-level exceptions (e.g., disk I/O failures, OOM, AST parse errors) into JSON errors; instead, fail loudly with stack traces to aid debugging. Follow fail-fast principles: validate inputs explicitly, and surface unexpected failures clearly.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.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/extractor.tspackages/riviere-extract-ts/src/extractor.spec.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 **/*.{ts,tsx} : Use cross-project imports with package names (e.g., `import { X } from 'living-architecture/[pkg-name]'`) rather than relative paths
Applied to files:
packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-08T19:36:17.306Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/codebase-structure.md:0-0
Timestamp: 2026-01-08T19:36:17.306Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Use living-architecture/[pkg-name] for imports from other workspace projects, not relative paths like ../../packages/[pkg-name].
Applied to files:
packages/riviere-extract-ts/src/extractor.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/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/extractor.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/extractor.spec.ts
📚 Learning: 2026-01-08T19:36:17.306Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/codebase-structure.md:0-0
Timestamp: 2026-01-08T19:36:17.306Z
Learning: Applies to docs/conventions/apps/*/src/**/*.test.ts : Test fixtures used across multiple test files may be grouped in shared locations (e.g., test-fixtures.ts), but otherwise test files should be co-located with the code they test.
Applied to files:
packages/riviere-extract-ts/src/extractor.spec.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/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-ts/src/extractor.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/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-ts/src/extractor.spec.ts
🧬 Code graph analysis (2)
packages/riviere-extract-ts/src/test-fixtures.ts (1)
packages/riviere-extract-config/src/types.ts (1)
ResolvedExtractionConfig(108-111)
packages/riviere-cli/src/commands/extract/extract.ts (1)
packages/riviere-extract-ts/src/extractor.ts (1)
extractComponents(63-72)
⏰ 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 (8)
packages/riviere-extract-ts/src/test-fixtures.ts (1)
19-37: LGTM!The new
createOrdersUseCaseConfigfixture is well-designed with a parameterizedmodulePathfor flexible test scenarios. It follows the pure function pattern per coding guidelines and aligns with the existingcreateResolvedConfig()structure.packages/riviere-cli/src/commands/extract/extract.ts (1)
155-155: LGTM!The
configDirparameter is already computed earlier (line 131) and is now correctly passed toextractComponents. This enables the extractor to convert absolute source paths to config-relative paths before module matching.packages/riviere-extract-ts/src/extractor.ts (2)
9-9: LGTM - Import for path resolution.The
relativeimport fromnode:pathis appropriate for computing config-relative paths.
60-71: LGTM - Well-documented API extension.The optional
configDirparameter is properly documented in JSDoc and maintains backward compatibility (no breaking change when omitted).packages/riviere-extract-ts/src/extractor.spec.ts (4)
7-9: LGTM - Fixture import.Using the shared
createOrdersUseCaseConfigfixture reduces test duplication and aligns with testing conventions.
104-134: LGTM - Good coverage for absolute POSIX paths.This test correctly verifies that absolute paths are converted to config-relative paths for module matching. The assertions properly validate the component's location retains the absolute path while the domain is correctly resolved.
136-156: LGTM - Important negative case.Testing that paths outside
configDirdon't match is essential. Whenrelative()produces../other/project/..., it correctly fails to match theorders/**glob.
158-188: In-memory FS limitation noted but path normalization handles Windows compatibility.This test does run on ts-morph's in-memory file system and doesn't invoke true Windows
path.relative()behavior. However, the code pre-normalizes all paths to forward slashes before passing them torelative(), which means the logic is platform-agnostic. The test validates that the normalization strategy works correctly.Unit testing
findMatchingModuledirectly is not currently actionable since the function is not exported and is internal to the module. The current integration test provides adequate coverage of the Windows path handling logic through the pre-normalization approach already in place.
…ath handling Address CodeRabbit feedback to use path.posix.relative() instead of path.relative() + replaceAll() for cleaner, more explicit cross-platform path normalization. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|



User description
Closes #48
Summary
Test plan
🤖 Generated with Claude Code
PR Type
Bug fix
Description
Fixes path matching bug where absolute file paths fail to match relative glob patterns
Adds optional
configDirparameter to convert absolute paths to relative pathsCLI extract command now passes
configDirwhen callingextractComponents()Adds comprehensive tests for Unix and Windows absolute path handling
Diagram Walkthrough
File Walkthrough
extract.ts
Pass configDir to extractComponentspackages/riviere-cli/src/commands/extract/extract.ts
configDirparameter toextractComponents()function callextractor.ts
Implement absolute to relative path conversionpackages/riviere-extract-ts/src/extractor.ts
configDirparameter toextractComponents()andextractFromFile()functionsrelativefromnode:pathfor path conversionfindMatchingModule()to convert absolute paths to relativewhen
configDiris providedrelative()and path normalization to handle both Unix and Windowspaths
extractor.spec.ts
Add absolute path handling testspackages/riviere-extract-ts/src/extractor.spec.ts
createOrdersUseCaseConfigtest fixtureconfigDirconfigDirboundaryconfigDirparametertest-fixtures.ts
Add orders use case test fixturepackages/riviere-extract-ts/src/test-fixtures.ts
createOrdersUseCaseConfig()test fixture functionSummary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.