-
Notifications
You must be signed in to change notification settings - Fork 25
chore(release): v0.17.2 #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
e58d19e
fix(sync): serve /api/collections via web session so admin lists load…
jakub-przepiora 0f80a55
chore(release): v0.17.2 — #193 live-sync auth fix + planner sample data
jakub-przepiora 290ba32
fix(ci): unbreak Windows desktop + Android apk release builds
jakub-przepiora File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
backend/tests/Feature/Sync/CollectionSnapshotSessionAuthTest.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <?php | ||
|
|
||
| namespace Tests\Feature\Sync; | ||
|
|
||
| use App\Models\User; | ||
| use Illuminate\Foundation\Testing\RefreshDatabase; | ||
| use Tests\TestCase; | ||
|
|
||
| /** | ||
| * The live-sync snapshot GET /api/collections/{name} feeds every admin list | ||
| * (ResourceTable). It must authenticate via the plain web session — the same | ||
| * cookie every Inertia page uses — so it works on any host / behind any reverse | ||
| * proxy, without depending on Sanctum stateful-domain matching. Regression guard | ||
| * for #193 ("data saved but lists show nothing"): the snapshot 401'd on hosts | ||
| * APP_URL didn't cover, and the frontend swallowed the error into an empty list. | ||
| */ | ||
| class CollectionSnapshotSessionAuthTest extends TestCase | ||
| { | ||
| use RefreshDatabase; | ||
|
|
||
| public function test_authenticated_session_gets_the_snapshot(): void | ||
| { | ||
| $user = User::factory()->create(); | ||
|
|
||
| // No Origin / Referer / stateful-domain set — pure session auth, as it | ||
| // would be for any host the deployment is actually served on. | ||
| $this->actingAs($user) | ||
| ->getJson('/api/collections/issue_types') | ||
| ->assertOk() | ||
| ->assertJsonStructure(['rows', 'channel', 'at']); | ||
| } | ||
|
|
||
| public function test_guest_is_rejected(): void | ||
| { | ||
| $this->getJson('/api/collections/issue_types')->assertUnauthorized(); | ||
| } | ||
|
|
||
| public function test_unknown_collection_is_not_found(): void | ||
| { | ||
| $user = User::factory()->create(); | ||
|
|
||
| $this->actingAs($user) | ||
| ->getJson('/api/collections/definitely-not-a-shape') | ||
| ->assertNotFound(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Assert tenant isolation, not only response shape.
This test would pass even if the snapshot returned another tenant’s rows or channel. Add a tenant-scoped fixture with two tenants and assert that the authenticated user receives only its tenant’s data, matching
CollectionController::index.As per coding guidelines, new endpoint tests must cover domain edge cases.
🧰 Tools
🪛 PHPStan (2.2.5)
[error] 23-23: Call to an undefined static method App\Models\User::factory().
(staticMethod.notFound)
🤖 Prompt for AI Agents
Source: Coding guidelines