Skip to content

feat(directory): implement search_profiles query (UC8)#83

Merged
veeso merged 1 commit intomainfrom
feat/16-wi-1-5-implement-directory-canister-search-profiles
Apr 29, 2026
Merged

feat(directory): implement search_profiles query (UC8)#83
veeso merged 1 commit intomainfrom
feat/16-wi-1-5-implement-directory-canister-search-profiles

Conversation

@veeso
Copy link
Copy Markdown
Owner

@veeso veeso commented Apr 29, 2026

Summary

Implements the search_profiles Directory query for user discovery (WI-1.5, closes #16).

  • Substring case-insensitive match over users.handle, paginated (limit capped at 50, 0 rejected)
  • Filters to canister_status = Active AND canister_id IS NOT NULLCreationPending, CreationFailed, DeletionPending, and the new Suspended status are excluded
  • Empty queries return all eligible users, paginated
  • Adds UserCanisterStatus::Suspended (encode/decode/order/display) for cross-ref with WI-1.9
  • Replaces stale SearchProfilesError::Unauthorized with BadArgs + Internal(String)
  • Tightens CLAUDE.md guidance to always update docs/src/SUMMARY.md when docs pages are added/removed

Test plan

  • just check_code — clippy + fmt clean
  • just build_all — WASM build succeeds
  • Unit tests (162 in directory crate, +23 new) cover: exact/prefix/middle substring, empty query, pagination, no-match, exclusion of every non-Active status, sanitization (@-prefix, case)
  • cargo test --test search_profiles (12 pocket-ic tests) — full Candid wire coverage including anonymous caller and trap on limit=0 / limit>50
  • Docs (docs/src/interface/types.md, docs/src/architecture.md) updated to reflect filter semantics and error variants

Implements the `search_profiles` Directory query for user discovery
(WI-1.5, closes #16). Substring case-insensitive match over `users.handle`
with pagination (limit capped at 50). Only Active users with a canister
are returned; CreationPending, CreationFailed, DeletionPending, and the
new Suspended status are excluded.

- Adds `UserCanisterStatus::Suspended` variant + encode/decode/order/display.
- Replaces stale `SearchProfilesError::Unauthorized` with `BadArgs` and
  `Internal(String)`.
- Argument validation in `inspect_search_profiles` (limit bounds, sanitized
  handle); empty queries pass through and return all Active users.
- Updates interface/types.md and architecture.md to reflect the actual
  filter semantics and error variants.
- Tightens CLAUDE.md guidance to always update SUMMARY.md when adding/
  removing docs pages.
- Adds 23 unit tests + 12 pocket-ic integration tests covering exact/
  prefix/middle substring, case-insensitivity, `@`-prefix sanitization,
  pagination, empty query, no-match, every excluded status, anonymous
  caller, and trap on invalid limits.
@cocogitto-bot
Copy link
Copy Markdown

cocogitto-bot Bot commented Apr 29, 2026

✔️ 85e313b - Conventional commits check succeeded.

@veeso veeso merged commit 22aac46 into main Apr 29, 2026
3 checks passed
@veeso veeso deleted the feat/16-wi-1-5-implement-directory-canister-search-profiles branch April 29, 2026 08:37
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.

WI-1.5: Implement Directory Canister - search profiles

1 participant