Skip to content

Cover morph relation record reads in integration tests - #32476

Open
BOHEUS wants to merge 1 commit into
twentyhq:mainfrom
BOHEUS:test-morph-core-api-1321
Open

BOHEUS wants to merge 1 commit into
twentyhq:mainfrom
BOHEUS:test-morph-core-api-1321

Conversation

@BOHEUS

@BOHEUS BOHEUS commented Dec 5, 2026 •

Copy link
Copy Markdown
Collaborator

Closes twentyhq/core-team-issues#1321

The findMany morph relation records integration test was skipped and never created records. This replaces it with populated cases for both relation directions, using objects created by the test itself so no seeder change is needed.

  • MANY_TO_ONE (owner on opportunity): each opportunity resolves the right owner<Target>Id and nested target for both legs, the other leg is null, an unowned record is null on both, and each person/company lists its own opportunities through the inverse relation.
  • ONE_TO_MANY (stakeholder on opportunity): each opportunity's per-target connections return exactly its linked people and companies, and each person resolves back to its opportunity.

Ran locally: npx jest --config ./jest-integration.config.ts test/integration/metadata/suites/field-metadata/morph-relation/find-many-morph-relation-records.integration-spec.ts (4 passed).

View guided diff

Replace the skipped findMany morph relation test with populated MANY_TO_ONE and
ONE_TO_MANY cases, asserting both morph legs and their inverse relations.
Copilot AI balanced review requested due to automatic review settings December 5, 2026 13:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@twenty-ci-bot-public

Copy link
Copy Markdown

🚀 Preview Environment Ready!

Your preview environment is available at: https://configured-add-minolta-usual.trycloudflare.com

This environment will automatically shut down after 5 hours.

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

TODOs/FIXMEs:

  • // todo @guillim : make ths test work to cover morph CORE api: packages/twenty-server/test/integration/metadata/suites/field-metadata/morph-relation/find-many-morph-relation-records.integration-spec.ts
  • // todo : fill with records: packages/twenty-server/test/integration/metadata/suites/field-metadata/morph-relation/find-many-morph-relation-records.integration-spec.ts

Generated by 🚫 dangerJS against 5cb6d8c

@greptile-apps

greptile-apps Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Low impact] This test-only PR appears safe to merge.

Summary

Replaces the skipped morph-relation read suite with four populated integration tests.

  • Many-to-one morph reads now cover both target types and their reverse links.
  • One-to-many morph reads now check person and company connections.

Reviews (1) · Last reviewed commit: "Cover morph relation record reads in int..." · Reviewed by Greptile

@twenty-ci-bot-public

Copy link
Copy Markdown

🤖 PR Review

Check Result
🔍 Build safety ⏭️ skipped — external-only
🧭 Triage ⏭️ skipped — external-only
📐 Quality ✅ passed — 1 nit(s)
🛡️ Security ✅ passed
🚦 Auto-approve ✅ passed — complexity low
🔐 Permissions ⏭️ skipped: no endpoint permission change

🛡️ Security Review

✅ No high-severity vulnerabilities detected.


🚦 Auto-approve

✅ Eligible for auto-approval — low-complexity, no high-blast-radius paths.

  • 🧠 Complexity: low
  • 📏 Size: +355 / -139 lines across 1 file(s)

View details

Automated pre-review — human approval still required.

@twenty-ci-bot-public

Copy link
Copy Markdown

🟡 Quality review · 1 finding

Safe to merge — no high-level findings

High-level — Test-only PR that re-enables the skipped morph-relation findMany integration suite with real records for MANY_TO_ONE and ONE_TO_MANY, reuses the existing createManyOperation/findManyOperationFactory/createMorphRelationBetweenObjects test utils, and has no product, architecture, build or deploy impact.
Low-level — 1 rule violation found — 250 rule questions over 5 piece(s) of 1 file(s)

💬 1 inline comment on the diff.


Reviewed against the pr-review standard — high-level then low-level. Advisory; human review still required. Run details.

afterAll(async () => {
await deleteOneFieldMetadata({
input: { idToDelete: morphFieldId },
}).catch(() => {});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Nit · Low-level · No silent failures or permissive fallbacks

The afterAll cleanup swallows every error from deleteOneFieldMetadata with .catch(() => {}), so a failed field deletion is silently ignored and can leave state behind without any signal.

Also on line 343.

@CoreTeamTwenty CoreTeamTwenty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Auto-approved — cleared automated quality and security review and is low-complexity.

  • Quality: passed — 1 nit(s)
  • Security: passed
  • Auto-approve: passed — complexity low

Automated approval — a human still merges, and this is re-evaluated on every push.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[morph] Add integration test for core API

3 participants