Skip to content

Commit b1c8c29

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/542-invoice-edit-page
2 parents 4b06acc + aa24901 commit b1c8c29

82 files changed

Lines changed: 11730 additions & 18 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
FABLE5 AUTONOMOUS EXECUTION PRD
2+
InvoicePlane-v2
3+
4+
────────────────────────────────────────
5+
PURPOSE
6+
────────────────────────────────────────
7+
Fable5 processes GitHub issues into draft PRs while reusing existing branches from:
8+
underdogg-forks/invoiceplane-v2
9+
10+
PRs already exist in:
11+
invoiceplane/invoiceplane-v2
12+
13+
Branches already exist in:
14+
underdogg-forks/invoiceplane-v2
15+
16+
Fable5 must reconcile both systems.
17+
18+
────────────────────────────────────────
19+
CRITICAL RULE
20+
────────────────────────────────────────
21+
NEVER CREATE NEW BRANCHES IF A PR-BOUND BRANCH ALREADY EXISTS.
22+
23+
Always reuse:
24+
- existing PR branches
25+
- existing fork branches
26+
27+
Branch identity is authoritative.
28+
29+
────────────────────────────────────────
30+
SOURCE OF TRUTH PRIORITY
31+
────────────────────────────────────────
32+
1. Existing GitHub PR (invoiceplane/invoiceplane-v2)
33+
2. Existing branch in fork (underdogg-forks/invoiceplane-v2)
34+
3. Issue definition
35+
4. Repository code state
36+
37+
────────────────────────────────────────
38+
EXECUTION MODEL
39+
────────────────────────────────────────
40+
- Iterate through all provided issue IDs
41+
- For each issue:
42+
- locate existing PR
43+
- extract associated branch from fork
44+
- checkout and continue work on that branch
45+
- do NOT reinitialize branch
46+
47+
────────────────────────────────────────
48+
BRANCH REUSE RULE
49+
────────────────────────────────────────
50+
If PR exists:
51+
- fetch PR branch from upstream or fork
52+
- checkout branch locally
53+
- continue commits
54+
55+
If PR does NOT exist:
56+
- only then create new branch
57+
58+
────────────────────────────────────────
59+
COMMIT POLICY
60+
────────────────────────────────────────
61+
- frequent commits required
62+
- atomic logical changes only
63+
- never mix multiple issues unless explicitly grouped
64+
65+
────────────────────────────────────────
66+
PR POLICY
67+
────────────────────────────────────────
68+
- all PRs must remain DRAFT
69+
- PR title format:
70+
[IP-{issueId}] description
71+
- PR body must be updated, never replaced blindly
72+
- preserve GitHub discussion history
73+
74+
────────────────────────────────────────
75+
FAILURE HANDLING
76+
────────────────────────────────────────
77+
If branch cannot be found:
78+
- attempt fetch from:
79+
underdogg-forks/invoiceplane-v2
80+
- if still missing:
81+
skip issue and log reason
82+
83+
────────────────────────────────────────
84+
EXECUTION END CONDITION
85+
────────────────────────────────────────
86+
Stop when:
87+
- all issues processed OR skipped
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
final class Fable5PolicyLoader
6+
{
7+
public function load(): array
8+
{
9+
return [
10+
'prd' => $this->loadFile('.claude/fable5/FABLE5_EXECUTION_PRD.md'),
11+
'skills' => $this->loadDirectory('.claude/fable5/skills'),
12+
'runtime' => $this->loadFile('.claude/fable5/runtime/overrides.md'),
13+
'repo' => $this->loadFile('CLAUDE.md'),
14+
];
15+
}
16+
17+
private function loadFile(string $path): array
18+
{
19+
return file_exists($path)
20+
? [file_get_contents($path)]
21+
: [];
22+
}
23+
24+
private function loadDirectory(string $path): array
25+
{
26+
if (!is_dir($path)) {
27+
return [];
28+
}
29+
30+
$files = glob($path . '/*.md');
31+
32+
return array_map(
33+
fn ($file) => file_get_contents($file),
34+
$files
35+
);
36+
}
37+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
FABLE5 EXECUTION BOOT FLOW
2+
3+
────────────────────────────────────────
4+
PHASE 0 — SYSTEM INITIALIZATION
5+
────────────────────────────────────────
6+
Before any issue execution begins, Fable5 MUST build a deterministic execution graph.
7+
8+
This step is mandatory and must complete successfully before any branch work starts.
9+
10+
────────────────────────────────────────
11+
PHASE 1 — DATA COLLECTION
12+
────────────────────────────────────────
13+
Fetch the following sources:
14+
15+
1. All open PRs from:
16+
invoiceplane/invoiceplane-v2
17+
18+
2. All branches from:
19+
underdogg-forks/invoiceplane-v2
20+
21+
3. Input issue list (static execution payload)
22+
23+
────────────────────────────────────────
24+
PHASE 2 — RECONCILIATION
25+
────────────────────────────────────────
26+
Build an ExecutionGraph by mapping:
27+
28+
Issue ID →
29+
Existing PR →
30+
Associated branch (if available) →
31+
Fork branch state
32+
33+
Rules:
34+
35+
- If PR exists AND branch exists in fork:
36+
→ mark node as EXISTING_PR
37+
38+
- If PR exists BUT branch missing:
39+
→ mark node as PR_MISSING_BRANCH
40+
41+
- If branch exists BUT no PR:
42+
→ mark node as ORPHAN_BRANCH
43+
44+
- If neither exists:
45+
→ mark node as NEW
46+
47+
────────────────────────────────────────
48+
PHASE 3 — EXECUTION STRATEGY GENERATION
49+
────────────────────────────────────────
50+
Fable5 MUST derive execution order from graph:
51+
52+
Priority order:
53+
1. EXISTING_PR (reuse and continue work)
54+
2. ORPHAN_BRANCH (recover and attach to PR if needed)
55+
3. PR_MISSING_BRANCH (repair state)
56+
4. NEW (create fresh branches)
57+
58+
────────────────────────────────────────
59+
PHASE 4 — PARALLELIZATION PLAN
60+
────────────────────────────────────────
61+
Fable5 may execute branches in parallel only if:
62+
63+
- no shared module writes exist
64+
- no overlapping DTO / Service modifications occur
65+
66+
Otherwise execution must be serialized per module lock rules.
67+
68+
────────────────────────────────────────
69+
PHASE 5 — EXECUTION HANDOFF
70+
────────────────────────────────────────
71+
Only after graph is complete:
72+
73+
→ begin issue processing loop
74+
→ reuse branches from graph
75+
→ never recreate existing execution state
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
RUNTIME OVERRIDES
2+
3+
- allow_reuse_existing_branches=true
4+
- forbid_branch_recreation=true
5+
- execution_mode=continuous
6+
- concurrency=enabled
7+
- commit_frequency=high
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
CONCURRENCY RULES
2+
3+
────────────────────────────────────────
4+
PARALLEL EXECUTION
5+
────────────────────────────────────────
6+
Allowed only when:
7+
- branches belong to different PRs
8+
- no shared module writes
9+
10+
────────────────────────────────────────
11+
MODULE LOCKING
12+
────────────────────────────────────────
13+
A module is locked when:
14+
- a branch is actively modifying it
15+
16+
No concurrent edits allowed on:
17+
- same Service
18+
- same DTO
19+
- same Filament Resource
20+
21+
────────────────────────────────────────
22+
SAFE PARALLEL MODEL
23+
────────────────────────────────────────
24+
Each PR branch is an isolated execution unit.
25+
26+
No cross-branch writes to same module.

.claude/fable5/skills/git-reuse.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
PR + BRANCH REUSE POLICY
2+
3+
────────────────────────────────────────
4+
CORE PRINCIPLE
5+
────────────────────────────────────────
6+
Existing work is authoritative.
7+
8+
If a branch exists in:
9+
underdogg-forks/invoiceplane-v2
10+
11+
and is linked to a PR in:
12+
invoiceplane/invoiceplane-v2
13+
14+
it MUST be reused.
15+
16+
────────────────────────────────────────
17+
MAPPING RULE
18+
────────────────────────────────────────
19+
Issue ID → PR → Branch → Fork repository state
20+
21+
This mapping is immutable during execution.
22+
23+
────────────────────────────────────────
24+
NO DUPLICATION RULE
25+
────────────────────────────────────────
26+
Never:
27+
- recreate PR branch
28+
- reinitialize git history
29+
- reapply already existing commits

.claude/fable5/skills/git.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
GIT EXECUTION RULES
2+
3+
────────────────────────────────────────
4+
BRANCH DISCOVERY
5+
────────────────────────────────────────
6+
Always resolve branches in this order:
7+
8+
1. GitHub PR branch reference
9+
2. local fork (underdogg-forks/invoiceplane-v2)
10+
3. remote origin fallback
11+
12+
Never create a branch if a PR-linked branch exists.
13+
14+
────────────────────────────────────────
15+
BRANCH CHECKOUT RULE
16+
────────────────────────────────────────
17+
When PR exists:
18+
- fetch PR head ref
19+
- checkout exact branch
20+
- continue history
21+
22+
No rebase unless explicitly required by issue.
23+
24+
────────────────────────────────────────
25+
COMMIT RULES
26+
────────────────────────────────────────
27+
- atomic commits only
28+
- one logical change per commit
29+
- frequent commits required
30+
31+
────────────────────────────────────────
32+
SAFETY RULE
33+
────────────────────────────────────────
34+
Never overwrite branch history that already belongs to a PR.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,8 @@ package-lock.json
8080
*.sqlite
8181
/failures.txt
8282
/yarnpack.txt
83+
/automation/.idea/
84+
/automation/vendor/
85+
/automation/test-honesty/vendor/
86+
.claude/fable5/runtime/control.json
87+
upd.sh

Modules/Core/Database/Seeders/RolesSeeder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ function ($p) use ($customerResources) {
120120
$isBasicAction = str_starts_with($p, 'view-')
121121
|| str_starts_with($p, 'create-')
122122
|| str_starts_with($p, 'edit-')
123+
|| str_starts_with($p, 'delete-')
123124
|| str_starts_with($p, 'export-')
124125
|| str_starts_with($p, 'duplicate-');
125126
$isCustomerResource = (bool) array_filter(

Modules/Core/Tests/AbstractAdminPanelTestCase.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
use Illuminate\Foundation\Testing\RefreshDatabase;
66
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
77
use Illuminate\Support\Carbon;
8+
use Modules\Core\Database\Seeders\PermissionsSeeder;
9+
use Modules\Core\Database\Seeders\RolesSeeder;
10+
use Modules\Core\Enums\UserRole;
811
use Modules\Core\Models\Company;
912
use Modules\Core\Models\User;
1013

@@ -34,6 +37,14 @@ protected function setUp(): void
3437

3538
session(['current_company_id' => $this->company->id]);
3639

40+
/*
41+
* Admin resources gate every page on Spatie permissions (canViewAny
42+
* etc.), so the test user needs the seeded super_admin permission set.
43+
*/
44+
(new PermissionsSeeder())->run();
45+
(new RolesSeeder())->run();
46+
$this->superAdmin->assignRole(UserRole::SUPER_ADMIN->value);
47+
3748
$this->withoutExceptionHandling();
3849
}
3950

0 commit comments

Comments
 (0)