Skip to content

Tech-debt batch 25: INSERT…SELECT into tenant tables; Inertia once() custom keys (#693 #694) - #702

Merged
antosubash merged 1 commit into
mainfrom
tech-debt/b25-db-inertia-edges
Oct 30, 2026
Merged

antosubash merged 1 commit into
mainfrom
tech-debt/b25-db-inertia-edges

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Tech-debt batch 25 (from the 2026-10-28 scan).

Closes #693
Closes #694

What changed

  • INSERT…SELECT into a MultiTenantMixin table (db: INSERT…SELECT into a MultiTenantMixin table raises InvalidRequestError #693). Under a bound tenant this raised InvalidRequestError: This construct already inserts from a SELECT, because the insert guard appended .values(tenant_id=…). insert_guard._guard_from_select now handles the shape:
    • With no tenant_id among the target columns, it adds tenant_id to the column list and the bound tenant as a literal in the projection.
    • With an explicit tenant_id column, the value must be a bound literal equal to the bound tenant, across compound selects too. Cross-tenant copies need all_tenants().
    • Strict mode with no tenant still raises MissingTenantError.
  • Inertia once() with a custom key (inertia: once() props with a custom key are not skipped when the client excludes that key #694). The prop was announced under its key but skipped only by its prop name; exclusion now uses prop.once_key or name.

Verification

  • make lint ✓ · make test-js ✓ · make test-py ✓ (6393 passed, 39 skipped)
  • The new INSERT…SELECT tests and test_db_core_nested_scope.py also pass on Postgres (41 passed).
  • The original reproduction from db: INSERT…SELECT into a MultiTenantMixin table raises InvalidRequestError #693 now stamps the copied rows with the bound tenant.
  • Code review: clean.
  • No browser QA: framework-level change with no UI surface.

https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

…exclusion (#693, #694)

- insert(TenantModel).from_select(...) under a bound tenant raised
  InvalidRequestError: the guard appended .values(tenant_id=...) to an
  INSERT…SELECT. It now adds tenant_id to the column list and the bound
  tenant as a literal in the projection; an explicit tenant column must be
  a bound literal matching the tenant (cross-tenant copies need
  all_tenants()), and strict mode with no tenant still refuses.
- Inertia once() props with a custom key were announced under that key
  but skipped only by prop name; exclusion now uses the once key.

Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-30T07:45:48.195727Z c81dc0a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: c81dc0a
Status: ✅  Deploy successful!
Preview URL: https://f5c708dc.simple-module-python.pages.dev
Branch Preview URL: https://tech-debt-b25-db-inertia-edg.simple-module-python.pages.dev

View logs

@antosubash
antosubash merged commit 66fbd51 into main Oct 30, 2026
17 checks passed
@antosubash
antosubash deleted the tech-debt/b25-db-inertia-edges branch October 30, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant