refactor(core)!: TaskHandle, security hardening, robustness, and test/doc overhaul#16
Merged
refactor(core)!: TaskHandle, security hardening, robustness, and test/doc overhaul#16
Conversation
…/doc overhaul
BREAKING CHANGE: RunTask now returns (*TaskHandle, error) instead of error.
## Core — Breaking Changes
- Replace fire-and-forget RunTask with TaskHandle pattern
- New TaskHandle type: Done() <-chan struct{}, Err() error, TaskID() string
- WaitForAllTasksToComplete(timeout) replaces polling
- Fix StopTask lock contention (cancel() called outside lock)
- ActionWrapper changed from func type to interface
## Core — New Features
- Add duplicate task ID check in AddTask (returns descriptive error)
- Add NewAction[T] constructor with auto-ID generation from name
- Add configurable MaxDecompressedSize (decompression bomb protection)
- Add TypedOutputKey, ActionResultAs, TaskResultAs typed helpers
- Task mutex upgraded to sync.RWMutex for concurrent reads
## Security
- Eliminate data races in parameter resolution (RLock all 5 Resolve methods)
- Reject all .. path traversal in file validation
- Use sanitized path for recursive delete
- Validate interface name to prevent path traversal in utility action
- Add argument sentinels (--) for mv/chmod/chown injection defense
## File Actions
- Atomic write (temp+rename) in ReplaceLinesAction — prevents data loss on crash
- Configurable directory permissions in ExtractFileAction (default 0o750)
- Prefer native os.Rename/os.Chmod over external commands in move/permissions actions
- Fix TarGz to reject non-gzipped files; check Close() errors in Zip extraction
## Docker / System Actions
- Fix Docker Run Action arg ordering (image after user options)
- Migrate all 8 docker+system action files to RunCommandWithContext
- Fix Docker Generic Action cancellation support
## Lint
- Re-enable errcheck; fix all 26 violations with proper defer/nolint patterns
- Fix replace_lines_action variable shadowing bug
## Tests
- Reorganize root-level test files: each production file now has a matching _test.go
- New testhelpers_test.go (shared fixtures, package task_engine_test)
- New parameters_test.go (all parameter/resolve/GlobalContext tests)
- Deleted orphan catch-all task_engine_test.go and parameters_resolve_test.go
- Add TestHandle* suite (Done, Err, TaskID behavior)
- Add TestAddTaskDuplicateID, validate duplicate action IDs at task level
- Update all 17 RunTask call sites across 5 test files
- Add cancellation, builder-error, typed-helper fallback, manager timeout/reset tests
## Docs
- Update README, docs/API.md, docs/QUICKSTART.md, docs/ARCHITECTURE.md
to reflect ActionWrapper interface, TaskHandle usage, correct RunTask/AddTask signatures
- Remove stale closure-based action pattern from all examples
- Fix broken backtick fences throughout API.md and ARCHITECTURE.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Core — Breaking Changes
Core — New Features
Security
File Actions
Docker / System Actions
Lint
Tests
Docs