This commit is contained in:
@@ -18,6 +18,33 @@ _SECRET_PATTERNS = (
|
||||
(re.compile(r"\b[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b"), "[JWT]"),
|
||||
)
|
||||
|
||||
_REPOSITORY_PLAYBOOK = """
|
||||
Repository ownership map:
|
||||
- app/Services/SQLGeneratorService.php assembles live schema and business context for SQL generation.
|
||||
- config/erp_semantics.php owns ERP joins, metrics, formulas, filters, and reference examples.
|
||||
- config/cockpit_semantics.php owns device and customer-database semantics.
|
||||
- app/Services/AIService.php owns provider calls, pseudonymization boundaries, and response parsing.
|
||||
- app/Services/TenantDatabaseService.php owns ERP/config/customer source selection and tenant metadata.
|
||||
- app/Services/SQLValidatorService.php owns read-only SQL safety; do not weaken it to accept a fix.
|
||||
- app/Http/Controllers/ChatController.php orchestrates routing, execution, answers, and diagnostics.
|
||||
- app/Services/FailureTrackingService.php and FailureAutomationService.php own failure handoff.
|
||||
- tests/Unit is preferred for deterministic service/context rules; tests/Feature is for HTTP,
|
||||
persistence, authorization, or real isolated-database behavior.
|
||||
|
||||
Repair workflow:
|
||||
1. Inspect the owning implementation, its configuration, and the nearest existing test first.
|
||||
2. State one root-cause hypothesis and make the smallest change that can prove it.
|
||||
3. Put reusable business knowledge in tracked semantics configuration, not question-specific code.
|
||||
4. A prompt/context fix must test the real generated context. A deterministic SQL builder must test
|
||||
its exact SQL and execute it against synthetic fixtures when useful.
|
||||
5. Tests must contain assertions that execute; reject empty loops and broad unrelated fallbacks.
|
||||
6. Do not expose protected production methods publicly for tests. Use a test-only subclass.
|
||||
7. Do not duplicate one rule in service code and semantics config, or add explanatory comments for
|
||||
self-evident test setup.
|
||||
8. Inspect the final diff for malformed edits, unrelated files, hardcoded report values, and tests
|
||||
that pass without exercising the changed behavior.
|
||||
"""
|
||||
|
||||
|
||||
def redact(value: str | None) -> str:
|
||||
result = value or ""
|
||||
@@ -62,6 +89,8 @@ itself deterministically builds and executes the SQL under test.
|
||||
|
||||
return f"""You are fixing failure report #{report.id} in the Laravel AI Chat repository.
|
||||
|
||||
{_REPOSITORY_PLAYBOOK}
|
||||
|
||||
Rules:
|
||||
- First add a regression test that reproduces the reported behavior.
|
||||
- The regression test must execute the relevant production behavior; never mock or stub the behavior being tested.
|
||||
|
||||
Reference in New Issue
Block a user