feat(studio): spec field labels, async button states, live compile badge#67
Merged
Conversation
- SpecTab: persistent <label> per spec field (htmlFor/id); placeholders kept as hints - Async in-flight states (spinner + disabled) for Compile, AI Draft Spec, Save Draft, and Approve/Activate/Deprecate confirms, matching the TestsTab reference pattern - CqlTab compile badge reflects the live compile response (COMPILED|WARNINGS|ERROR) via a parent-held override, flipping immediately without reload; WARNINGS amber - Add Vitest coverage: SpecTab labels + in-flight; CqlTab badge flip + Compiling Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Three frontend-only Studio UX fixes. No backend, schema, API-contract, or compliance-logic changes. The Tests tab (
TestsTab.tsx) spinner + disabled-while-pending pattern was used as the reference for all async-button work.Fix 1 — Spec field labels (
SpecTab.tsx)Every spec control was a bare input/textarea with only a placeholder. Added a persistent visible
<label>above each of the 8 fields (Description, Eligibility Role Filter, Eligibility Site Filter, Program Enrollment Text, Exclusion Label, Exclusion Criteria Text, Compliance Window, Required Data Elements), associated viahtmlFor/idfor accessibility. Placeholders retained as hint text. Field order, state, and the save payload are unchanged.Fix 2 — Async button feedback across Studio
Added a local pending boolean (set before the
await, cleared infinally) to every async button that lacked in-flight state, with an inline spinner + verb label anddisabledwhile pending (guards double-submit):CqlTab: Compile → "Compiling…"SpecTab: AI Draft Spec → "Drafting…", Save Draft → "Saving…"ReleaseApprovalTab: Approve → "Approving…", Activate → "Activating…", Deprecate → "Deprecating…"Spinner markup matches
TestsTabfor visual consistency. ExistingemitToastsuccess/failure calls are unchanged. Note:CqlTab's "AI Draft CQL" button only opens a dialog — its actual async ("Generate CQL Draft") already had the in-flight pattern, so it was left as-is.Fix 3 — Compile status badge reflects the live result (
CqlTab.tsx+studio/[id]/page.tsx)The badge rendered
measure.compileStatus(persisted prop), so it stayed stale (e.g. "NOT COMPILED") after a Compile even though the API returns the new status. The parent now holds aliveCompileStatusoverride derived from the compile responsestatusfield (COMPILED | WARNINGS | ERROR) and passes it toCqlTab, which rendersliveCompileStatus ?? measure.compileStatus. The badge flips the moment compile returns — no reload. The override resets on measure navigation. WARNINGS renders amber (distinct from ERROR red), confirmed bycompileStatusClass.Verification
npm run lint— 0 errors (1 pre-existing warning intest/mocks/next-font.ts, untouched).npm run test— 53 passed, including 5 new tests.npm run build— TypeScript clean, all routes built.New Vitest coverage:
SpecTab.test.tsx— a<label>resolves for each of the 8 spec fields (getByLabelText); Save Draft / AI Draft Spec show in-flight states.CqlTab.test.tsx— badge flips NOT_COMPILED → WARNINGS from a mocked compile response without remount (amber, not red); Compile shows "Compiling…" + disabled while pending.Not merged — deploy is owned by the maintainer.
🤖 Generated with Claude Code