Skip to content

test(tasks): cover task domain view mappers#86755

Merged
steipete merged 1 commit into
openclaw:mainfrom
leno23:leno23/test-task-domain-views
May 30, 2026
Merged

test(tasks): cover task domain view mappers#86755
steipete merged 1 commit into
openclaw:mainfrom
leno23:leno23/test-task-domain-views

Conversation

@leno23

@leno23 leno23 commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add focused coverage for task-domain view mappers
  • assert task run and flow DTO field mapping, nested flow details, and summary cloning
  • cover implicit flow detail summaries when callers do not provide one

Test plan

  • git diff --check
  • PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm exec vitest run src/tasks/task-domain-views.test.ts

Duplicate check

Test-only change; no runtime behavior changes.

Real behavior proof

  • Behavior or issue addressed: Task-domain view mappers produce the public task-run and flow-detail DTO shapes, including nested task views and aggregate summaries, without leaking internal registry field names such as taskId, parentFlowId, or requesterSessionKey into the public view.
  • Real environment tested: local OpenClaw checkout on this PR branch (leno23/test-task-domain-views) on macOS, using Node with the repository TypeScript loader (node --import tsx).
  • Exact steps or command run after this patch:
    PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false node --import tsx --input-type=module <<'NODE'
    import { mapTaskFlowDetail, mapTaskRunView } from './src/tasks/task-domain-views.ts';
    
    const task = {
      taskId: 'task-proof',
      runtime: 'cli',
      requesterSessionKey: 'agent:main:main',
      ownerKey: 'agent:main:main',
      scopeKind: 'session',
      parentFlowId: 'flow-proof',
      task: 'Verify task domain mapper proof',
      status: 'failed',
      deliveryStatus: 'failed',
      notifyPolicy: 'done_only',
      createdAt: 100,
      terminalSummary: 'blocked by external approval',
    };
    const flow = {
      flowId: 'flow-proof',
      syncMode: 'managed',
      ownerKey: 'agent:main:main',
      revision: 1,
      status: 'blocked',
      notifyPolicy: 'done_only',
      goal: 'Prove mapper output',
      blockedTaskId: 'task-proof',
      blockedSummary: 'Waiting on approval',
      createdAt: 90,
      updatedAt: 120,
    };
    const detail = mapTaskFlowDetail({ flow, tasks: [task] });
    console.log(JSON.stringify({ runView: mapTaskRunView(task), flowDetail: detail }, null, 2));
    NODE
  • Evidence after fix: terminal output from the patched checkout:
    {
      "runView": {
        "id": "task-proof",
        "runtime": "cli",
        "sessionKey": "agent:main:main",
        "ownerKey": "agent:main:main",
        "scope": "session",
        "flowId": "flow-proof",
        "title": "Verify task domain mapper proof",
        "status": "failed",
        "deliveryStatus": "failed",
        "notifyPolicy": "done_only",
        "createdAt": 100,
        "terminalSummary": "blocked by external approval"
      },
      "flowDetail": {
        "id": "flow-proof",
        "ownerKey": "agent:main:main",
        "status": "blocked",
        "notifyPolicy": "done_only",
        "goal": "Prove mapper output",
        "createdAt": 90,
        "updatedAt": 120,
        "blocked": {
          "taskId": "task-proof",
          "summary": "Waiting on approval"
        },
        "tasks": [
          {
            "id": "task-proof",
            "runtime": "cli",
            "sessionKey": "agent:main:main",
            "ownerKey": "agent:main:main",
            "scope": "session",
            "flowId": "flow-proof",
            "title": "Verify task domain mapper proof",
            "status": "failed",
            "deliveryStatus": "failed",
            "notifyPolicy": "done_only",
            "createdAt": 100,
            "terminalSummary": "blocked by external approval"
          }
        ],
        "taskSummary": {
          "total": 1,
          "active": 0,
          "terminal": 1,
          "failures": 1,
          "byStatus": {
            "queued": 0,
            "running": 0,
            "succeeded": 0,
            "failed": 1,
            "timed_out": 0,
            "cancelled": 0,
            "lost": 0
          },
          "byRuntime": {
            "subagent": 0,
            "acp": 0,
            "cli": 1,
            "cron": 0
          }
        }
      }
    }
  • Observed result after fix: The live mapper invocation returned public id, sessionKey, flowId, title, nested tasks, and computed taskSummary fields exactly as the task-domain contract exposes them; the new tests now lock these outputs down.
  • What was not tested: Full broad checks were not rerun locally; targeted mapper tests and git diff --check passed.

@openclaw-barnacle openclaw-barnacle Bot added size: M triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed May 30, 2026, 5:35 AM ET / 09:35 UTC.

Summary
Adds src/tasks/task-domain-views.test.ts with Vitest coverage for task run, task flow, nested detail, aggregate summary cloning, and implicit summary mapping.

PR surface: Tests +212. Total +212 across 1 file.

Reproducibility: not applicable. This PR adds test coverage rather than reporting a runtime bug. Source inspection and the PR body’s terminal proof confirm the mapper path being covered.

Review metrics: none identified.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] The head SHA still had normal check-settlement noise at inspection time: a queued timing summary and one in-progress critical-quality check, with no diff-caused failure visible.

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused mapper tests after normal required checks complete, keeping runtime mapper behavior unchanged unless a separate bug is found.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No ClawSweeper repair is needed; the remaining action is ordinary maintainer review and check settlement.

Security
Cleared: The diff only adds a Vitest test file and does not change runtime code, dependencies, workflows, lockfiles, scripts, secrets handling, or package metadata.

Review details

Best possible solution:

Land the focused mapper tests after normal required checks complete, keeping runtime mapper behavior unchanged unless a separate bug is found.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds test coverage rather than reporting a runtime bug. Source inspection and the PR body’s terminal proof confirm the mapper path being covered.

Is this the best way to solve the issue?

Yes: colocated unit coverage is the narrowest maintainable way to lock down these DTO mappings without changing runtime behavior or API surface.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 28eb4cfa12e5.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal proof from a patched checkout invoking the mappers and showing the resulting public DTO JSON, which is sufficient for this non-visual test-only change.

Label justifications:

  • P3: This is a low-risk test-only coverage PR for an existing mapper boundary.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes terminal proof from a patched checkout invoking the mappers and showing the resulting public DTO JSON, which is sufficient for this non-visual test-only change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal proof from a patched checkout invoking the mappers and showing the resulting public DTO JSON, which is sufficient for this non-visual test-only change.
Evidence reviewed

PR surface:

Tests +212. Total +212 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 212 0 +212
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 212 0 +212

What I checked:

  • Root policy read: Root AGENTS.md was read fully; no scoped AGENTS.md owns src/tasks, and the root test/proof/no-mutation review guidance applies to this PR. (AGENTS.md:1, 28eb4cfa12e5)
  • Current mapper source: Current main maps internal task registry fields into the public task run DTO shape and builds flow details from flow view fields, nested task views, and supplied or computed summaries. (src/tasks/task-domain-views.ts:23, 28eb4cfa12e5)
  • Public DTO contract: The runtime task domain types define the public fields the new tests assert, including TaskRunView, TaskFlowView, and TaskFlowDetail. (src/plugins/runtime/task-domain-types.ts:23, 28eb4cfa12e5)
  • Adjacent existing coverage: Current main already has runtime-level tests for canonical task and TaskFlow DTOs, but not the new colocated mapper-only coverage added by this PR. (src/plugins/runtime/runtime-tasks.test.ts:42, 28eb4cfa12e5)
  • PR diff reviewed: The PR patch adds only one new test file with cases for summary cloning, task run/detail mapping, flow view cloning, flow detail mapping, and implicit summary computation. (src/tasks/task-domain-views.test.ts:1, 931f8b320a69)
  • Real behavior proof: The PR body includes terminal output from a patched checkout invoking the mappers with node --import tsx and showing the resulting public DTO JSON. (931f8b320a69)

Likely related people:

  • steipete: Current-main blame and release/current graft history show Peter Steinberger recently added the mapper and adjacent runtime task test files into the current main line. (role: recent area contributor; confidence: high; commits: 032945a5cd9b, 27ae826f6525; files: src/tasks/task-domain-views.ts, src/plugins/runtime/runtime-tasks.ts, src/plugins/runtime/runtime-tasks.test.ts)
  • vincentkoc: All-history log shows Vincent Koc originally added the task-domain runtime surface and later split related runtime task contracts. (role: introduced behavior; confidence: high; commits: 774beb8e5c3d, 43a2156d1f50; files: src/tasks/task-domain-views.ts, src/plugins/runtime/task-domain-types.ts, src/plugins/runtime/runtime-tasks.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🌱 uncommon Moonlit Shellbean

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🌱 uncommon.
Trait: watches the merge queue.
Image traits: location merge queue dock; accessory shell-shaped keyboard; palette sunrise gold and clean white; mood patient; pose peeking out from the egg shell; shell starlit enamel shell; lighting gentle morning glow; background small review tokens.
Share on X: post this hatch
Copy: My PR egg hatched a 🌱 uncommon Moonlit Shellbean in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 26, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 26, 2026
@leno23 leno23 marked this pull request as draft May 26, 2026 15:48
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels May 26, 2026
@leno23 leno23 marked this pull request as ready for review May 30, 2026 09:23
@leno23 leno23 force-pushed the leno23/test-task-domain-views branch from 0a460e1 to 931f8b3 Compare May 30, 2026 09:30
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 30, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 30, 2026
@steipete steipete self-assigned this May 30, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer verification for current-main land:

Behavior addressed: adds focused coverage for task-domain view mapper DTO contracts in src/tasks/task-domain-views.test.ts.
Real environment tested: local checkout, PR head 931f8b3 merged cleanly without committing onto current origin/main becd453.
Exact steps or command run after this patch: git diff --check; PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm test src/tasks/task-domain-views.test.ts
Evidence after fix: git diff --check passed; Vitest passed 1 file / 6 tests.
Observed result after fix: mapper summary cloning, task run/detail mapping, flow view/detail mapping, and implicit summary computation are covered and passing on the current-main merge result.
What was not tested: no broad full-suite or package/E2E run; test-only PR, CI check set is green on GitHub for the PR head.

@steipete steipete merged commit 8d3fe21 into openclaw:main May 30, 2026
116 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 31, 2026
Adds focused coverage for task-domain view mapper DTO contracts, including summary cloning, task run/detail mapping, flow view/detail mapping, and implicit summary computation.

Test-only PR. Verified with git diff --check and PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm test src/tasks/task-domain-views.test.ts on the current-main merge result.

Thanks @leno23.

Co-authored-by: wuyangfan <yangfan.wu@succaiss.com>
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
Adds focused coverage for task-domain view mapper DTO contracts, including summary cloning, task run/detail mapping, flow view/detail mapping, and implicit summary computation.

Test-only PR. Verified with git diff --check and PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm test src/tasks/task-domain-views.test.ts on the current-main merge result.

Thanks @leno23.

Co-authored-by: wuyangfan <yangfan.wu@succaiss.com>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Adds focused coverage for task-domain view mapper DTO contracts, including summary cloning, task run/detail mapping, flow view/detail mapping, and implicit summary computation.

Test-only PR. Verified with git diff --check and PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm test src/tasks/task-domain-views.test.ts on the current-main merge result.

Thanks @leno23.

Co-authored-by: wuyangfan <yangfan.wu@succaiss.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants