Skip to content

Conversation

data-douser
Copy link
Collaborator

What This PR Contributes

This pull request focuses on improving error handling and diagnostics in the CDS extractor, ensuring that failures in environment setup, dependency graph building, dependency installation, and project detection do not cause hard exits. Instead, diagnostics are logged and the extractor continues gracefully, allowing the JavaScript extractor to run even when CDS-specific steps fail. Additionally, the ESLint configuration is refactored for better separation between JavaScript and TypeScript files, and new tests verify these error handling improvements.

This commit addresses a regression in the behavior of the CDS extractor
in some cases and/or for some CAP projects. Specifically, this commit:

- Removes calls like `process.exit(1)` from the CDS extractor codebase.
- Adds new diagnostic warnings for error conditions that had previously
  resulted in a non-zero exit code being returned from
`cds-extractor.ts`.
- Adds unit tests to ensure that fails if the `cds-extractor.ts` file
  contains any `process.exit(n)` call where `n != 0`.
- Updates eslint configs for the CDS extractor to resolve reported
  errors.
@data-douser data-douser requested a review from Copilot August 19, 2025 02:07
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request improves error handling in the CDS extractor by replacing hard exits with diagnostic logging, ensuring the JavaScript extractor can continue processing even when CDS-specific operations fail. The changes focus on graceful degradation when CDS processing encounters issues while maintaining overall extraction functionality.

  • Replace process.exit(1) calls with diagnostic logging and graceful continuation
  • Add new diagnostic functions for different failure scenarios (environment setup, dependency graph, dependency installation, no CDS projects)
  • Update ESLint configuration to better separate JavaScript and TypeScript file handling

Reviewed Changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
extractors/cds/tools/cds-extractor.ts Replace hard exits with diagnostic logging and graceful fallback to JavaScript extraction
extractors/cds/tools/src/diagnostics.ts Add new diagnostic functions for various CDS extractor failure scenarios
extractors/cds/tools/test/cds-extractor.test.ts Add comprehensive tests to verify exit code safety and diagnostic usage
extractors/cds/tools/package.json Update lint commands to include new test files and adjust coverage collection
extractors/cds/tools/eslint.config.mjs Refactor ESLint configuration with better separation between JS and TS files

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

This commit addresses a regression in the behavior of the CDS extractor
in some cases and/or for some CAP projects. Specifically, this commit:

- Removes calls like `process.exit(1)` from the CDS extractor codebase.
- Adds new diagnostic warnings for error conditions that had previously
  resulted in a non-zero exit code being returned from
`cds-extractor.ts`.
- Adds unit tests to ensure that fails if the `cds-extractor.ts` file
  contains any `process.exit(n)` call where `n != 0`.
- Updates eslint configs for the CDS extractor to resolve reported
  errors.
@data-douser data-douser marked this pull request as ready for review August 19, 2025 02:37
Copy link
Contributor

@jeongsoolee09 jeongsoolee09 left a comment

Choose a reason for hiding this comment

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

LGTM!

@jeongsoolee09 jeongsoolee09 merged commit 2c5761a into advanced-security:main Aug 19, 2025
6 checks passed
@data-douser data-douser deleted the cds-compile-retry branch August 19, 2025 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants