Skip to content

fix(runs,studio,admin,valueset): UAT Sections 6-8 fixes (issue #29)#44

Merged
Taleef7 merged 8 commits into
mainfrom
fix/sprint-1-uat-sections-6-8
May 21, 2026
Merged

fix(runs,studio,admin,valueset): UAT Sections 6-8 fixes (issue #29)#44
Taleef7 merged 8 commits into
mainfrom
fix/sprint-1-uat-sections-6-8

Conversation

@Taleef7
Copy link
Copy Markdown
Owner

@Taleef7 Taleef7 commented May 20, 2026

Summary

Fixes for UAT Sections 6 (Run History), 7 (Studio/CQL), and 8 (Admin panel) from GitHub issue #29.


Changes

Backend

RunPersistenceService.java

  • Fix async run duration: inalizeAsyncRun() was using the evaluationDate (a historical past date) to compute duration_ms, producing absurd values like 69068s. Now fetches the actual started_at timestamp from the DB to compute the true wall-clock CQL evaluation time.
  • Fix measurement period: measurement_period_start/measurement_period_end now correctly reflect the 1-year evaluation window (evalDate-1yr → evalDate) instead of using startedAt twice.

BackendApplication.java

  • Set JVM default timezone to UTC on startup for consistent timestamp handling across all environments.

ValueSetGovernanceService.java

  • Expanded ensureDemoValueSets() to seed all 4 demo value sets (audiogram, TB screening, HAZWOPER, flu vaccine) with their correct CQL-matching canonical OIDs and local codes so
    esolveCheck finds matching codes.

Frontend

CqlTab.tsx

  • Added New Version button to the CQL editor toolbar (shown only for ROLE_AUTHOR users) with a modal dialog that requires a change summary before cloning the current CQL into a new draft version.

studio/[id]/page.tsx

  • Wire new canClone and onCreateNewVersion props to CqlTab.

�dmin/page.tsx

  • Added confirmation dialog before the Disable scheduler button to prevent accidental disables during a demo presentation.

Verification

  • \gradlew test --tests com.workwell.export.* --tests com.workwell.web.RunControllerTest\ → BUILD SUCCESSFUL (21s)
  • \gradlew compileJava\ → BUILD SUCCESSFUL (16s)
  • \pnpm tsc --noEmit\ → 0 errors
  • Playwright E2E: triggered async All Programs run → completed with 179s real duration (vs old seeded 60s constant). Duration correctly reflects actual CQL evaluation wall-clock time.

Issue

Closes #29 (UAT Sections 6-8)

Taleef added 5 commits May 20, 2026 14:53
Previously finalizeAsyncRun used the evaluationDate (a historical date in
the past) to compute duration_ms, yielding values like '69068s'. Now the
method fetches the actual started_at timestamp from the runs table so that
duration reflects the true wall-clock time of the CQL evaluation (e.g. 179s).

Also sets the JVM default timezone to UTC in BackendApplication to ensure
consistent timestamp handling across all environments.

Verified end-to-end with Playwright: new async run shows 179s duration vs
the old seeded 60s constant. Unit tests (RunControllerTest, CsvExportServiceTest)
pass cleanly.
- runs: fix async run duration computation — use actual DB started_at
  timestamp instead of evaluationDate for durationMs; also fix
  measurement_period_start/end to use the correct 1-year window
  relative to evaluationDate (not repeating started_at twice)

- valueset: fix ensureDemoValueSets() — ensure all 4 demo value sets
  (audiogram, TB, HAZWOPER, flu) are seeded with their correct CQL-
  matching canonical OIDs and display codes before resolveCheck runs

- studio/CqlTab: add 'New Version' button that opens a dialog for
  entering a change summary and cloning the current CQL into a new
  draft measure version (requires canClone prop)

- admin/page.tsx: add confirmation dialog before disabling the scheduler
  to prevent accidental disables during a demo
CqlTab now requires canClone and onCreateNewVersion since the stash
added the New Version button to the editor toolbar. Wire those props
from the parent studio/[id]/page.tsx so TypeScript is satisfied and
ROLE_AUTHOR users see the button inside the CQL editor panel.
Copilot AI review requested due to automatic review settings May 20, 2026 19:48
@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workwell-measure-studio Ready Ready Preview, Comment May 20, 2026 9:24pm

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

https://github.com/Taleef7/workwell/blob/3f5dabaf4a73b0499eb723f4e44ce97a753eb47c/frontend/app/(dashboard)/studio/[id]/page.tsx#L174-L176
P1 Badge Use modal summary directly when creating a new version

The new CQL-tab clone flow calls setChangeSummary(summary) and immediately invokes createNewVersion(), but createNewVersion() reads changeSummary from React state, which is not updated synchronously. In the common case where the header input is empty, clicking Create Version in the modal sends an empty summary path and triggers the "Change summary is required" error instead of cloning. This makes the new modal-based versioning path fail for valid user input.


useEffect(() => {
if (searchTerm === urlSearch) {
return;
}

P2 Badge Keep search input synchronized with URL query changes

This effect now only pushes searchTerm into the URL and no longer mirrors URL changes back into local state, so browser/history navigation can be overridden. For example, after searching and then pressing Back to a URL without search, urlSearch changes but searchTerm remains stale, and the effect writes the old term back via router.replace, effectively preventing navigation to the previous filter state.

ℹ️ 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".

@Taleef7 Taleef7 self-assigned this May 20, 2026
Copy link
Copy Markdown
Owner Author

@Taleef7 Taleef7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert review notes for PR #44:

  1. The CQL-tab New Version modal is wired through React state in a way that makes the new button fail or submit a stale summary. The child passes summary, but the parent calls setChangeSummary(summary) and immediately invokes createNewVersion(), which still reads the previous changeSummary value.
  2. Issue #29 explicitly requires anomalous historical durations over 1 hour to display as - or Stalled. This PR corrects newly finalized async runs, but it does not cap existing stale/stuck durationMs values in the Runs list or Run Detail, so the original reported 66345s / 68535s records can still render raw.

I would treat these as blockers before merge.

onCompiled={load}
onError={(msg) => setError(msg || null)}
canClone={canClone}
onCreateNewVersion={async (summary) => {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still reads the old changeSummary state. setChangeSummary(summary) is asynchronous, so createNewVersion() immediately sees the previous state value, which is usually empty for the CQL-tab modal and triggers the required-summary error. Please pass the summary directly into the clone function, or make the API call here with the summary argument instead of going through state.

Taleef added 2 commits May 20, 2026 16:28
@Taleef7
Copy link
Copy Markdown
Owner Author

Taleef7 commented May 20, 2026

Addressed the PR #44 review blockers and pushed them in fb9e0aa.\n\n- CQL New Version now passes the modal summary directly into the clone request and only closes the dialog after a successful create.\n- Runs list and Run Detail now render anomalous durationMs values over 1 hour as '-' for completed/non-running rows or 'Stalled' for running rows.\n- The Cases search URL-sync feedback is covered by the merged main-branch guarded URL/state sync implementation.\n- Merged origin/main into the PR branch, resolving the merge conflict.\n\nVerification run locally:\n- frontend: corepack pnpm lint (0 errors, existing next-font anonymous default export warning)\n- frontend: corepack pnpm test (40 passed)\n- frontend: corepack pnpm build (passed)\n- backend focused: .\gradlew.bat test --tests com.workwell.export.* --tests com.workwell.web.RunControllerTest (BUILD SUCCESSFUL)\n\nGitHub currently reports Frontend, Vercel, and Vercel Preview Comments passing; Backend CI jobs are still in progress.

…seeds

The sections-6-8 PR rewrote ValueSetGovernanceService.ensureDemoValueSets()
so seeded demo value-set names match the CQL `valueset "..."` declarations
(required for findUnattachedReferences to detect real gaps instead of
flagging the seed itself). The new ensureValueSet() helper UPDATEs the same
UUIDs that V013__value_set_governance.sql inserted, overwriting:

  Audiogram Procedure Codes        -> Audiogram Procedures
  TB Screening Procedure Codes     -> TB Screening Procedures
  HAZWOPER Medical Clearance Codes -> HAZWOPER Surveillance Exams
  Influenza Vaccine Immunization Codes -> Influenza Vaccines

ValueSetGovernanceIntegrationTest.resolveCheckWithSeededDemoValueSetsLinked
still asserted the V013 name, so the run-time seed-overwrite broke the
anyMatch assertion. MeasureControllerTest mocks used the same old names as
fixtures; mocks were self-consistent so they passed, but kept stale truth.

This commit aligns both with the post-PR seed names.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Taleef7 Taleef7 merged commit ae7a76e into main May 21, 2026
9 checks passed
@Taleef7 Taleef7 deleted the fix/sprint-1-uat-sections-6-8 branch May 21, 2026 00:56
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.

UAT Fix: Sections 6-8 — Runs anomalous durations, Studio New Version button, Admin scheduler confirmation

2 participants