Skip to content

Conversation

@anpendyal
Copy link

Implements a new requirement that checks if a case name exists in the cases_metadata database using actual JSON files. Adds parameterized pytest tests that validate case detection against real data.

Anooshka Pendyal and others added 2 commits October 5, 2025 20:08
…case validation

Implements a new requirement that checks if a case name exists in the cases_metadata database using actual JSON files. Adds parameterized pytest tests that validate case detection against real data.
@mergify
Copy link

mergify bot commented Oct 12, 2025

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|release)(?:\(.+\))?:

@nrfulton nrfulton self-requested a review October 14, 2025 14:24
Copy link
Contributor

Choose a reason for hiding this comment

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

The implementation of the requirement should be in mellea/stdlib/reqlib/legal.py.

# create mock context
ctx = MockContext(case_name)
# path to metadata folder
db_folder = "/Users/anooshkapendyal/Desktop/mellea/mellea/test/stdlib_basics/legal/cases_metadata"
Copy link
Contributor

Choose a reason for hiding this comment

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

should be relative.


return name.strip()

def citation_exists(ctx: Context, folder_path: str) -> ValidationResult:
Copy link
Contributor

@nrfulton nrfulton Oct 22, 2025

Choose a reason for hiding this comment

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

We should always operate over strings.

So here, instead of folder_path, pass in a list of the actual contents of that folder, whatever those are. In this case, the metadata json files.

If these were inteded as LLM inputs, then you'd want to pass them in as CBlocks rather than strs.

The type signature of this function should probably be:

def citation_exists(ctx: Context, folder_path: list[dict]) -> ValidationResult: ...

Copy link
Contributor

Choose a reason for hiding this comment

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

If you find that the case metadata is too big to pass in directly, then you could instead use Generator[...] instead of list[...]

"""
Checks if the output case name exists in the provided case metadata database.
"""
def __init__(self, folder_path: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be case_metadata instead of folder_path.

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