Skip to content

Substitution "My Work" integration is orphaned — 4 exported functions, 0 callers, no toggle in the UI; the e2e test hides it behind a soft if #768

Description

@rubenvdlinde

What

openspec/specs/handler-vervanging-waarneming/spec.md requires that a waarnemer sees substituted work in My Work, filtered by substitution scope. The building blocks were written and are annotated @spec — but nothing calls them:

symbol file callers in src/
fetchSubstitutedWork() src/services/substitutionApi.js:57 0
buildSubstitutedMap() src/utils/substitutionHelpers.js 0
mergeSubstitutedCases() src/utils/substitutionHelpers.js 0
applySubstitutedFilter() src/utils/substitutionHelpers.js:76 0

src/utils/substitutionHelpers.js has no importer anywhere in src/. substitutionApi.js is imported four times (SubstitutionAdmin.vue, SubstitutionSettings.vue, BulkReassignModal.vue, SubstitutionFormModal.vue) — all for list/revoke/create/preview/execute. The My Work path is imported by nothing.

MyWorkCards.vue never calls the fetch, never merges substituted items, and renders no show/hide control. Grepping src/ for showSubstituted returns only the helper's own parameter — no .vue file uses it.

So: the registration and admin surfaces of substitution work; the routing of substituted work into the waarnemer's My Work does not exist in the UI.

Why this stayed invisible

tests/e2e/spec-coverage/handler-vervanging-waarneming.spec.ts carries the @e2e tags for both affected scenarios:

  • #waarnemer-sees-substituted-work-in-my-work
  • #scope-limited-substitution-only-routes-matching-items

and its body is:

await expect(page.getByRole('heading', { name: /My Work/ }).first()).toBeVisible(...)
await expect(page.locator('body')).not.toContainText('Internal Server Error')
const toggle = page.getByTestId('substituted-toggle')
if (await toggle.isVisible({ timeout: 3000 }).catch(() => false)) {
    await toggle.locator('input').click()
    ...
}

There is no data-testid="substituted-toggle" anywhere in src/ — I checked every data-testid value in the tree. The guard can never be true, so the toggle branch never executes.

This is worse than a skip. A skipped test at least shows up in the run summary as skipped. This test passes, having asserted only that a heading renders and the page did not 500, while the coverage gate records both scenarios as e2e-covered.

Ask

  1. Wire the My Work integration: call fetchSubstitutedWork() from MyWorkCards.vue, merge via mergeSubstitutedCases() / buildSubstitutedMap(), and render a "Show substituted work" toggle bound through applySubstitutedFilter().
  2. Give the toggle data-testid="substituted-toggle" so the existing e2e branch can actually run.
  3. Then turn the soft if (toggle.isVisible()) into a hard assertion, so a regression fails rather than quietly passing.

If instead the decision is that the My Work integration is out of scope, the four orphaned functions should be deleted and the two scenarios given a reason-bearing @e2e exclude — not left as dead code with green tests pointing at them.

Found during a fleet-wide triage of disabled e2e declarations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions