Skip to content

v10.0.9#38

Merged
yilmaztayfun merged 2 commits into
release-v1.0from
master
Jun 10, 2026
Merged

v10.0.9#38
yilmaztayfun merged 2 commits into
release-v1.0from
master

Conversation

@yilmaztayfun

@yilmaztayfun yilmaztayfun commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Adjust CSX JSON update logic and glob path handling for cross-platform correctness.

Bug Fixes:

  • Ensure CSX code updates only modify entries with B64 or NAT encoding, leaving other encodings (e.g. REF) untouched.
  • Fix glob patterns on Windows by normalizing component discovery and reset/workflow JSON/CSX searches to use forward-slash paths, restoring recursive file matching.

Enhancements:

  • Clarify and document encoding semantics for CSX code handling, including behavior for absent, B64, NAT, and other encodings.
  • Expose a reusable toGlobPattern helper for building glob-compatible paths and reuse it across discovery, reset, and workflow utilities.

yilmaztayfun and others added 2 commits June 10, 2026 22:55
Closes #36. Component discovery built glob patterns with path.join, which
emits "\" separators on Windows. glob treats backslashes as escape chars,
so "**" recursion broke and flows in nested subdirectories were never
matched. Added a toGlobPattern() helper in discover.js that always emits
forward slashes, and routed all four glob pattern builders through it
(discover, workflow, reset).

Also refine CSX "encoding" handling in updateCodeInJson:
- absent / B64 -> Base64 (default, unchanged)
- NAT          -> native source written as-is (stored as an escaped JSON
                  string via the document serialization)
- any other value (e.g. REF) -> left untouched (previously REF entries
  were incorrectly overwritten with Base64)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ly-discover-flows-in-nested-subdirectories

fix(cli): recursive nested discovery on Windows + CSX encoding handling
@yilmaztayfun yilmaztayfun self-assigned this Jun 10, 2026
@yilmaztayfun yilmaztayfun requested review from a team June 10, 2026 19:57
@sourcery-ai

sourcery-ai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Refines CSX encoding semantics and updates glob path handling to be OS-agnostic (especially on Windows) by centralizing forward-slash glob pattern construction and reusing it across discovery, reset, and workflow utilities.

Flow diagram for CSX encoding handling in updateCodeInJson

flowchart TD
  A[updateCodeInJson] --> B[Read obj.encoding]
  B --> C{encoding value}
  C -->|absent or B64| D[Set obj.code = base64Code
Increment updateCount]
  C -->|NAT| E[Set obj.code = nativeCode
Increment updateCount]
  C -->|other e.g REF| F[Leave obj.code unchanged
Do not increment updateCount]
Loading

File-Level Changes

Change Details Files
Tighten CSX JSON encoding semantics so only B64 and NAT encodings are updated while others are left untouched, and clarify documentation.
  • Clarified JSDoc for CSX JSON update to describe how absent/B64, NAT, and other encoding values are handled.
  • Changed encoding-handling logic to treat B64 as the default, updating code with the provided Base64 content and incrementing update counts only when B64 or NAT are processed.
  • Ensured NAT encoding stores the native source while relying on JSON stringification to produce a valid escaped JSON string, and explicitly skipped non-B64/NAT encodings such as REF.
src/lib/csx.js
Introduce a reusable glob pattern helper that normalizes paths to forward slashes to fix recursive globbing on Windows and apply it across discovery-related code.
  • Added a toGlobPattern helper that joins a base directory and suffix, then normalizes path separators to forward slashes for glob compatibility.
  • Replaced direct path.join usage for JSON and CSX discovery patterns with toGlobPattern in discover components, reset command, and workflow utilities.
  • Exported toGlobPattern from the discover module and updated imports in reset and workflow modules to reuse the shared helper.
src/lib/discover.js
src/commands/reset.js
src/lib/workflow.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d8506be7-051e-4848-82c2-984b918085d5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch master

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@yilmaztayfun yilmaztayfun merged commit e82e3a3 into release-v1.0 Jun 10, 2026
3 of 5 checks passed
@sonarqubecloud

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a toGlobPattern helper function to resolve Windows compatibility issues by ensuring glob patterns use forward slashes instead of backslashes. It also refactors CSX encoding handling in src/lib/csx.js to support 'B64' and 'NAT' encodings while skipping others. The review feedback recommends adding a defensive check when processing obj.encoding to prevent potential runtime TypeError crashes if the property is not a string.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/lib/csx.js
// absent / B64 -> Base64 (default)
// NAT -> JSON-stringified native source
// anything else (e.g. REF) -> leave untouched
const encoding = obj.encoding ? obj.encoding.toUpperCase() : 'B64';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

If obj.encoding is not a string (for example, if it is a boolean, number, or null), calling .toUpperCase() directly will throw a TypeError and crash the process.\n\nTo prevent runtime crashes when processing unexpected JSON structures, we should defensively check that obj.encoding is a non-empty string before calling string methods on it.

Suggested change
const encoding = obj.encoding ? obj.encoding.toUpperCase() : 'B64';
const encoding = typeof obj.encoding === 'string' && obj.encoding.trim() ? obj.encoding.trim().toUpperCase() : 'B64';

@sourcery-ai sourcery-ai 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.

Hey - I've found 1 issue, and left some high level feedback:

  • In updateCodeInJson, encoding is now taken as obj.encoding.toUpperCase() without falling back when the property exists but is an empty string; if you still intend empty-string encodings to behave like the default Base64 case, consider normalizing falsy values (e.g. const encoding = (obj.encoding || 'B64').toUpperCase();).
  • The glob ignore lists (e.g. ['**/.meta/**', '**/node_modules/**', '**/dist/**']) are duplicated across multiple functions; consider centralizing these patterns in a shared constant to keep them consistent and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `updateCodeInJson`, `encoding` is now taken as `obj.encoding.toUpperCase()` without falling back when the property exists but is an empty string; if you still intend empty-string encodings to behave like the default Base64 case, consider normalizing falsy values (e.g. `const encoding = (obj.encoding || 'B64').toUpperCase();`).
- The glob ignore lists (e.g. `['**/.meta/**', '**/node_modules/**', '**/dist/**']`) are duplicated across multiple functions; consider centralizing these patterns in a shared constant to keep them consistent and easier to maintain.

## Individual Comments

### Comment 1
<location path="src/lib/discover.js" line_range="12-15" />
<code_context>
+ * with path.join (which uses "\") breaks "**" recursion and nested files are
+ * never matched. Always feed glob forward-slash separators.
+ * @param {string} dir - Base directory
+ * @param {string} suffix - Glob suffix, e.g. "**\/*.json"
+ * @returns {string} Forward-slash glob pattern
+ */
+function toGlobPattern(dir, suffix) {
+  return path.join(dir, suffix).split(path.sep).join('/');
+}
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Normalize backslashes in `suffix` as well, not just `path.sep` from `path.join`.

The example `suffix` (`"**\/*.json"`) contains backslashes, but `toGlobPattern` only normalizes `path.sep` from `path.join(dir, suffix)`. On POSIX, `path.sep` is `/`, so any `"\\"` in `suffix` stay unmodified and may break globbing. Consider also replacing all backslashes with forward slashes (either in `suffix` before `path.join` or on the final string) so Windows-style separators in `suffix` are handled correctly on all platforms.

Suggested implementation:

```javascript
 * @param {string} suffix - Glob suffix, e.g. "**/*.json"

```

```javascript
function toGlobPattern(dir, suffix) {
  // Normalize all path separators (including any backslashes in `suffix`) to forward slashes
  return path.join(dir, suffix).replace(/\\/g, '/');
}

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/lib/discover.js
Comment on lines +12 to +15
* @param {string} suffix - Glob suffix, e.g. "**\/*.json"
* @returns {string} Forward-slash glob pattern
*/
function toGlobPattern(dir, suffix) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (bug_risk): Normalize backslashes in suffix as well, not just path.sep from path.join.

The example suffix ("**\/*.json") contains backslashes, but toGlobPattern only normalizes path.sep from path.join(dir, suffix). On POSIX, path.sep is /, so any "\\" in suffix stay unmodified and may break globbing. Consider also replacing all backslashes with forward slashes (either in suffix before path.join or on the final string) so Windows-style separators in suffix are handled correctly on all platforms.

Suggested implementation:

 * @param {string} suffix - Glob suffix, e.g. "**/*.json"
function toGlobPattern(dir, suffix) {
  // Normalize all path separators (including any backslashes in `suffix`) to forward slashes
  return path.join(dir, suffix).replace(/\\/g, '/');
}

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.

1 participant