Skip to content

Improve/render vars in ingestr#752

Merged
DjamilaBaroudi merged 8 commits into
mainfrom
improve/render-vars-in-ingestr
Apr 29, 2026
Merged

Improve/render vars in ingestr#752
DjamilaBaroudi merged 8 commits into
mainfrom
improve/render-vars-in-ingestr

Conversation

@DjamilaBaroudi
Copy link
Copy Markdown
Collaborator

@DjamilaBaroudi DjamilaBaroudi commented Apr 28, 2026

PR Overview

  • Improved Ingestr asset display with edit/view mode toggle using "Edit"/"Done" text link for cleaner UI.
  • Updated integration tests, changelog, and README.
render-ingestr

- Added a function to parse parameters from ingestr asset YAML files.
- Enhanced the BruinRender class to handle rendering of ingestr parameters.
- Updated the parseAssetCommand to re-render ingestr assets after patching.
- Modified webview components to display rendered ingestr parameters.
- Introduced new messaging for rendering success in the webview.
…g in webview

- Simplified the YAML parameter extraction logic in `bruinRender.ts` for better readability and efficiency.
- Updated the `App.vue` component to clear metadata only when the file path changes, preventing unnecessary resets.
- Improved the `IngestrAssetDisplay.vue` component to always show parameters with a fallback mechanism for rendering.
- Added new props in `SqlEditor.vue` for dynamic tab visibility and customizable preview label.
- Updated the edit button functionality to toggle between 'Edit' and 'Done' states in the IngestrAssetDisplay.vue component.
- Simplified the button structure by removing separate buttons for editing and confirming changes, enhancing user experience.
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 28, 2026

Comments Outside Diff (1)

  1. webview-ui/src/components/asset/IngestrAssetDisplay.vue, line 780-788 (link)

    P2 cleanQuery double-strips YAML block scalars that parseIngestrParameters already removed

    parseIngestrParameters skips the |/> indicator line and only collects the indented body lines, so displayParams.query should never start with | or >. The guard in cleanQuery is therefore dead code. If parseIngestrParameters is changed in the future (e.g., to pass through the YAML verbatim), this silent no-op could mask the issue. Remove the guard or add a comment explaining why it is kept.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: webview-ui/src/components/asset/IngestrAssetDisplay.vue
    Line: 780-788
    
    Comment:
    **`cleanQuery` double-strips YAML block scalars that `parseIngestrParameters` already removed**
    
    `parseIngestrParameters` skips the `|`/`>` indicator line and only collects the indented body lines, so `displayParams.query` should never start with `|` or `>`. The guard in `cleanQuery` is therefore dead code. If `parseIngestrParameters` is changed in the future (e.g., to pass through the YAML verbatim), this silent no-op could mask the issue. Remove the guard or add a comment explaining why it is kept.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/extension/commands/parseAssetCommand.ts
Line: 91

Comment:
**Missing `await` on async `render()` call**

`renderer.render()` is an `async` method but is called without `await`. Any unhandled rejection from the promise would be silently swallowed, and there is no error boundary here to catch it. Since `patchAssetCommand` is already `async`, awaiting the call is straightforward.

```suggestion
      await renderer.render(filePath);
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/bruin/bruinRender.ts
Line: 12-67

Comment:
**Regex-based YAML parsing is fragile and can silently return wrong values**

The `parseIngestrParameters` function builds regexes directly from parameter names and matches against raw YAML text. Two concrete failure cases:

1. If a YAML *value* contains a substring that looks like another key (e.g., `source_table: "schema.incremental_key: foo"`), the regex for `incremental_key` will match inside the string.
2. The multiline-query extraction removes only 2–4 leading spaces (`/^[ ]{2,4}/`), so deeper or mixed-indent YAML indentation will either strip too little or fail to strip at all, corrupting the query.

Using a proper YAML parser (e.g., `js-yaml`, already available in most VS Code extension projects) would handle all these edge cases reliably.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/bruin/bruinRender.ts
Line: 127-139

Comment:
**`isIngestrAsset` triggers an extra render for every `.asset.yml` file, not just ingestr-type assets**

`isIngestrAsset` is determined solely by file extension. Python pipeline tasks, generic YAML-defined assets, and any other asset type stored in a `.asset.yml` file will all enter this branch and fire off an extra `renderIngestrParams` call. The call is harmless (it parses YAML content and finds nothing, then no message is sent), but it doubles the CLI invocations for every YAML asset open in the editor.

Consider checking the asset *type* field in the already-parsed asset data (available via `parseAssetCommand`) before deciding to call `renderIngestrParams`.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: webview-ui/src/components/asset/IngestrAssetDisplay.vue
Line: 780-788

Comment:
**`cleanQuery` double-strips YAML block scalars that `parseIngestrParameters` already removed**

`parseIngestrParameters` skips the `|`/`>` indicator line and only collects the indented body lines, so `displayParams.query` should never start with `|` or `>`. The guard in `cleanQuery` is therefore dead code. If `parseIngestrParameters` is changed in the future (e.g., to pass through the YAML verbatim), this silent no-op could mask the issue. Remove the guard or add a comment explaining why it is kept.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "refactor: streamline edit mode toggle in..." | Re-trigger Greptile

Comment thread src/extension/commands/parseAssetCommand.ts
Comment thread src/bruin/bruinRender.ts Outdated
Comment thread src/bruin/bruinRender.ts Outdated
- Renamed and refactored the function to extract the SQL query from rendered ingestr asset content in `bruinRender.ts`.
- Updated the rendering logic to send only the extracted query to the webview.
- Enhanced UI tests to include entering and exiting edit mode for better test coverage and consistency in the Ingestr asset display component.
…ents

- Eliminated references to rendered parameters in `App.vue`, `AssetDetails.vue`, and `AssetGeneral.vue` components to streamline the code and improve clarity.
- Updated the `IngestrAssetDisplay` component to no longer require rendered parameters, enhancing its simplicity and focus on essential props.
@DjamilaBaroudi DjamilaBaroudi merged commit da64ba4 into main Apr 29, 2026
6 checks passed
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