Skip to content

fix: reject empty/whitespace tenant_id at the filter boundary - #6

Open
AshSgDe29071999 wants to merge 1 commit into
AgentPostmortem:mainfrom
AshSgDe29071999:fix/reject-empty-tenant-id
Open

fix: reject empty/whitespace tenant_id at the filter boundary#6
AshSgDe29071999 wants to merge 1 commit into
AgentPostmortem:mainfrom
AshSgDe29071999:fix/reject-empty-tenant-id

Conversation

@AshSgDe29071999

Copy link
Copy Markdown

Summary

Empty or whitespace-only tenant_id values were turned into MatchValue(""), so searches returned zero hits and looked like an empty tenant rather than a missing scope.

Changes

  • require_tenant_id() + UnscopedTenantError at build_filter / search
  • Tests for "", whitespace, and a valid id containing spaces

Note: this repo has no HTTP API in app.py (container entrypoint only). The library/CLI boundary raises UnscopedTenantError (subclass of ValueError); an HTTP layer would map that to 4xx.

Test plan

  • Manual asserts for empty/whitespace/spaced ids
  • Unit tests added in tests/test_search.py

Fixes #4

Empty tenant_id previously became MatchValue("") and returned no
hits, which looks like "this tenant has no documents" instead of
"request was not scoped". Raise UnscopedTenantError with a clear
message; allow tenant ids that merely contain spaces.

Fixes AgentPostmortem#4
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.

An empty or whitespace tenant_id builds a filter for a tenant named empty string, rather than being refused

1 participant