Skip to content

fix: remove invalid dummy path from gov_rag base_path and move to config#390

Open
ARYANPATEL-BIT wants to merge 2 commits intokubeedge:mainfrom
ARYANPATEL-BIT:fix/gov-rag-invalid-default-path
Open

fix: remove invalid dummy path from gov_rag base_path and move to config#390
ARYANPATEL-BIT wants to merge 2 commits intokubeedge:mainfrom
ARYANPATEL-BIT:fix/gov-rag-invalid-default-path

Conversation

@ARYANPATEL-BIT
Copy link
Copy Markdown

@ARYANPATEL-BIT ARYANPATEL-BIT commented Apr 12, 2026

Description

This PR resolves an issue in gov_rag.py where the GovernmentRAG class was initialized with an invalid, hardcoded dummy path:

/path/ianvs/dataset/gov_rag

acting as the default base_path.

This was an antipattern that silently masked missing parameter errors, causing confusing FileNotFoundError and runtime crashes deeper down the execution stack when a path wasn't provided.

Changes Made

gov_rag.py

  • Removed the default dummy path from the base_path parameter signature.
  • Changed the default of base_path to None.
  • Added a validation block to explicitly raise a ValueError("base_path must be explicitly provided") if base_path is not provided during instantiation.

Example updated signature:

def __init__(self, base_path=None, ...):
    if base_path is None:
        raise ValueError("base_path must be explicitly provided")
    # rest of initialization

basemodel.py

  • Updated all GovernmentRAG instantiations to explicitly inject the required path using the Ianvs configuration context, instead of relying on the library default.
  • New pattern used in client code:
base_path = Context.get_parameters("base_path", "/path/ianvs/dataset/gov_rag")
rag = GovernmentRAG(base_path=base_path, ...)

This change shifts the responsibility of path resolution to the configuration layer, making failures explicit at the call site.

Related Issues

Fixes #<YOUR_ISSUE_NUMBER_HERE>
(Don’t forget to replace this with your actual GitHub issue number before submitting the PR.)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests / verified my changes won’t break existing behavior
  • My commit messages include the required DCO sign-off (-s)

##Fixes: #389

Signed-off-by: Aryan Patel <aryan.patel7291@gmail.com>
@kubeedge-bot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ARYANPATEL-BIT
To complete the pull request process, please assign moorezheng after the PR has been reviewed.
You can assign the PR to them by writing /assign @moorezheng in a comment when ready.

The full list of commands accepted by this bot can be found 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

@kubeedge-bot kubeedge-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 12, 2026
@ARYANPATEL-BIT
Copy link
Copy Markdown
Author

/assign @MooreZheng

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

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 makes the base_path for GovernmentRAG configurable and adds validation to ensure it is explicitly provided. However, the current implementation in BaseModel still provides a dummy path as a default value, which bypasses the intended validation. Furthermore, the review identified several critical issues in BaseModel, including potential race conditions due to concurrent modification of the self.rag instance, logic errors in how RAG instances are reused across different query types, and a missing all_locations attribute that will cause runtime errors.

… defaults

Signed-off-by: Aryan Patel <aryan.patel7291@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid dummy path used as default parameter in gov_rag.py

3 participants