Skip to content

SAP HANA: Get group membership working. Get account type working. - #84

Merged
ggreer merged 1 commit into
mainfrom
ggreer/sap-hana
Oct 7, 2025
Merged

SAP HANA: Get group membership working. Get account type working.#84
ggreer merged 1 commit into
mainfrom
ggreer/sap-hana

Conversation

@ggreer

@ggreer ggreer commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

Description

  • Bug fix
  • New feature

Useful links:

This also adds a new behavior: If you prefix a mapping with cel:, we don't replace dots with col[...]. This lets you use things like string.startsWith() and other CEL functions.

Summary by CodeRabbit

  • New Features
    • Added support for a "cel:" prefix to opt out of expression preprocessing. When used, the prefix is stripped and the remaining expression is returned as-is, skipping automatic quoting and dot-field transformations. This provides precise control for advanced use cases while leaving existing expressions (without the prefix) unchanged.

@coderabbitai

coderabbitai Bot commented Oct 6, 2025

Copy link
Copy Markdown

Walkthrough

Introduces an early-exit path in preprocessExpressions within pkg/bcel/helpers.go. If the input begins with the literal prefix "cel:", the function now strips this prefix and returns the remaining string immediately, skipping all subsequent processing steps such as quoting and dot-field transformations.

Changes

Cohort / File(s) Summary
BCEL helpers
pkg/bcel/helpers.go
Added an early-exit in preprocessExpressions: when input starts with "cel:", remove the prefix and return the rest without further processing (bypassing quoting and dot-field transformations).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant Helpers as preprocessExpressions

  Caller->>Helpers: preprocessExpressions(input)
  alt input starts with "cel:"
    Note right of Helpers: Strip "cel:" prefix
    Helpers-->>Caller: return remainder (no further processing)
  else
    Note right of Helpers: Proceed with normal processing<br/>(quoting, dot-field transforms, etc.)
    Helpers-->>Caller: return processed string
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nudge a string with whiskered care,
Hop—prefix gone! The rest laid bare.
No dots to dot, no quotes to sling,
Just raw and ready—springy thing.
Carrot-quick paths make bunnies beam,
Early exits: swift as a dream. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title is composed of two separate sentences listing multiple features rather than a single concise statement, and it doesn’t clearly summarize the principal change in the code by focusing on a unified intent. Please revise the title into one clear sentence that succinctly captures the main change, for example “SAP HANA connector: support ‘cel:’ prefixes for group membership and account type expressions.”
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ggreer/sap-hana

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

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/bcel/helpers.go (1)

16-18: Update function comment to document the "cel:" prefix behavior.

The function comment doesn't mention the new early-exit behavior for expressions prefixed with "cel:". This is a significant feature that should be documented.

Apply this diff to update the comment:

-// preprocessExpressions replaces all column expressions with the appropriate map access.
-// It also detects 'bare strings' and automatically quotes them.
-// Example input: ".role_name == 'Admin'" -> "cols['role_name'] == 'Admin'".
+// preprocessExpressions replaces all column expressions with the appropriate map access.
+// It also detects 'bare strings' and automatically quotes them.
+// If the expression is prefixed with "cel:", the prefix is stripped and the remainder is returned
+// without any preprocessing, allowing raw CEL expressions to be used.
+// Example input: ".role_name == 'Admin'" -> "cols['role_name'] == 'Admin'".
🧹 Nitpick comments (1)
pkg/bcel/helpers.go (1)

20-23: Verify "cel:" prefix edge case and add test

  • No tests cover the "cel:" prefix; confirm that returning an empty string for input "cel:" is intended and add a test.
  • Optional: simplify to if strings.HasPrefix(expr, "cel:") { return expr[4:] }.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da07828 and 4ada7d7.

⛔ Files ignored due to path filters (1)
  • examples/sap-hana-test.yml is excluded by none and included by none
📒 Files selected for processing (1)
  • pkg/bcel/helpers.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Error handling: use fmt.Errorf with contextual messages; check specific errors with errors.Is
Organize imports: standard library first, then third-party, then project imports; alphabetize within each group
Naming: CamelCase for exported identifiers; camelCase for unexported; preserve acronyms like ID, URL, HTTP, API
Limit line length to a maximum of 200 characters
Comments for exported items must be complete sentences ending with periods
Do not use log.Fatal or log.Panic (ruleguard-enforced)

Files:

  • pkg/bcel/helpers.go

@ggreer
ggreer merged commit bb068ca into main Oct 7, 2025
4 checks passed
@ggreer
ggreer deleted the ggreer/sap-hana branch October 7, 2025 15:52
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