feat(ai): AI Draft CQL — Sprint 7.1#52
Merged
Merged
Conversation
POST /api/measures/{id}/ai/draft-cql generates a CQL skeleton from the
measure's spec_json plus optional OSHA policy text. Returns a deterministic
fallback template (annotated TODOs, full Outcome Status define) when the
model call fails so authoring is never blocked. Audit row written with
fallbackUsed.
CqlTab adds an "AI Draft CQL" button that opens an OSHA-text modal; the
returned CQL is pushed into Monaco and surfaced with a dismissible amber
review banner. Compile state resets so the user must compile before
activation — AI never decides compliance.
Closes #47
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c3f63d94e
ℹ️ 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".
Previously the version query prioritised Active status over recency, so a newer Draft version would be skipped in favour of an older Active one. Now orders by created_at DESC so the prompt always reflects the version currently open in Studio. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /api/measures/{id}/ai/draft-cqlendpoint generates a CQL skeleton from the measure'sspec_jsonplus optional pasted OSHA/policy text.fallbackUsed=true) when the model is unavailable — authoring is never blocked.CqlTabadds an "AI Draft CQL" button that opens an OSHA-text modal; the result is pushed into Monaco with a dismissible amber review banner. Compile state resets so the user must compile before activation.AI_DRAFT_CQL_GENERATEDaudit event is written for every call (success or fallback).AI never decides compliance — the existing compile gate + structured CQL evaluation remain the sole source of truth.
Test plan
./gradlew.bat compileJava --rerun-tasksclean./gradlew.bat test --tests "com.workwell.ai.*"passesnpm run lintclean (one pre-existing warning unrelated to this PR)Closes #47