103 lines
6.1 KiB
JSON
103 lines
6.1 KiB
JSON
|
|
{
|
||
|
|
"task_id": "CODE-DEDUP-REPOSITORY-001",
|
||
|
|
"plan_ref": "agent-system/runs/CODE-DEDUP-REPOSITORY-001/plan.json",
|
||
|
|
"status": "done",
|
||
|
|
"changed_files": [
|
||
|
|
{
|
||
|
|
"path": "lib/Repository/Support/RepositoryArrayHelper.php",
|
||
|
|
"summary": "CREATED — S1: New final class with 4 public static methods: unwrap(), unwrapList(), extractIds(), sanitizePositiveIds(). Provides shared array helpers for MintyPHP DB layer row unwrapping and ID handling."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"path": "tests/Repository/Support/RepositoryArrayHelperTest.php",
|
||
|
|
"summary": "CREATED — S2: 21 tests covering all 4 methods with edge cases: null input, empty arrays, missing keys, deduplication, custom ID fields, fallback to row, zero/negative IDs, type casting, reindexing."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"path": "lib/Repository/Tenant/TenantRepository.php",
|
||
|
|
"summary": "S3: Removed private unwrap() and unwrapList() methods. Replaced all inline calls with RepositoryArrayHelper::unwrap/unwrapList/extractIds/sanitizePositiveIds. Eliminated ~40 lines of duplication."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"path": "lib/Repository/Access/RoleRepository.php",
|
||
|
|
"summary": "S4: Removed private unwrap() and unwrapList() methods. Replaced all inline calls with RepositoryArrayHelper equivalents. Eliminated ~35 lines of duplication."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"path": "lib/Repository/Access/PermissionRepository.php",
|
||
|
|
"summary": "S4: Replaced inline unwrap patterns ($row['permissions'] ?? $row) in list(), listActive(), listPaged(), find(), findByKey() with RepositoryArrayHelper::unwrapList/unwrap. Eliminated ~25 lines of duplication."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"path": "lib/Repository/Org/DepartmentRepository.php",
|
||
|
|
"summary": "S5: Removed private unwrap() and unwrapList() methods. Replaced all inline calls with RepositoryArrayHelper equivalents. Eliminated ~40 lines of duplication."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"path": "lib/Repository/Org/UserDepartmentRepository.php",
|
||
|
|
"summary": "S5: Replaced inline extractIds pattern in listDepartmentIdsByUserId() and sanitizePositiveIds in countByDepartmentIds() with RepositoryArrayHelper calls. Eliminated ~12 lines of duplication."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"path": "lib/Repository/Access/UserRoleRepository.php",
|
||
|
|
"summary": "S6: Replaced inline extractIds patterns in listRoleIdsByUserId() and listUserIdsByRoleIds(), and sanitizePositiveIds in countByRoleIds() and listUserIdsByRoleIds() with RepositoryArrayHelper calls. Eliminated ~20 lines of duplication."
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"guard_evidence": [
|
||
|
|
{
|
||
|
|
"guard_id": "GR-CORE-001",
|
||
|
|
"status": "pass",
|
||
|
|
"evidence": "RepositoryArrayHelper is a final class in lib/Repository/Support/ — the repository support layer. Contains only static array manipulation methods. No business logic, no HTTP, no HTML. All 6 refactored repositories remain in their correct namespaces with unchanged public API."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"guard_id": "GR-LANG-001",
|
||
|
|
"status": "pass",
|
||
|
|
"evidence": "All new and modified PHP files follow PSR-4 namespace conventions. MintyPHP\\Repository\\Support\\RepositoryArrayHelper maps to lib/Repository/Support/RepositoryArrayHelper.php. CS Fixer reports 0 of 528 files need fixing."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"guard_id": "GR-LANG-002",
|
||
|
|
"status": "pass",
|
||
|
|
"evidence": "PHPStan level 5: 0 new errors from this task. 4 pre-existing errors in tests/Architecture/AuthzUiContractTest.php (nullable offset warnings) — verified pre-existing in prior tasks."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"guard_id": "GR-TEST-001",
|
||
|
|
"status": "pass",
|
||
|
|
"evidence": "21 new tests added in RepositoryArrayHelperTest. 624 total tests run, 0 errors introduced by this task. 1 pre-existing failure (TranslationKeysTest: missing i18n key) — verified pre-existing in prior tasks."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"guard_id": "GR-TEST-002",
|
||
|
|
"status": "pass",
|
||
|
|
"evidence": "New tests cover edge cases: null/empty input, missing table keys, ID deduplication, custom ID fields, fallback to row, zero/negative IDs, type casting from strings, array reindexing. No existing tests modified."
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"commands": [
|
||
|
|
{ "cmd": "docker compose exec php vendor/bin/phpunit --no-coverage", "result": "pass" },
|
||
|
|
{ "cmd": "docker compose exec php vendor/bin/phpstan analyse -c phpstan.neon --no-progress", "result": "pass" },
|
||
|
|
{ "cmd": "docker compose exec php vendor/bin/php-cs-fixer fix --dry-run --config=.php-cs-fixer.dist.php", "result": "pass" },
|
||
|
|
{ "cmd": "docker compose exec php vendor/bin/phpunit --filter CoreStarterkitContractTest|ContainerFactoryContractTest", "result": "pass" },
|
||
|
|
{ "cmd": "rg 'RepositoryArrayHelper' lib/Repository/ --files-with-matches (SC-001+SC-002: usage in 6 repo files + helper itself)", "result": "pass" },
|
||
|
|
{ "cmd": "rg 'private function unwrap' lib/Repository/ (SC-002: 0 inline unwrap in scoped repos; remaining are out-of-scope repos)", "result": "pass" }
|
||
|
|
],
|
||
|
|
"quality_gate_results": [
|
||
|
|
{
|
||
|
|
"gate_id": "QG-001",
|
||
|
|
"result": "pass",
|
||
|
|
"notes": "624 tests, 0 errors introduced by this task. 21 new tests added. 1 pre-existing failure (TranslationKeysTest: missing i18n key) — verified pre-existing in prior tasks (git stash → phpunit → same failure). This task introduced zero test failures."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"gate_id": "QG-002",
|
||
|
|
"result": "pass",
|
||
|
|
"notes": "0 new PHPStan errors introduced by this task. 4 pre-existing errors in tests/Architecture/AuthzUiContractTest.php (nullable offset warnings) — verified pre-existing in prior tasks. This task introduced zero PHPStan errors."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"gate_id": "QG-003",
|
||
|
|
"result": "pass",
|
||
|
|
"notes": "Architecture contract tests (CoreStarterkitContractTest + ContainerFactoryContractTest): 24 tests, 6466 assertions, all green."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"gate_id": "QG-006",
|
||
|
|
"result": "pass",
|
||
|
|
"notes": "php-cs-fixer fix --dry-run: 0 of 528 files need fixing."
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"test_results": [
|
||
|
|
{ "name": "tests/Repository/Support/RepositoryArrayHelperTest.php", "result": "pass" },
|
||
|
|
{ "name": "tests/Architecture/CoreStarterkitContractTest.php", "result": "pass" },
|
||
|
|
{ "name": "tests/Architecture/ContainerFactoryContractTest.php", "result": "pass" }
|
||
|
|
],
|
||
|
|
"open_items": []
|
||
|
|
}
|