← Model losses

Head-to-head comparison

openai / gpt-6.1-sol / xhigh / xhigh effort preferred over openai / gpt-6-luna / low / low effort · clear win.

Primary judge: Sol 6.1, requested Low. Effective provider effort and internal attempts were not verified. A close win is still a scored preference; it does not establish a material defect.

Reviewed public evidence

Task goal

Assess a safe, backward-compatible rollout and rollback for the current [REDACTED: private project name] tenant schema represented by these migrations and SQL tests. Treat the schema as already deployed with existing tenant data while API services and workers may run mixed versions during rollout. Ground every claim in the supplied files and cite the relevant definitions or assertions. Identify concrete ordering, compatibility, lock/backfill, integrity, tenant-isolation, and rollback risks; separate proven behavior from assumptions about application code not included here. Give a phased expand/migrate/verify/contract plan, explicit rollback boundaries after writes, and measurable pre/post-deployment checks using the existing test contracts. Do not invent application APIs, claim tests were run, or edit code.

openai / gpt-6.1-sol / xhigh / xhigh effort answer

## Conclusion

**Do not replay these migrations or treat rollback as “run them backward.”** For an already-populated deployment, the safe approach is to preserve existing data and interfaces, establish an old/new service compatibility matrix, verify effective tenant isolation, and defer privilege or policy contraction until all incompatible consumers are retired.

This is a direct, independent review of the supplied snapshot. **No tests were run and no code was changed.** Confidence is high in the SQL definitions and test-contract discrepancies; deployed behavior remains conditional on live ownership, grants, view definitions, and application code.

### Citation key

- **M02:** `supabase/migrations/00002_create_schema_and_tenant.sql`
- **M03:** `supabase/migrations/00003_create_core_tables.sql`
- **M08:** `supabase/migrations/00008_enable_rls_and_policies.sql`
- **M15:** `supabase/migrations/00015_hardening.sql`
- **IT:** `supabase/test-integration.sql`
- **RT:** `supabase/test-rls.sql`

## 1. Findings and rollout implications

### Ordering and replay safety

- **These are creation scripts, not convergence migrations.** `CREATE TABLE IF NOT EXISTS` does not reconcile an existing table’s columns or constraints. M02 also creates indexes without `IF NOT EXISTS`; M08 creates several named policies without first dropping them. Replaying can therefore fail or leave drift undetected. [M02:12–30,51–53; M03:6–56; M08:71–91]
- **Replaying M08 can overwrite later policy changes.** Its helper drops the standard policies and replaces them with member-only policies, including on the back-office tables. This would remove Directus allowances if those had subsequently been incorporated into the same policies. [M08:32–46,56–62]
- **Historical dependencies matter:** tenant foundations precede core tables; all named relations must exist before M08 applies policies; the five public API views must exist before M15 grants access. Their definitions, and several named tables, are outside this packet. [M02:12–30; M03:8,29–30,46–47; M08:52–66; M15:16–22]
- **Atomicity differs.** M15 explicitly wraps its changes in a transaction. M02, M03, and M08 do not show whole-file transaction boundaries; migration-runner behavior is unknown. M08’s initial `DO` block enables RLS before subsequent policy statements, so an autocommit execution that later fails could leave a partially configured deployment. [M15:1–24; M08:6–18,52–91]

**Recommendation:** compare migration history and actual catalogs with these definitions; issue targeted forward migrations rather than rerunning the historical files.

### Mixed-version compatibility and privileges

- **M15 is an access-contract change, even though it changes no columns.** It revokes `authenticated` access to app tables, sequences, and functions, then grants SELECT on only five public API views. An old service using direct app-table access or an app function can fail once its effective privileges disappear. [M15:4–22]
- **The SQL tests still exercise the older surface:** app tables, app views, and `app.compute_deltas()`. They do not verify the five granted public API views. Consequently, these tests alone cannot certify post-hardening API compatibility. [IT:75–150,315–323; RT:170–175,237–241; M15:16–22]
- **Revoking a grant from `authenticated` does not prove effective denial.** PostgreSQL privileges can still come through `PUBLIC`, inherited roles, or ownership. M15 does not revoke `PUBLIC` function execution, inherited access, or pre-existing write grants on the public views. Its “read-only” comment is therefore an intent, not proof of effective read-only access. [M15:3–22]
- **Default privileges are not universal.** The statements shown affect defaults associated with the executing object-creator role; they do not establish defaults for every possible future creator. Nor does M08 automatically enable RLS on tables created later. [M15:11–13; M08:10–17]
- **Search-path changes can differ across pooled connections.** M02 changes the database default to `app, public, extensions`; it does not establish an identical path for already-connected sessions or role-specific overrides. Mixed-version code using unqualified names needs explicit verification. [M02:8–9]

Preserve the actual existing access contract during expansion. Do not “restore compatibility” with blanket grants; identify and, where authorized, retain only the privileges each old consumer genuinely needs.

### Tenant integrity is weaker than row-level membership isolation

**The schema permits cross-tenant parent/child links.**

- A survey independently references a tenant and an asset UUID; no constraint requires the asset’s tenant to match the survey’s tenant. [M03:27–38]
- An observation independently references a tenant and survey UUID; again, tenant equality is not enforced. [M03:44–56]
- RLS checks the child row’s `tenant_id`, not the referenced parent’s tenant. [M08:38–45]

Thus, a survey owned by tenant B can reference tenant A’s asset while satisfying the shown foreign keys. This does **not** by itself prove parent data is readable, but it creates integrity and isolation risks. Because the references cascade, deleting the tenant-A asset can also delete the tenant-B survey and its observations through referential actions. [M03:30,47]

Additional implications:

- Asset external codes are unique **within** a tenant, not globally. Worker lookup by external code alone would be unsafe, but no worker implementation is supplied. Also, `asset.asset_id` is text while `survey.asset_id` is a UUID reference; migration/backfill logic must preserve that distinction. [M03:7–9,20,30]
- The policy permits members of both tenants to change a row’s tenant from one to the other, subject to other constraints: `USING` checks the old row and `WITH CHECK` checks the new row. It does not enforce an “active tenant” selected by the application. [M08:44–45; M02:42–46]

**Deployment gate:** measure both parent/child mismatch counts and require zero before claiming tenant-consistent integrity. Application validation alone is not proven by this packet.

### Membership roles and provisioning

- The schema labels viewers read-only, but `is_member()` ignores `role`, and the standard modification policy admits every member for all operations. With sufficient SQL privileges, a viewer passes the same policy as an admin. ACLs may still prevent writes, but the RLS layer does not implement the documented role distinction. [M02:27,33,36–47; M08:42–45]
- `tenant_member.user_id` has only a comment suggesting an auth-user reference; no auth-user foreign key is declared. Auth-user deletion cleanup is therefore not established here. [M02:24–30]
- Tenant and membership policies shown are SELECT-only. Ordinary RLS-controlled provisioning writes need some additional authorized path, which is not supplied. [M08:79–91]

Do not combine a viewer-write restriction or provisioning redesign with an otherwise backward-compatible rollout without explicitly testing those behavioral changes.

### Security-definer and audit-policy risks

- Both helpers are `SECURITY DEFINER`, without a fixed function `search_path`. `is_member()` explicitly qualifies its table and auth function, which limits—but does not eliminate—the need to examine its execution environment. [M02:36–47; M08:21–25]
- `apply_member_policies()` interpolates a caller-controlled relation string with `%s` into privileged DDL rather than safely identifying an allowlisted relation. If untrusted roles can execute it, this is a serious privileged-DDL risk. Actual exploitability depends on effective EXECUTE permission and the function owner’s authority; neither is established. M15’s revocation from `authenticated` alone does not settle this because `PUBLIC` grants may remain. [M08:21–46; M15:9]
- Audit SELECT permits either the event’s user **or any tenant member**, despite the “own events” comment. INSERT checks only `user_id = auth.uid()`, not tenant membership. Subject to unseen table constraints and grants, that can permit a user to submit an event against a foreign tenant. [M08:68–77]

Restrict the policy-management helper to migration administration, verify helper ownership and effective execution permissions, and treat any audit-policy tightening as a separate compatibility change.

### Lock, backfill, and retry risks

- M02’s ordinary index creation is not concurrent; on existing tables it can block writes and requires a scan. M08 performs relation-locking RLS and policy DDL across many tables. Long-running transactions can delay that DDL and extend disruption. [M02:51–53; M08:6–18,32–46]
- **No data backfill appears in the supplied migrations.** M15 changes ACLs, not stored tenant data. Do not attribute a table rewrite or backfill to that file. [M15:1–24]
- `updated_at` has an insertion default, but no automatic update mechanism is shown. It is not a proven watermark for backfill catch-up or rollback journaling. [M02:16–17; M03:18–19,36–37]
- Survey and observation fixtures are not demonstrably retry-idempotent. Their fresh UUID defaults have no shown business-key uniqueness constraint, so `ON CONFLICT DO NOTHING` can insert another row on each execution. Multiple surveys on the same date may also be legitimate; deduplication rules cannot be inferred. [M03:27–56; RT:82–102]

## 2. Phased expand / migrate / verify / contract plan

### Phase 0 — Establish the deployed baseline

Before changing anything:

1. Record actual relation definitions, validated constraints, indexes, policies, function owners/ACLs, view definitions, RLS flags, default privileges, and role membership.
2. Build a compatibility matrix for **old and new API services, workers, and Directus**, using their real database identities and actual read/write operations. The tests show expected ingestion and Directus workflows, but not implementation compatibility. [IT:80–150,162–287]
3. Record per-tenant row counts and both cross-tenant relationship mismatch counts; identify dangling membership users.
4. Establish a recoverable backup/PITR checkpoint and rehearse restoration plus reconciliation of subsequent accepted writes.
5. Use an isolated restored environment for mutation-heavy tests. The supplied integration script alters tenant data; its optional cleanup deletes all AMP sections and LOS targets for the selected tenant. That is unsafe as production cleanup with existing data. [IT:165–171,183–187,205–210,226–238,426–433]

### Phase 1 — Expand without breaking current consumers

- Preserve core column types, UUIDs, tenant-scoped asset codes, current view names, and verified output shapes. [M03:6–56; M15:16–22]
- Do not remove an access path until the compatibility matrix shows no remaining dependent old consumer. If M15 is already effective, preserve that boundary and adapt consumers to the supported surface rather than assuming app-table access remains available.
- Make policy replacements atomic and narrowly scoped. Do not replay M08’s blanket policy helper over already-evolved back-office policies. [M08:32–46,52–66]
- Remove unintended access to privileged management helpers while preserving verified read-helper dependencies. Confirm that the chosen public-view design works with the intended base-table privilege restrictions.

**Important:** blindly making views `security_invoker` is not a complete remedy. Invoker views ordinarily need caller access to their underlying relations, potentially conflicting with M15’s revoked app-table privileges. The actual view definitions must determine the solution.

### Phase 2 — Migrate data and enforce tenant consistency

There is no required historical backfill in these files. If audits find mismatches:

- Identify the authoritative tenant and relationship for each affected record. Do not automatically rewrite child tenants or delete parents.
- Pause or fence affected writers through existing operational controls while repairing those records; no such control mechanism is shown here.
- Repair in bounded, resumable batches keyed by stable UUIDs. Retain before/after values and ownership decisions for rollback.
- To enforce equality, an additive option is composite foreign keys:
  - survey `(tenant_id, asset_id)` → asset `(tenant_id, id)`;
  - observation `(tenant_id, survey_id)` → survey `(tenant_id, id)`.
  
  These require suitable parent uniqueness and must retain intentionally chosen deletion semantics. The need follows directly from the independent references in M03. [M03:8,20,29–30,46–47]
- Where appropriate, build supporting indexes concurrently outside a transaction, check for failed/invalid indexes, then add and validate constraints.

**`NOT VALID` is not a mixed-version bypass:** a newly added foreign key still checks new writes. All active writers must already comply, or the rollout must deliberately accept rejection of noncompliant writes. Validation also scans data and consumes resources; stage and measure it.

### Phase 3 — Verify under real identities and mixed versions

Use the checks below before and after the candidate change, first in the restored environment and then with controlled production checks.

Do not run the unscoped `app.compute_deltas()` call on production merely because it is in the test plan: its implementation and affected tenants are unknown. [IT:139–150]

### Phase 4 — Contract only after the compatibility window

Contract only when:

- No incompatible old API instance or worker remains.
- In-flight and retryable work from old versions has been drained or demonstrated compatible; queue behavior is not supplied.
- Required constraints are validated.
- Public-view isolation, Directus restrictions, and mixed-version workflows pass.
- The rollback retention window and write-reconciliation procedure are approved.

Only then remove obsolete grants/interfaces or tighten role semantics. For ACL contraction, use an exact approved grant manifest, not the assumption that M15 proves all unintended access has disappeared.

## 3. Measurable pre/post-deployment checks

| Check | Required measurement and interpretation | Existing contract |
|---|---|---|
| RLS coverage | Every intended tenant base table has RLS enabled; record owners and `FORCE RLS` status separately. Enabled RLS alone does not prove owner/superuser filtering. | M08:6–18; RT:116–131 |
| Membership isolation | A has pilot membership; B has none. Under real non-bypass identities, A sees authorized pilot records and B sees none. After adding B to the second tenant, each sees only tenants they belong to. | IT:40–64; RT:162–185,191–231 |
| Parent/child integrity | Count surveys where `survey.tenant_id <> asset.tenant_id`, and observations where `observation.tenant_id <> survey.tenant_id`; both must be **0**. Attempted mismatched writes must be rejected once enforcement is installed. | M03:27–56 |
| Effective hardening | For `authenticated`, inherited roles, and `PUBLIC`, inspect schema/table/view/function privileges. Verify intended app-base denial and SELECT-only public-view access, including absence of effective DML grants. | M15:4–22 |
| Public API isolation | Test all five `public.api_*` views with member and outsider identities; compare returned identifiers or aggregates against authorized fixture data. The supplied app-view tests do not cover this surface. | M15:16–22; IT:315–337 |
| Privileged helper exposure | Untrusted roles cannot execute the policy-management helper; owners and search paths are approved. Required read-helper access still works. | M08:21–46; M02:36–47 |
| Ingestion fixture | In the defined golden-data environment: ≥3 assets; ≥2 queued/parsed manifests; ≥2 parse jobs; ≥6 surveys spanning ≥3 assets; ≥15 observations; ≥3 deltas, ≥1 deteriorating, ≥1 severe. Also compare exact fixture identifiers and expected increments so thresholds do not hide duplicate ingestion. | IT:75–150 |
| Directus capabilities | Unit-cost insert/update succeeds and yields `70.00`; LOS, AMP, and unmatched-resolution fixtures meet their expected results. Core access is denied or filtered according to the intended privilege contract. | IT:162–287,363–375 |
| Directus authority | `rolsuper=false`, `rolbypassrls=false`, `rolcanlogin=true`; verify complete policy `USING` **and** `WITH CHECK` semantics, not merely substring presence. | IT:349–390 |
| Operational impact | Set numeric abort thresholds before deployment for lock wait, request permission errors, worker failures, and queue age; monitor against baseline. These are operational additions, not assertions already supplied by the tests. | DDL risk: M02:51–53; M08:6–18; workflow evidence: IT:95–123 |

### Existing test limitations that must be corrected

1. **`SET ROLE postgres` is not a reliable user-RLS test.** Setting a JWT subject does not remove superuser, owner, or bypass privileges. No `FORCE ROW LEVEL SECURITY` is shown. Verify actual role properties and test through genuine non-bypass identities. [IT:54–60,312–337; M08:16; RT:113–114,175–176]
2. **The JWT `SET` statements contain subqueries**, which are not valid PostgreSQL `SET` value syntax. Resolve the UUID first and set it through a supported session-setting mechanism in an isolated test transaction; verify that `auth.uid()` resolves as intended. [IT:56,313,332; M02:45]
3. **Several “simulation” queries never change identity.** Their successful counts establish data existence, not tenant isolation. RT itself acknowledges this distinction and requires actual user testing. [RT:137–176,218–231,276–285]
4. **Permission denial and zero rows are different outcomes.** Post-hardening direct app access can appropriately fail with an ACL error rather than return zero. Neither outcome substitutes for verifying that the supported public views correctly filter outsiders. [M15:7–22; IT:371; RT:173]
5. **“Views inherit RLS” is unproven.** View ownership and security configuration are absent. Owner-executed views can bypass underlying RLS depending on ownership and role properties. [IT:308–341; RT:237–241]
6. **Positive counts require suitable fixtures.** A legitimate empty report is not automatically a security or rollout failure, and minimum counts alone do not prove correct tenant attribution or prevent duplicates. [IT:132–150,325]

## 4. Explicit rollback boundaries after writes

| Boundary | Safe rollback position |
|---|---|
| Candidate transaction fails before commit | Its transactional changes roll back. This is explicit for M15; do not assume whole-file atomicity for the earlier migrations. [M15:1–24] |
| Additive deployment, before incompatible writes | Roll back code while retaining additive schema, provided old versions still accept the data and constraints. Removing expansion objects is usually unnecessary. |
| ACL/policy cutover, with otherwise unchanged compatible data | Restore the **captured** approved ACLs/default privileges or policy definitions if authorized. This reverses access changes, not writes or external effects. Restoring an insecure policy is not a safe default. [M08:32–46; M15:4–22] |
| New tenant-equality enforcement | Old code may now fail if it creates mismatches. Prefer fixing or fencing that writer over dropping the isolation constraint. Removing enforcement would deliberately reopen the proven integrity gap. [M03:29–30,46–47] |
| Data repaired, retagged, or new semantics written | A code rollback alone is insufficient. Use the repair journal and reconcile later writes before reversing values; do not overwrite subsequent legitimate changes. |
| Cascading deletion committed | Regranting privileges or restoring policies cannot recreate deleted rows. Restore/reconstruct from retained data, respecting dependency order and subsequent writes. [M02:25; M03:8,29–30,46–47] |
| Destructive contract or whole-database restore | Old-code rollback may require restoring removed interfaces/data. PITR without replay loses valid post-checkpoint writes; replay idempotence is not proven. External S3 uploads are outside the database transaction. [RT:82–102; IT:80–84,289–302] |

No down migrations, repair journal, or tested post-write replay procedure is supplied. Consequently, **automatic rollback after semantic writes or cascading deletes is not established**.

## 5. Uncertainties, alternatives, and next action

### Important uncertainties

Definitions outside this packet determine:

- Public and app view security, output compatibility, and actual filtering.
- Directus policy extensions and `app.is_directus()` behavior.
- Worker/service roles, tenant validation, retry/idempotency, and queue compatibility.
- `auth.uid()` configuration and `compute_deltas()` scope.
- Live grants, ownership, triggers, migration-runner transactions, and recoverability.

These are uncertainties—not proof that the deployment is broken or that another file is missing.

### Alternatives and likely false positives

- Later policy changes could explain the Directus contract; do not assume member-only M08 policies are still the deployed versions.
- Other grants could explain successful app access after M15, but that success would not prove hardening.
- Public views might safely implement explicit tenant filtering; conversely, a privileged view-owner test might appear successful while bypassing isolation.
- Repeated survey records are not necessarily invalid; the schema declares no business uniqueness suitable for automatic deduplication.

**Next useful action:** produce a read-only live-state and old/new compatibility report, then rehearse the corrected identity tests and rollback-with-write-reconciliation on a restored populated database. Proceed only when that evidence resolves the privilege, view-isolation, Directus-policy, and tenant-equality gates.

MATERIAL_EVIDENCE_CONFLICT: M08:38–45,56–60 defines member-only policies for back-office tables, while IT:377–390 requires those policies to include app.is_directus(); an additional policy change would be needed to reconcile the supplied definitions with that assertion.

openai / gpt-6-luna / low / low effort answer

## Conclusion

The packet describes a tenant-scoped schema, but it does **not** establish that a mixed-version rollout or rollback is safe. Treat the migrations as already deployed and preserve existing data: use additive changes first, keep old and new service/worker versions compatible during transition, and delay destructive contract changes until no old version can read or write the affected schema. The supplied files do not include a specific proposed schema change, application queries, or worker behavior, so exact compatibility and backfill requirements remain uncertain.

## Evidence and risks

- **Tenant identity is not enforced across relationships.** `app.survey` stores both `tenant_id` and `asset_id`, but its foreign key checks only `asset_id` (`00003`, lines 27–30). Likewise, `app.observation` stores `tenant_id` and `survey_id`, but its foreign key checks only `survey_id` (lines 43–48). The RLS helper checks membership for the row’s `tenant_id` (`00002`, lines 35–47), and standard policies apply that check to each row (`00008`, lines 36–46). Thus the packet does not prove that a survey’s tenant matches its asset’s tenant, or an observation’s tenant matches its survey’s tenant. Do not assume RLS closes this integrity gap.
- **Policy coverage and expectations are not fully aligned.** The RLS migration applies policies to a fixed list of tables (including `asset`, `survey`, and `observation`; `00008`, lines 51–66), while its initial RLS-enabling loop covers all base tables present at migration time (lines 5–18). A newly added table would not automatically receive a policy from that fixed list. Also, the integration test expects back-office policies to include `app.is_directus()` (`test-integration.sql`, lines 377–390), whereas the supplied policy helper uses `app.is_member(tenant_id)` (`00008`, lines 20–46). The packet does not show a later migration reconciling these definitions.
- **Privileges differ by role and test contract.** Hardening revokes authenticated access to app tables/functions and grants read-only access to named `public.api_*` views (`00015`, lines 3–22). Separately, integration tests expect Directus to insert/update back-office tables (`test-integration.sql`, lines 160–199, 201–248) and not access core tables (`lines 361–375`). The relevant Directus grants, policies, and view definitions are not supplied, so these expected behaviors are not proven by this snapshot.
- **Potential lock and backfill exposure depends on the change.** The supplied migrations create tables, indexes, policies, and alter database settings, but do not specify a new rollout’s DDL or data volume. No lock duration, online index strategy, batching, or backfill behavior can be established. Measure these on production-scale data before scheduling any constraint validation, index build, or table rewrite.
- **Test scripts are partly plans, not reliable proof of isolation.** `test-rls.sql` explicitly says SQL Editor/service-role testing cannot truly impersonate users (`lines 108–115`, `170–176`); its cross-tenant section describes expected results but queries both tenants as service role (`lines 218–230`). The integration smoke test sets `role postgres` before setting a JWT subject (`test-integration.sql`, lines 54–64), and the packet does not prove that this role is subject to RLS. Treat those SQL assertions as contracts/checklists, not demonstrated test results. The integration script also expects all listed views to return rows for a member (`lines 310–325`), which may depend on seeded data.
- **Rollback is not necessarily data-safe after writes.** Additive schema changes can generally be left in place while application versions are rolled back, but a reverse migration that drops columns, constraints, or tables could lose data written by the new version. No migration rollback scripts, write semantics, or application-version compatibility guarantees are included. After new-version writes begin, rollback should mean reverting application traffic while retaining the expanded schema and data until compatibility and recovery are verified—not blindly reversing DDL.

## Phased rollout and rollback boundaries

1. **Baseline and prepare:** Record current schema, row counts, tenant membership counts, and existing policy/privilege state. Run the supplied RLS and integration checks using real member and outsider JWTs, not only privileged SQL sessions. Confirm the Directus and API access paths separately.
2. **Expand:** Apply only additive, backward-compatible schema changes. Keep existing columns and constraints available to old versions; avoid renames, drops, or changed meanings. Prefer nullable/default-safe additions and online/batched index or constraint work where appropriate, after checking the actual PostgreSQL operation and version. The packet does not establish which technique is safe for a particular DDL statement.
3. **Mixed-version migration:** Deploy compatible readers/writers, then backfill in bounded, restartable batches. If both old and new versions may write, use a verified dual-write or equivalent compatibility strategy; its availability is an application-code dependency not present here. Track progress, failures, and per-tenant completeness.
4. **Verify:** Check constraints and tenant-parent consistency, compare source and destination counts, inspect failed batches, and exercise member, outsider, cross-tenant, Directus, and view paths. Do not proceed on a test that only runs as `postgres` or service role.
5. **Contract:** Only after old API services and workers are drained, backfill is complete, and new-version reads/writes have been verified, remove obsolete schema in a separate deployment. Keep an agreed observation window before destructive cleanup.
6. **Rollback boundaries:** Before new-version writes, application rollback with the additive schema retained is the conservative option. After new-version writes, do not drop new fields or constraints until data written there has been reconciled or safely copied back. After contract DDL or irreversible transformations, assume rollback requires a forward repair or restore from backup; no reversible path is demonstrated by the packet.

## Measurable checks

Use the existing test contracts as gates, with real authenticated sessions:

- **Before and after each phase:** RLS enabled for `asset`, `survey`, and `observation`; expected `r_<table>_select` and `r_<table>_mod` policies present (`test-rls.sql`, lines 116–131).
- **Isolation:** Member sees its tenant’s rows; outsider sees zero; a user belonging only to another tenant sees only that tenant’s rows. Verify through authenticated app/JWT access, as the scripts themselves require (`test-rls.sql`, lines 156–230, 273–285; `test-integration.sql`, lines 31–64, 329–341).
- **Integrity:** Count rows where `survey.tenant_id` differs from its asset’s tenant, and where `observation.tenant_id` differs from its survey’s tenant; require zero before enforcing any corresponding constraint. These checks follow the independent tenant and foreign-key fields in `00003`, lines 27–30 and 43–48.
- **Functional regression:** Preserve the integration script’s stated E2E thresholds—3+ assets, 2+ manifests/jobs, 6+ surveys, 15+ observations, and 3+ deltas with deteriorating/severe examples (`test-integration.sql`, lines 73–150)—when the test dataset is applicable.
- **Privileges:** Verify Directus is not superuser or `BYPASSRLS`, remains able to perform its intended back-office operations, and remains blocked from core data (`test-integration.sql`, lines 347–390). Separately verify authenticated users retain only the intended public API view access after hardening (`00015`, lines 15–22).
- **Backfill/operations:** Record total eligible rows, completed rows, failed rows, mismatch counts, runtime, lock waits, and replica/queue lag before and after each batch. The packet provides no numeric operational thresholds; set them from production baselines before rollout rather than inventing them.

**Missing dependencies:** Application and worker SQL/code, proposed schema diff, database version and table sizes, Directus grants/policies, view definitions, migration transaction behavior, and backup/restore objectives. These determine exact mixed-version compatibility, DDL lock risk, backfill design, and rollback feasibility. **Next useful action:** review the concrete proposed migration and application read/write paths against these gates before authorizing deployment.

Primary judge's stated reason

B offers materially more complete deployment assurance: an operator can distinguish historical replay hazards from targeted forward changes, plan around identifiable locking operations, and avoid treating restored privileges as recovery from committed cascading deletes. This is a clear preference based on concrete required coverage, not length or optional refinements. Actual deployed behavior and the safety of an unspecified candidate migration remain uncertain.

This reason is the judge's assessment. No independent factual-defect finding is asserted by this record.

Battle wave: e1d38d25-feb4-4436-82c7-b4ad3c059a64. Pair: brp1_beb58535c9d9911a89e081a6f479a524e12bb45bbc61f9826b2cfbc48c83e8b3. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.