From e90db581949f2b7c069c166b9e7eab7cde8947ac Mon Sep 17 00:00:00 2001 From: Christian Meyer Date: Thu, 27 Aug 2026 19:20:15 +0200 Subject: [PATCH] Guide tenant repair tests to owning behavior --- src/lai_automation/prompt.py | 9 +++++++-- tests/test_prompt.py | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lai_automation/prompt.py b/src/lai_automation/prompt.py index e117561..d242f75 100644 --- a/src/lai_automation/prompt.py +++ b/src/lai_automation/prompt.py @@ -40,7 +40,9 @@ Tenant routing fact: The customer has already selected one tenant database. SQL inside that database must not invent an additional customer discriminator column. Use only columns present in tracked schema/semantics, and fix SQL-generation guidance rather than rewriting one unknown column -to another guessed column. +to another guessed column. TenantDatabaseService records the explicit source type in +database.connections..tenant_type; use that metadata instead of database-name +patterns or heuristics. """ return f"""You are fixing failure report #{report.id} in the Laravel AI Chat repository. @@ -93,5 +95,8 @@ Correct the existing changes using this test output: {failure} Keep the regression test meaningful. Do not remove or weaken tests, safety checks, -authentication, authorization, SQL validation, or tenant isolation. Do not commit or push. +authentication, authorization, SQL validation, or tenant isolation. If a new test calls an +unrelated specialized code path that correctly returns no result, repair the test to exercise +the owning production behavior; never broaden unrelated production routing merely to make the +test pass. Do not commit or push. """ diff --git a/tests/test_prompt.py b/tests/test_prompt.py index 40f6afd..1e2c0a8 100644 --- a/tests/test_prompt.py +++ b/tests/test_prompt.py @@ -59,6 +59,7 @@ def test_retry_task_contains_failure_without_secrets() -> None: assert "Missing import" in task assert "secret-value" not in task assert "Do not remove or weaken tests" in task + assert "unrelated production routing" in task def test_customer_database_task_explains_tenant_scope() -> None: @@ -82,3 +83,4 @@ def test_customer_database_task_explains_tenant_scope() -> None: assert "already selected one tenant database" in task assert "must not" in task assert "guessed column" in task + assert "tenant_type" in task