Repository navigation
fix(schemas): run semantic role annotation before privacy threshold (#800) - #887
Conversation
…800) Swap _annotate_schema and _annotate_semantic_and_relational so semantic roles (message_role) are annotated before the privacy threshold (min_conversation_count=3) runs. This ensures role fields are visible when the privacy threshold evaluates them. Previously the privacy threshold could suppress fields before semantic role detection had a chance to classify them. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the schema generation pipeline so semantic-role/relational annotations are applied before field-stat annotations that enforce privacy-related filtering, ensuring semantic classification runs on the fullest available field stats before privacy thresholds affect downstream annotations.
Changes:
- Reordered cluster schema annotation steps to run
_annotate_semantic_and_relational()before_annotate_schema()(which applies privacy-config filtering). - Moved pin loading earlier to support semantic-role selection prior to privacy-aware annotation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Two-line ordering fix in `polylogue/schemas/generation/schema_builder.py`. The schema-generation pipeline applied the cross-conversation privacy threshold before semantic-role annotation, so values that should have been protected by the `x-polylogue-semantic-role="message_role"` exemption (record types like `attachment`, `system`, `permission-mode`) were dropped before the annotator could mark them as structural. Reorders the steps so semantic-role classification runs first. PR #921 builds on this with the structural-role exemption logic. Refs #800
Three targeted fixes building on PR #887's schema-pipeline reordering: 1. Fields tagged `x-polylogue-semantic-role="message_role"` now bypass the cross-conversation privacy threshold (`min_conversation_count=3` becomes 1) so structural protocol record-type tokens like `attachment`, `custom-title`, `file-history-snapshot`, `last-prompt`, `permission-mode`, `queue-operation`, `system` survive schema generation. 2. `detect_drift()` is now wired into `devtools schema-audit --check-drift` via a new `check_schema_drift()` audit check that loads samples from the archive DB and runs drift detection against committed schemas. The function existed but no audit tool ever called it. 3. `tests/unit/core/test_schema_privacy.py`: `TestStructuralRoleExemption` proves `message_role` values survive `min=3` while non-role fields stay filtered. End-to-end schema regeneration from live data and full schema-promote remain blocked on the blob-store work in #818. Refs #800
Two-line ordering fix in `polylogue/schemas/generation/schema_builder.py`. The schema-generation pipeline applied the cross-conversation privacy threshold before semantic-role annotation, so values that should have been protected by the `x-polylogue-semantic-role="message_role"` exemption (record types like `attachment`, `system`, `permission-mode`) were dropped before the annotator could mark them as structural. Reorders the steps so semantic-role classification runs first. PR #921 builds on this with the structural-role exemption logic. Refs #800
Three targeted fixes building on PR #887's schema-pipeline reordering: 1. Fields tagged `x-polylogue-semantic-role="message_role"` now bypass the cross-conversation privacy threshold (`min_conversation_count=3` becomes 1) so structural protocol record-type tokens like `attachment`, `custom-title`, `file-history-snapshot`, `last-prompt`, `permission-mode`, `queue-operation`, `system` survive schema generation. 2. `detect_drift()` is now wired into `devtools schema-audit --check-drift` via a new `check_schema_drift()` audit check that loads samples from the archive DB and runs drift detection against committed schemas. The function existed but no audit tool ever called it. 3. `tests/unit/core/test_schema_privacy.py`: `TestStructuralRoleExemption` proves `message_role` values survive `min=3` while non-role fields stay filtered. End-to-end schema regeneration from live data and full schema-promote remain blocked on the blob-store work in #818. Refs #800
Swap annotation order so semantic roles are classified before privacy threshold applies. 1 file +2/-2. All gates passed.