feat: field-level interest category classification - #442
Conversation
The schema service now assigns interest categories (e.g. "Photography", "Cooking", "Running") to canonical fields via LLM classification. Categories are propagated to schemas via field_interest_categories HashMap, following the same pattern as field_data_classifications. - Add interest_category to CanonicalField (serde-compatible, backward compat) - Add INTEREST_CATEGORIES vocabulary as single source of truth - Add classify_interest_category_with_llm() and LLM prompt - Add field_interest_categories to Schema struct + deserializer - Propagate via apply_canonical_interest_categories() in add_schema/expand_schema - Add run_interest_category_backfill() for migrating existing fields - Interest category is best-effort (non-blocking on failure) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
馃挕 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b77f013d1
鈩癸笍 About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 馃憤.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Propagate canonical field types, classifications, and interest categories to the schema | ||
| self.apply_canonical_types(&mut schema); | ||
| self.apply_canonical_classifications(&mut schema); | ||
| self.apply_canonical_interest_categories(&mut schema); |
There was a problem hiding this comment.
Persist schema after applying inferred interest categories
At this point in add_schema, the schema has already been written to storage and cloned into self.schemas, so calling apply_canonical_interest_categories only mutates the local return value. For schemas that rely on server-side inference (the normal path for this new feature), subsequent reads from the registry will still have an empty field_interest_categories, and the data is lost across restarts because the persisted record was never updated.
Useful? React with 馃憤聽/ 馃憥.
| // Propagate canonical field types, classifications, and interest categories to the expanded schema | ||
| self.apply_canonical_types(schema); | ||
| self.apply_canonical_classifications(schema); | ||
| self.apply_canonical_interest_categories(schema); |
There was a problem hiding this comment.
Persist expanded schema after interest-category propagation
The same ordering issue exists in expand_schema: the expanded schema is persisted and inserted into memory before apply_canonical_interest_categories runs, so inferred categories are not reflected in the stored/registered schema state. Expanded schemas therefore miss interest categories in normal lookups and after reload, even though the method returns a schema object that appears populated.
Useful? React with 馃憤聽/ 馃憥.
| #[cfg(feature = "aws-backend")] | ||
| SchemaStorage::Cloud { .. } => {} |
There was a problem hiding this comment.
Persist cloud backfill mutations instead of dropping them
In run_interest_category_backfill, the Cloud branch is a no-op after mutating schema.field_interest_categories, so backfilled categories are never written to DynamoDB. In AWS deployments this means startup backfill only changes in-memory state for the current process and all migrated categories disappear on restart.
Useful? React with 馃憤聽/ 馃憥.
Summary
field_interest_categoriesHashMap on Schema, propagated alongside existingfield_data_classificationsINTEREST_CATEGORIESvocabulary inllm_registry::prompts::classificationis the single source of truthMotivation
The discovery system previously derived "categories" from
data_domain(6 coarse sensitivity labels like "general", "location") which are useless for social matching. This moves category ownership to the schema service where it belongs, using meaningful interest categories.Test plan
cargo check --features aws-backendcompilesinfer_interest_categorygraceful degradation without API key馃 Generated with Claude Code