Files
breadcrumb-the-shire/core/Service/Scheduler/Handler/ScheduledJobHandlerInterface.php
fs 0e86925464 refactor: rename lib/ to core/ for clearer core-module separation
Rename the top-level lib/ directory to core/ so the project root
immediately communicates which code is core platform and which lives
in modules/. PHP namespaces (MintyPHP\*) are unchanged — only the
Composer PSR-4 path mapping moves from lib/ to core/.

Module-internal lib/ directories (modules/*/lib/) are untouched.

Updated across the full stack:
- composer.json PSR-4 mapping
- bootstrap entry points (web/index.php, bin/*, tests/bootstrap.php)
- tooling configs (phpstan.neon, phpunit.xml, php-cs-fixer)
- 26 architecture contract tests
- enforcement-policy, guard-catalog, quality-gates
- all documentation (CLAUDE.md, README, 25 docs/, .agents/skills/)
- bin/qa-extended.sh search paths
- .claude/settings.local.json permission paths

Workflow: .agents/runs/CORE-LIB-RENAME-001/ (Analyst → Planner →
Executor → Code Review (4 findings fixed) → Security Review →
Acceptance Test → Finalizer)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 23:20:42 +02:00

47 lines
2.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace MintyPHP\Service\Scheduler\Handler;
interface ScheduledJobHandlerInterface
{
/**
* Returns the job definition (metadata + schedule defaults).
*
* The job_key is NOT included here it is provided as the key in the
* registry handler map in ScheduledJobRegistry.
*
* Required keys:
* label (string) Human-readable name shown in admin UI.
* description (string) Short description of what the job does.
* default_enabled (int) 1 = enabled on first creation, 0 = disabled.
* default_timezone (string) IANA timezone name (e.g. 'Europe/Berlin').
* default_schedule_type (string) 'hourly'|'daily'|'weekly'
* default_schedule_interval (int) 1..24 hourly / 1..365 daily / 1..52 weekly
* default_schedule_time (string|null) 'HH:MM', required for daily and weekly.
* default_schedule_weekdays_csv(string|null) CSV of ISO weekday numbers 1..7, weekly only.
* default_catchup_once (int) 1 = catch up once after downtime (default).
* allowed_schedule_types (array) Subset of ['hourly','daily','weekly'].
*/
public function definition(): array;
/**
* Executes the job and returns a normalized result envelope.
*
* Implementations are responsible for:
* - Calling the underlying service
* - Mapping service results to the envelope format below
* - Handling and wrapping service-level errors (e.g. lock_not_acquired → skipped)
*
* The result array content is job-specific and is JSON-encoded into the run log.
* Keep values JSON-serializable (no objects, no resources).
*
* @param int|null $actorUserId Null for scheduler-triggered runs; user ID for manual runs.
* @return array{status:string, error_code:?string, error_message:?string, result:array}
* status: 'success'|'failed'|'skipped'
* error_code: short machine-readable code, null on success
* error_message: human-readable detail, null on success (max 255 chars)
* result: job-specific payload, empty array if nothing to report
*/
public function execute(?int $actorUserId): array;
}