Guide tenant repair tests to owning behavior

This commit is contained in:
2026-08-27 19:20:15 +02:00
parent d9fe2747a1
commit e90db58194
2 changed files with 9 additions and 2 deletions

View File

@@ -40,7 +40,9 @@ Tenant routing fact:
The customer has already selected one tenant database. SQL inside that database must not 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 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 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.<connection>.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. 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} {failure}
Keep the regression test meaningful. Do not remove or weaken tests, safety checks, 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.
""" """

View File

@@ -59,6 +59,7 @@ def test_retry_task_contains_failure_without_secrets() -> None:
assert "Missing import" in task assert "Missing import" in task
assert "secret-value" not in task assert "secret-value" not in task
assert "Do not remove or weaken tests" 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: 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 "already selected one tenant database" in task
assert "must not" in task assert "must not" in task
assert "guessed column" in task assert "guessed column" in task
assert "tenant_type" in task