Skip to content

fix(riviere-extract-ts): handle absolute paths in module matching - #138

Merged
NTCoding merged 2 commits into
mainfrom
issue-48-m5-d5-1-update-ecommerce-demo-
Jan 12, 2026
Merged

NTCoding merged 2 commits into
mainfrom
issue-48-m5-d5-1-update-ecommerce-demo-

Conversation

@NTCoding

@NTCoding NTCoding commented Jan 12, 2026 •

Copy link
Copy Markdown
Owner

User description

Closes #48

Summary

  • Fixes path matching bug in riviere-extract-ts where findMatchingModule() receives absolute file paths but matches against relative glob patterns
  • Added optional configDir parameter to extractComponents() to convert absolute paths to relative
  • CLI extract command now passes configDir when calling extractComponents()
  • Added comprehensive tests for absolute path handling on Unix and Windows

Test plan

  • All existing tests pass
  • Added new tests for absolute path handling (Unix and Windows)
  • Verified module matching works with absolute paths
  • Verified behavior unchanged when configDir not provided
  • Code review passed
  • Bug scanner passed
  • Task check passed

🤖 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 configDir parameter to convert absolute paths to relative paths

  • CLI extract command now passes configDir when calling extractComponents()

  • Adds comprehensive tests for Unix and Windows absolute path handling


Diagram Walkthrough

flowchart LR
  CLI["CLI extract command"]
  EXT["extractComponents function"]
  FIND["findMatchingModule function"]
  MATCH["Module path matching"]
  
  CLI -- "passes configDir" --> EXT
  EXT -- "converts absolute to relative" --> FIND
  FIND -- "matches against glob patterns" --> MATCH
Loading

File Walkthrough

Relevant files
Enhancement
extract.ts
Pass configDir to extractComponents                                           

packages/riviere-cli/src/commands/extract/extract.ts

  • Passes configDir parameter to extractComponents() function call
  • Enables absolute path resolution in the extraction process
+1/-1     
Bug fix
extractor.ts
Implement absolute to relative path conversion                     

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

  • Adds optional configDir parameter to extractComponents() and
    extractFromFile() functions
  • Imports relative from node:path for path conversion
  • Updates findMatchingModule() to convert absolute paths to relative
    when configDir is provided
  • Uses relative() and path normalization to handle both Unix and Windows
    paths
+19/-4   
Tests
extractor.spec.ts
Add absolute path handling tests                                                 

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

  • Adds import for createOrdersUseCaseConfig test fixture
  • Adds test for extracting components with absolute Unix paths and
    configDir
  • Adds test for handling absolute paths outside configDir boundary
  • Adds test for Windows absolute paths with configDir parameter
+89/-1   
test-fixtures.ts
Add orders use case test fixture                                                 

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

  • Adds new createOrdersUseCaseConfig() test fixture function
  • Provides configurable module path for testing orders domain extraction
  • Includes UseCase detection rule for testing component extraction
+20/-0   

Summary by CodeRabbit

  • New Features

    • Improved component extraction to support a configurable base directory, enabling reliable matching for absolute paths and better cross-platform path handling.
  • Tests

    • Added tests covering absolute path scenarios (including Windows-style paths) and config-directory relative matching to ensure consistent behavior across platforms.

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

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]>
@coderabbitai

coderabbitai Bot commented Jan 12, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds an optional configDir parameter threaded from the CLI into extractComponents → extractFromFile → findMatchingModule, and updates matching logic to resolve absolute file paths relative to configDir. Tests and fixtures added for POSIX and Windows absolute-path scenarios.

Changes

Cohort / File(s) Summary
CLI Integration
packages/riviere-cli/src/commands/extract/extract.ts
Updated call site to pass configDir to extractComponents.
Extractor Core
packages/riviere-extract-ts/src/extractor.ts
Added optional configDir?: string to extractComponents, extractFromFile, and findMatchingModule; uses POSIX normalization and computes config-relative path for minimatch comparisons.
Tests
packages/riviere-extract-ts/src/extractor.spec.ts
Added tests covering absolute POSIX paths, Windows-style absolute paths, and files outside configDir; imports new fixture helper.
Test Fixtures
packages/riviere-extract-ts/src/test-fixtures.ts
Added createOrdersUseCaseConfig(modulePath = 'orders/**') helper to generate an orders module config used by new tests.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 I hopped through folders, near and far,

ConfigDir now guides each file by star,
POSIX or Windows, the match is true,
Globs and paths aligned anew—
A tiny rabbit cheers the crew!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix(riviere-extract-ts): handle absolute paths in module matching' clearly and specifically describes the main change—fixing path matching for absolute paths—and aligns with the primary objective.
Linked Issues check ✅ Passed The PR fully implements all scope-change acceptance criteria from issue #48: extractComponents accepts optional configDir [extractor.ts], findMatchingModule converts absolute paths to relative [extractor.ts], CLI passes configDir [extract.ts], and tests verify absolute path handling [extractor.spec.ts].
Out of Scope Changes check ✅ Passed All changes are in-scope: extractor.ts/extract.ts implement path-matching fixes, test-fixtures.ts adds helper for new tests, and extractor.spec.ts adds comprehensive path handling tests—all directly supporting the linked issue requirements.

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

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e7a985 and c2ef877.

📒 Files selected for processing (1)
  • packages/riviere-extract-ts/src/extractor.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/extractor.ts
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

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

Files:

  • packages/riviere-extract-ts/src/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-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-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-ts/src/extractor.ts
🧠 Learnings (18)
📓 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/**/*.{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/**/*.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: 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: 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: 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/**/*.{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-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/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.
📚 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/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-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-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-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*.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/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-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} : Implement extraction logic as pure functions with no side effects

Applied to files:

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

Applied to files:

  • packages/riviere-extract-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 ts-morph for TypeScript AST parsing instead of other parsers

Applied to files:

  • packages/riviere-extract-ts/src/extractor.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.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.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.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-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/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.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-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/extractor.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/extractor.ts
🧬 Code graph analysis (1)
packages/riviere-extract-ts/src/extractor.ts (1)
packages/riviere-extract-config/src/types.ts (2)
  • ResolvedExtractionConfig (108-111)
  • Module (84-93)
⏰ 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 (4)
packages/riviere-extract-ts/src/extractor.ts (4)

9-9: Good choice using posix for cross-platform path handling.

Using path.posix.relative() combined with backslash normalization provides explicit, predictable behavior across Windows and Unix systems.


60-71: Clean parameter propagation.

The optional configDir parameter is properly documented and threaded through to extractFromFile. Backward compatibility is maintained since the parameter is optional.


74-85: LGTM!

The parameter is correctly propagated to findMatchingModule where the path conversion logic resides.


240-251: Solid fix for the absolute path matching issue.

The implementation correctly:

  1. Maintains backward compatibility when configDir is not provided
  2. Normalizes both paths to forward slashes before using posix.relative()
  3. Converts absolute file paths to config-relative paths for glob matching

For files outside configDir, posix.relative() produces paths starting with ../, which naturally won't match typical relative globs—this is the expected and safe behavior.


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

@qodo-code-review

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

Copy link
Copy Markdown
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟡
🎫 #48
🟢 Fix the path matching bug in riviere-extract-ts where findMatchingModule() receives
absolute file paths but matches against relative glob patterns, causing empty extraction
results.
`extractComponents` accepts an optional `configDir` parameter.
`findMatchingModule` converts absolute paths to relative using `configDir`.
CLI passes `configDir` when calling `extractComponents`.
Tests verify absolute path handling (including Unix and Windows).
🔴 Update ecommerce-demo-app so each domain demonstrates a different extraction strategy
(orders: decorators; shipping: JSDoc; inventory: custom decorator mapping; payments:
naming convention).
Use module-based config (different rules per domain path) and keep all strategies in a
single config file.
Demo app updated to use the fixed CLI version.
⚪ `riviere-extract-ts` and `riviere-cli` packages released with the fix.
Codebase Duplication Compliance
⚪
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

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

Status: Passed

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

Generic: Meaningful Naming and Self-Documenting Code

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

Status: Passed

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

Generic: Robust Error Handling and Edge Case Management

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

Status: Passed

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

Generic: Secure Error Handling

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

Status: Passed

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

Generic: Secure Logging Practices

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

Status: Passed

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

Generic: Security-First Input Validation and Data Handling

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

Status: Passed

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

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

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying living-architecture with  Cloudflare Pages  Cloudflare Pages

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

View logs

@qodo-code-review

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

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
✅ Improve path handling for cross-platform compatibility
Suggestion Impact:The commit modified the same path-matching logic to use node:path's posix.relative for generating the relative path, which is a cross-platform-oriented adjustment. However, it did not implement the suggested ordering change (relative before normalization) nor the early return for paths outside configDir.

code diff:

@@ -6,7 +6,7 @@
   SourceFile,
 } from 'ts-morph'
 import { minimatch } from 'minimatch'
-import { relative } from 'node:path'
+import { posix } from 'node:path'
 import type {
   ResolvedExtractionConfig,
   ComponentType,
@@ -247,6 +247,6 @@
     return modules.find((m) => minimatch(normalized, m.path))
   }
   const normalizedConfigDir = configDir.replaceAll(/\\+/g, '/')
-  const pathToMatch = relative(normalizedConfigDir, normalized).replaceAll(/\\+/g, '/')
+  const pathToMatch = posix.relative(normalizedConfigDir, normalized)
   return modules.find((m) => minimatch(pathToMatch, m.path))

Improve path handling for cross-platform compatibility by performing path
operations before normalizing separators. Add an early return for paths outside
the configDir.

packages/riviere-extract-ts/src/extractor.ts [240-252]

 function findMatchingModule(
   filePath: string,
   modules: Module[],
   configDir?: string,
 ): Module | undefined {
-  const normalized = filePath.replaceAll(/\\+/g, '/')
   if (configDir === undefined) {
+    const normalized = filePath.replaceAll(/\\+/g, '/')
     return modules.find((m) => minimatch(normalized, m.path))
   }
-  const normalizedConfigDir = configDir.replaceAll(/\\+/g, '/')
-  const pathToMatch = relative(normalizedConfigDir, normalized).replaceAll(/\\+/g, '/')
+
+  const relativePath = relative(configDir, filePath)
+
+  // If path is outside the config dir, it can't match.
+  // path.sep is used for OS-agnostic check.
+  if (relativePath.startsWith(`..${sep}`)) {
+    return undefined
+  }
+
+  const pathToMatch = relativePath.replaceAll(/\\+/g, '/')
   return modules.find((m) => minimatch(pathToMatch, m.path))
 }

[Suggestion processed]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that path operations should be performed before normalization for better cross-platform robustness. The early return for paths outside configDir is a valid and clean improvement.

Medium
  • Update

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 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

📥 Commits

Reviewing files that changed from the base of the PR and between c5d60f9 and 8e7a985.

📒 Files selected for processing (4)
  • packages/riviere-cli/src/commands/extract/extract.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
  • packages/riviere-extract-ts/src/extractor.ts
  • packages/riviere-extract-ts/src/test-fixtures.ts
🧰 Additional context used
📓 Path-based instructions (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
  • packages/riviere-extract-ts/src/extractor.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

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

Files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

  • packages/riviere-extract-ts/src/test-fixtures.ts
  • packages/riviere-extract-ts/src/extractor.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-11T18:47:09.232Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: apps/eclair/src/components/SchemaModal/SchemaModal.cssModule.spec.ts:13-19
Timestamp: 2026-01-11T18:47:09.232Z
Learning: 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
  • packages/riviere-cli/src/commands/extract/extract.ts
  • packages/riviere-extract-ts/src/extractor.ts
  • packages/riviere-extract-ts/src/extractor.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use ts-morph for TypeScript AST parsing instead of other parsers

Applied to files:

  • packages/riviere-cli/src/commands/extract/extract.ts
  • packages/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.ts
  • packages/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 createOrdersUseCaseConfig fixture is well-designed with a parameterized modulePath for flexible test scenarios. It follows the pure function pattern per coding guidelines and aligns with the existing createResolvedConfig() structure.

packages/riviere-cli/src/commands/extract/extract.ts (1)

155-155: LGTM!

The configDir parameter is already computed earlier (line 131) and is now correctly passed to extractComponents. 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 relative import from node:path is appropriate for computing config-relative paths.


60-71: LGTM - Well-documented API extension.

The optional configDir parameter 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 createOrdersUseCaseConfig fixture 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 configDir don't match is essential. When relative() produces ../other/project/..., it correctly fails to match the orders/** 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 to relative(), which means the logic is platform-agnostic. The test validates that the normalization strategy works correctly.

Unit testing findMatchingModule directly 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.

Comment thread packages/riviere-extract-ts/src/extractor.ts
…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]>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[M5-D5.1] Update ecommerce-demo-app with multi-strategy extraction

1 participant