Skip to content

Implement dummy and pausable tasks for copy-and-paste feature#142

Closed
Copilot wants to merge 7 commits into
feature/copy-and-pastefrom
copilot/fix-141
Closed

Implement dummy and pausable tasks for copy-and-paste feature#142
Copilot wants to merge 7 commits into
feature/copy-and-pastefrom
copilot/fix-141

Conversation

Copilot AI commented Jun 9, 2025

Copy link
Copy Markdown
Contributor

This PR implements dummy task functionality as specified in issue #141 to demonstrate the basic task interface and provide examples for future task implementations in the copy-and-paste feature.

What's Implemented

Task 1: DummyTask

A basic task implementation that demonstrates:

  • 10-second duration with 1-second progress intervals (0-100%)
  • Proper abort signal handling using AbortController
  • State transitions: PendingInitializingRunningCompleted/Stopped
  • Basic Task interface implementation

Task 2: PausableDummyTask

An advanced task implementation extending the dummy task with:

  • Pause/resume functionality via PausableTask interface
  • State management for Pausing/Paused/Resuming states
  • Progress preservation across pause/resume cycles
  • Accurate time tracking that excludes paused time from total duration

Example Usage

import { TaskService } from '../taskService';
import { DummyTask, PausableDummyTask } from './tasks';

// Basic task
const task = new DummyTask('My Task');
TaskService.registerTask(task);
await task.start();
// Task runs for 10 seconds with progress updates

// Pausable task
const pausableTask = new PausableDummyTask('Pausable Task');
TaskService.registerTask(pausableTask);
await pausableTask.start();
await pausableTask.pause();  // Pause execution
await pausableTask.resume(); // Resume from where it left off

Testing

Comprehensive Jest test suite with 40 tests covering:

  • ✅ Basic task lifecycle and state management
  • ✅ Progress reporting accuracy
  • ✅ Abort signal handling during various states
  • ✅ Pause/resume functionality and edge cases
  • ✅ Multiple pause/resume cycles
  • ✅ Error handling and state validation
  • ✅ Integration with TaskService

Files Added

  • src/services/tasks/DummyTask.ts - Basic task implementation
  • src/services/tasks/PausableDummyTask.ts - Pausable task implementation
  • src/services/tasks/index.ts - Export barrel file
  • src/services/tasks/DummyTask.test.ts - Comprehensive DummyTask tests
  • src/services/tasks/PausableDummyTask.test.ts - Comprehensive PausableTask tests
  • src/services/tasks/demo.ts - Usage examples and demonstrations

These implementations provide a solid foundation for future copy-and-paste task development and demonstrate proper integration with the existing task service architecture.

Fixes #141.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits June 9, 2025 14:58
Co-authored-by: tnaum-ms <171359267+tnaum-ms@users.noreply.github.com>
Co-authored-by: tnaum-ms <171359267+tnaum-ms@users.noreply.github.com>
Copilot AI changed the title [WIP] Copy-and-Paste: 1.5. Implement a dummy task Implement dummy and pausable tasks for copy-and-paste feature Jun 9, 2025
Copilot AI requested a review from tnaum-ms June 9, 2025 15:03
@tnaum-ms tnaum-ms changed the base branch from main to feature/copy-and-paste June 9, 2025 15:25
@tnaum-ms

tnaum-ms commented Jun 9, 2025

Copy link
Copy Markdown
Collaborator

Interesting, so this really went south :D it looks like Copilot used 'main' instead of the feature branch to start working.

@tnaum-ms tnaum-ms closed this Jun 9, 2025
@tnaum-ms

Copy link
Copy Markdown
Collaborator

This didn't work well with copilot, discarding this PR and the branch

@tnaum-ms tnaum-ms deleted the copilot/fix-141 branch June 18, 2025 08:00
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.

Copy-and-Paste: 1.5. Implement a dummy task

2 participants