Skip to content

Add CLAUDE.md and AGENTS.md with codebase review and improvement roadmap#28

Merged
lam0819 merged 7 commits intomainfrom
claude/review-and-docs-ncvzh
Feb 19, 2026
Merged

Add CLAUDE.md and AGENTS.md with codebase review and improvement roadmap#28
lam0819 merged 7 commits intomainfrom
claude/review-and-docs-ncvzh

Conversation

@lam0819
Copy link
Contributor

@lam0819 lam0819 commented Feb 19, 2026

Thorough review of all 42 source files and 18 test files to create
project context (CLAUDE.md) and agent instructions (AGENTS.md).

CLAUDE.md covers: architecture, namespace map, state machine, key
contracts, conventions, builder patterns, and CI/CD pipeline.

AGENTS.md covers: code review checklist, testing gaps, implementation
patterns, and a prioritized improvement roadmap identifying 16 issues
including unimplemented timeouts, missing retry logic, broken
compensation/saga pattern, and Laravel helper coupling in a
framework-agnostic package.

https://claude.ai/code/session_013CdFJtmtMmSqBZFwdrmicG

claude and others added 7 commits February 18, 2026 12:27
Thorough review of all 42 source files and 18 test files to create
project context (CLAUDE.md) and agent instructions (AGENTS.md).

CLAUDE.md covers: architecture, namespace map, state machine, key
contracts, conventions, builder patterns, and CI/CD pipeline.

AGENTS.md covers: code review checklist, testing gaps, implementation
patterns, and a prioritized improvement roadmap identifying 16 issues
including unimplemented timeouts, missing retry logic, broken
compensation/saga pattern, and Laravel helper coupling in a
framework-agnostic package.

https://claude.ai/code/session_013CdFJtmtMmSqBZFwdrmicG
…s, clean API, add event spy

Phase 1 — Remove Laravel coupling:
- Add Support\Arr helper for dot-notation array access
- Replace data_get() calls in Step and WorkflowDefinition with Arr::get()
- Remove getNestedValue() from WorkflowDefinition
- Fix HttpAction to use curl instead of Laravel Http facade
- Remove Laravel-specific PHPStan suppressions

Phase 3 — Normalize event naming:
- Rename WorkflowStarted → WorkflowStartedEvent
- Rename WorkflowCancelled → WorkflowCancelledEvent
- Standardize constructors to accept WorkflowInstance

Phase 4 — Clean up duplicate API methods:
- Remove getWorkflow() (duplicate of getInstance())
- Remove listWorkflows() (duplicate of getInstances())
- Add WorkflowState enum conversion to getInstances()

Phase 7 — Add SpyEventDispatcher:
- Create tests/Support/SpyEventDispatcher for event verification
- Add EventDispatchTest integration tests
- Add ArrTest unit tests

https://claude.ai/code/session_013CdFJtmtMmSqBZFwdrmicG
…e enforcement

Phase 2 — Deduplicate condition evaluation:
- Extract ConditionEvaluator to Support namespace
- Both Step and WorkflowDefinition delegate to it
- Throw on unparseable conditions instead of silently passing

Phase 5 — Retry logic:
- Add executeActionWithRetry() to Executor with exponential backoff
- Dispatch StepRetriedEvent on each retry attempt
- Respects Step::getRetryAttempts() configuration

Phase 6 — Timeout enforcement:
- Add executeWithTimeout() using pcntl_alarm (graceful fallback)
- Add Timeout helper for parsing duration strings (30s, 5m, 2h, 1d)
- Wrap action execution with timeout in Executor

Phase 8 — State transition enforcement:
- WorkflowInstance::setState() now validates via canTransitionTo()
- Add PENDING→FAILED and PAUSED→FAILED transitions
- Executor handles PAUSED→RUNNING and WAITING→RUNNING on resume
- WorkflowEngine::cancel() guards against terminal states

Additional fixes:
- Replace ALL remaining data_get/data_set/class_basename calls
  (WorkflowContext, ActionResult, ConditionAction, SimpleWorkflow,
  ActionNotFoundException, StepExecutionException)
- Add Arr::classBasename() helper
- Clean up stale PHPStan ignore patterns
- Fix DocumentApproval test conditions to proper format

CI: 93 tests, 224 assertions, all green. PHPStan level 6 clean.

https://claude.ai/code/session_013CdFJtmtMmSqBZFwdrmicG
Sync documentation with actual codebase after recent improvements:
- Update file counts (46 src, 25 test files) and test stats (93 tests, 224+ assertions)
- Fix Quick Start code examples to use the actual WorkflowEngine API
- Add complete namespace map with all classes including DefinitionParser, ActionResolver, StepRetriedEvent, ConditionEvaluator, Arr, Timeout
- Document enforced state transitions with valid transition rules
- Update StorageAdapter example with all 6 interface methods
- Fix EventDispatcher example with correct class names and modern PHP syntax
- Add debug() to Logger example, matching actual contract
- Document quick template for documentApproval()
- Add new quality standards: architecture tests, state transition validation, CI matrix

https://claude.ai/code/session_013CdFJtmtMmSqBZFwdrmicG
Add back documentation for PHP 8 attributes (#[Retry], #[Timeout],
#[Condition], #[WorkflowStep]) that were inadvertently removed.
These are real features using readonly classes with native PHP attributes.

https://claude.ai/code/session_013CdFJtmtMmSqBZFwdrmicG
- Standardize WorkflowCompletedEvent and WorkflowFailedEvent to use
  `final readonly class` with constructor promotion, matching all other
  event classes. Added helper methods (getWorkflowId, getWorkflowName,
  getErrorMessage) for consistency.

- README improvements:
  - Remove broken /docs link that pointed to non-existent directory
  - Document SimpleWorkflow helper with usage examples
  - Document getInstances() filter options (state, definition_name,
    created_after, created_before, limit, offset)
  - Document getProgress() and getStatusSummary() on WorkflowInstance
  - Add built-in actions table (LogAction, ConditionAction, etc.)
  - Add WorkflowState helper methods section (isActive, color, icon, etc.)
  - Clarify PHP 8.3+ attributes are metadata annotations, not yet
    auto-parsed by the engine at runtime

https://claude.ai/code/session_013CdFJtmtMmSqBZFwdrmicG
@lam0819 lam0819 merged commit f442c75 into main Feb 19, 2026
6 checks passed
@lam0819 lam0819 deleted the claude/review-and-docs-ncvzh branch February 19, 2026 06:45
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.

2 participants

Comments