Skip to content

Fix reverse links for existing nested documents - #972

Open
HarshMN2345 wants to merge 3 commits into
mainfrom
codex/fix-existing-nested-relationships
Open

HarshMN2345 wants to merge 3 commits into
mainfrom
codex/fix-existing-nested-relationships

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Sep 14, 2026

Copy link
Copy Markdown
Member

Creating a parent with an existing child supplied as a nested Document could drop the reverse relationship, even though supplying the same child ID as a string worked. Preserve only the reverse link generated by the enclosing create while continuing to process the child’s scalar fields and other nested relationships. Keep that link in permission change detection at the relationship depth limit and clear its temporary context when the write finishes or fails.

Regression coverage checks five relationship configurations, returned and persisted links and nested changes, denied reads/updates, one-to-one duplicate rollback, permission enforcement at maximum depth, and recovery after a rejected write. All nine targeted runs pass across SQLite normal, shared-table, and Mirror modes (177 assertions); the three regressions fail against unchanged upstream. Syntax, Pint, and diff checks pass. Targeted PHPStan reports the same seven existing diagnostics as upstream, with no new diagnostics. GitHub CI passes on this head: all 16 adapter suites, unit tests, Pint, and CodeQL. The PostgreSQL, MongoDB, shared-table MariaDB, SQLite, and Mirror logs confirm the new regression methods executed.

Appwrite must adopt a released package version to receive this change.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 93679977-b746-4f96-ad8a-b68d3d90c496

📥 Commits

Reviewing files that changed from the base of the PR and between 64f5257 and 49a599d.

📒 Files selected for processing (2)
  • src/Database/Database.php
  • tests/e2e/Adapter/Scopes/RelationshipTests.php

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@HarshMN2345
HarshMN2345 marked this pull request as ready for review September 14, 2026 13:01
@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable correctness, security, or repository-rule violations remain.

Summary

  • Tracks the enclosing write’s temporary reverse link through the nested child update.
  • Keeps that link in update-permission change detection at the relationship depth boundary.
  • Clears temporary context after both successful and failed writes.
  • Adds behavioral coverage for relationship variants, authorization failures, rollback, depth handling, persistence, and recovery.

Reviews (1) · Last reviewed commit: "Verify nested links in mirrored create r..."

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant