Skip to content

Handle revision tasks in measure tasklist status and preview#694

Merged
j-maynard merged 4 commits into
mainfrom
SW-1281
Jun 4, 2026
Merged

Handle revision tasks in measure tasklist status and preview#694
j-maynard merged 4 commits into
mainfrom
SW-1281

Conversation

@j-maynard

Copy link
Copy Markdown
Collaborator

measureStatus in TasklistStateDTO now checks revision.tasks.measure before the isUpdate guard, so an in-progress revision task takes priority over the update/unchanged fallback. A task with lookupTableUpdated: false returns NotStarted (lookup needs to be re-uploaded), and lookupTableUpdated: true returns Updated. Without a task the existing isUpdate → Unchanged / joinColumn → Completed logic is unchanged.

getPreviewOfMeasure now forwards draftRevision.tasks to getMeasurePreview, so when a revision has an outstanding measure task the preview renders the raw fact-table column rather than the stale lookup table. The revisionTasks parameter type is widened to RevisionTask | null to accommodate the optional-chained value.

Tests added for:

  • measureStatus returning NotStarted/Updated based on the task's lookupTableUpdated flag (overriding isUpdate)
  • getMeasurePreview treating an explicit null for revisionTasks the same as undefined

`measureStatus` in `TasklistStateDTO` now checks `revision.tasks.measure` before the `isUpdate` guard, so an in-progress revision task takes priority over the update/unchanged fallback. A task with `lookupTableUpdated: false` returns `NotStarted` (lookup needs to be re-uploaded), and `lookupTableUpdated: true` returns `Updated`. Without a task the existing `isUpdate → Unchanged` / `joinColumn → Completed` logic is unchanged.

`getPreviewOfMeasure` now forwards `draftRevision.tasks` to `getMeasurePreview`, so when a revision has an outstanding measure task the preview renders the raw fact-table column rather than the stale lookup table. The `revisionTasks` parameter type is widened to `RevisionTask | null` to accommodate the optional-chained value.

Tests added for:
- `measureStatus` returning `NotStarted`/`Updated` based on the task's `lookupTableUpdated` flag (overriding `isUpdate`)
- `getMeasurePreview` treating an explicit `null` for `revisionTasks` the same as `undefined`
Copilot AI review requested due to automatic review settings June 4, 2026 12:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves how measure-related revision tasks affect publisher UX by prioritizing revision task state in the tasklist and ensuring the measure preview doesn’t show stale lookup-table data during an in-progress revision.

Changes:

  • Update TasklistStateDTO.measureStatus to prefer revision.tasks.measure.lookupTableUpdated over the isUpdate → Unchanged fallback.
  • Forward draftRevision.tasks into getMeasurePreview so measure preview can bypass the lookup-table path when a revision measure task exists.
  • Add unit tests covering task-driven measureStatus outcomes and null handling for revisionTasks in getMeasurePreview.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/dtos/tasklist-state-dto.ts Prioritizes revision measure task state (NotStarted/Updated) over update fallback logic.
src/controllers/measure.ts Passes draftRevision.tasks into getMeasurePreview to render an accurate preview during revisions.
src/services/measure-handler.ts Widens revisionTasks parameter type to allow null from optional-chained callers.
test/unit/dtos/tasklist-state-dto.test.ts Adds tests verifying measureStatus returns NotStarted/Updated based on lookupTableUpdated.
test/unit/services/measure-handler.test.ts Adds test verifying null revisionTasks behaves like “absent” tasks.

Comment thread src/dtos/tasklist-state-dto.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread test/unit/services/measure-handler.test.ts Fixed
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@j-maynard j-maynard merged commit b52f982 into main Jun 4, 2026
6 checks passed
@j-maynard j-maynard deleted the SW-1281 branch June 4, 2026 14:19
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.

3 participants