Skip to content

Use lightspeed-stack authz regex#172

Merged
openshift-merge-bot[bot] merged 1 commit intorh-ecosystem-edge:mainfrom
omertuc:regex
Sep 2, 2025
Merged

Use lightspeed-stack authz regex#172
openshift-merge-bot[bot] merged 1 commit intorh-ecosystem-edge:mainfrom
omertuc:regex

Conversation

@omertuc
Copy link
Copy Markdown
Member

@omertuc omertuc commented Sep 2, 2025

Bump to lightspeed-core/lightspeed-stack#483

Draft until that PR actually merges

Also include the changes from #171 so that we only have one bump PR

Summary by CodeRabbit

  • New Features

    • Added a delete conversation flow in the CLI with confirmation and clearer prompts.
    • Introduced a Make target to trigger conversation deletion.
  • Configuration

    • Expanded authentication rules to recognize redhat.com email addresses.
    • Removed explicit data collector disablement; behavior now follows defaults.
  • Chores

    • Updated base container image.
    • Updated submodule reference.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Sep 2, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Sep 2, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: omertuc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Sep 2, 2025

Walkthrough

Updates base image and submodule pointer, adds a Makefile target to delete conversations, implements delete mode in scripts/query.sh with HTTP DELETE, adjusts auth role rules in dev env, and removes an explicit data_collector block from template.yaml.

Changes

Cohort / File(s) Summary of Changes
Container image refs
Containerfile.assisted-chat, lightspeed-stack
Bumped base image digest and updated lightspeed-stack submodule commit reference.
CLI make targets
Makefile
Added new phony target delete that runs scripts/query.sh with DELETE_MODE=true.
Query script delete flow
scripts/query.sh
Introduced DELETE_MODE to select a conversation for deletion, confirm, and send HTTP DELETE to /v1/conversations/{id}; adjusted fzf prompt/options and no-op exit when no conversations exist in delete mode.
Config templates
template-params.dev.env, template.yaml
Expanded AUTHN_ROLE_RULES to include email regex match for redhat_employee. Removed explicit user_data_collection.data_collector block from template.yaml.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant M as Makefile
  participant Q as scripts/query.sh
  participant API as Assisted Chat API

  U->>M: make delete
  M->>Q: DELETE_MODE=true ./scripts/query.sh
  Q->>Q: List conversations (no "New conversation")
  Q->>U: Prompt: "Select conversation to delete"
  U-->>Q: Select conversation
  Q->>U: Confirm deletion (y/N)
  alt confirmed
    Q->>API: HTTP DELETE /v1/conversations/{id}\nAuthorization: Bearer <token>
    API-->>Q: 2xx with body
    Q->>U: Print success and exit
  else canceled or non-2xx
    Q->>U: Print cancel or error with response body
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

lgtm

Suggested reviewers

  • jhernand
  • carbonin
  • eranco74
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@openshift-ci openshift-ci Bot added the approved label Sep 2, 2025
@eranco74
Copy link
Copy Markdown
Collaborator

eranco74 commented Sep 2, 2025

lightspeed-core/lightspeed-stack#483 merged, let's do the update...

@omertuc omertuc force-pushed the regex branch 2 times, most recently from 7373c06 to 98571ae Compare September 2, 2025 14:43
@omertuc omertuc marked this pull request as ready for review September 2, 2025 14:47
@openshift-ci openshift-ci Bot requested review from carbonin and jhernand September 2, 2025 14:47
Bump to lightspeed-core/lightspeed-stack#483

Also include changes from rh-ecosystem-edge#171 so we only have one bump PR
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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)
scripts/query.sh (1)

36-60: Model selection read pipeline is broken (pre-existing).

The process substitution is attached to the variable assignment, not to read, so read won’t consume fzf output.

Apply:

-    IFS=$'\t' < <(jq -r '
+    IFS=$'\t' read -r model_name model_provider < <(jq -r '
         # Get all models
         .models[] 
@@
-        | "\($model_name | . + (" " * (40 - length)))\($type_label)\t\($model_name)\t\($provider)"
-        ' <<<"$models_json" | fzf --delimiter='\t' --with-nth=1 --accept-nth=2,3 --header="Model Name                               Type") read -r model_name model_provider
+        | "\($model_name | . + (" " * (40 - length)))\($type_label)\t\($model_name)\t\($provider)"' \
+        <<<"$models_json" | fzf --delimiter=$'\t' --with-nth=1 --accept-nth=2,3 --header="Model Name                               Type")
🧹 Nitpick comments (5)
Containerfile.assisted-chat (1)

7-7: Trim image size after microdnf install.

Clean package caches in the same layer.

Apply:

-RUN microdnf install -y patch
+RUN microdnf install -y patch && microdnf clean all && rm -rf /var/cache/dnf /var/cache/yum
template-params.dev.env (1)

9-9: Regex rule looks correct; consider case-insensitive anchor.

To avoid case issues and enforce full-string match, prefer a start anchor and (?i).

Apply:

-AUTHN_ROLE_RULES='[{"jsonpath":"$.realm_access.roles[*]","operator":"contains","value":"redhat:employees","roles":["redhat_employee"]},{"jsonpath":"$.email","operator":"match","value":".*@redhat\\\\.com$","roles":["redhat_employee"]}]'
+AUTHN_ROLE_RULES='[{"jsonpath":"$.realm_access.roles[*]","operator":"contains","value":"redhat:employees","roles":["redhat_employee"]},{"jsonpath":"$.email","operator":"match","value":"(?i)^[^@]+@redhat\\\\.com$","roles":["redhat_employee"]}]'
scripts/query.sh (2)

205-211: Dynamic prompt: small UX touch.

Optionally add --height/--reverse/--border for consistency with other fzf uses.


217-237: DELETE flow is correct; add a tiny robustness check.

Validate the UUID before sending the request to avoid accidental deletes on malformed selections.

Apply:

-    CONVERSATION_ID=$(echo "$selected" | cut -c1-36 | xargs)
+    CONVERSATION_ID=$(echo "$selected" | cut -c1-36 | xargs)
+    if ! [[ "$CONVERSATION_ID" =~ ^[0-9a-fA-F-]{36}$ ]]; then
+        echo "Invalid conversation ID: $CONVERSATION_ID"
+        exit 1
+    fi
Makefile (1)

97-100: New delete target: LGTM.

Consider parity targets for int/stage, mirroring query-{int,stage}.

Apply:

 delete: ## Delete a conversation from assisted-chat services
 	@echo "Deleting conversation from assisted-chat services..."
 	DELETE_MODE=true ./scripts/query.sh
+
+delete-int: ## Delete a conversation (integration environment)
+	@echo "Deleting conversation from assisted-chat services (integration)..."
+	QUERY_ENV=int DELETE_MODE=true ./scripts/query.sh
+
+delete-stage: ## Delete a conversation (stage environment)
+	@echo "Deleting conversation from assisted-chat services (stage)..."
+	QUERY_ENV=stage DELETE_MODE=true ./scripts/query.sh
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 61004ba and 1bccf91.

📒 Files selected for processing (6)
  • Containerfile.assisted-chat (1 hunks)
  • Makefile (2 hunks)
  • lightspeed-stack (1 hunks)
  • scripts/query.sh (3 hunks)
  • template-params.dev.env (1 hunks)
  • template.yaml (0 hunks)
💤 Files with no reviewable changes (1)
  • template.yaml
⏰ 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: Red Hat Konflux / assisted-chat-saas-main-on-pull-request
  • GitHub Check: Red Hat Konflux / assisted-chat-test-image-saas-main-on-pull-request
🔇 Additional comments (5)
lightspeed-stack (1)

1-1: LGTM: submodule bump to lightspeed-stack be56d50 verified.
Pointer-only update; Containerfile comments include the short SHA and CI will build the intended commit.

Containerfile.assisted-chat (1)

2-3: Base image bump looks good; verify alignment with lightspeed-stack commit and patch applicability.

Please confirm the digest matches the dev tag comment (be56d50) and contains the new authz-regex support from lightspeed-stack, and that the downstream patch still applies cleanly against this image.

scripts/query.sh (3)

5-7: DELETE_MODE flag: LGTM.


169-176: Graceful no-data behavior in delete mode: LGTM.


179-181: Hiding “New conversation” in delete mode: LGTM.

Copy link
Copy Markdown
Collaborator

@eranco74 eranco74 left a comment

Choose a reason for hiding this comment

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

/lgtm

Comment thread template.yaml
feedback_storage: "${STORAGE_MOUNT_PATH}/feedback"
transcripts_enabled: ${LIGHTSPEED_TRANSCRIPTS_ENABLED}
transcripts_storage: "${STORAGE_MOUNT_PATH}/transcripts"
data_collector:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The default is false?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm not sure, it doesn't exist anymore, not sure what replaced it

Comment thread template-params.dev.env
ASSISTED_CHAT_DEFAULT_MODEL=gemini/gemini-2.0-flash
LIGHTSSPEED_STACK_POSTGRES_SSL_MODE=disable
AUTHN_ROLE_RULES='[{"jsonpath":"$.realm_access.roles[*]","operator":"contains","value":"redhat:employees","roles":["redhat_employee"]}]'
AUTHN_ROLE_RULES='[{"jsonpath":"$.realm_access.roles[*]","operator":"contains","value":"redhat:employees","roles":["redhat_employee"]},{"jsonpath":"$.email","operator":"match","value":".*@redhat\\\\.com$","roles":["redhat_employee"]}]'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Unsure we need both

Copy link
Copy Markdown
Member Author

@omertuc omertuc Sep 2, 2025

Choose a reason for hiding this comment

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

Can't hurt. Let's keep both to minimize potential damage, then we can remove later

@openshift-ci openshift-ci Bot added the lgtm label Sep 2, 2025
@openshift-merge-bot openshift-merge-bot Bot merged commit b0dd95d into rh-ecosystem-edge:main Sep 2, 2025
6 of 7 checks passed
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.

2 participants