ash_postgres/priv/resource_snapshots/test_repo/users/20230129050950.json

97 lines
2.3 KiB
JSON
Raw Normal View History

Add failing test for policy + aggregate issue The conditions for this issue to occur seem to be: - DataLayer is Postgres - Resource has a relates_to_actor_via policy on read - The relates_to_actor_via path includes a has_many relationship - An aggregate is loaded The following error is produced: 1) test relates to actor via has_many and with an aggregate (AshPostgres.AggregateTest) test/aggregate_test.exs:8 ** (Ash.Error.Unknown.UnknownError) ** (ArgumentError) No such entity nil found. code: |> Api.read_one!(actor: user) stacktrace: nil.spark_dsl_config() (spark 0.3.8) lib/spark/dsl/extension.ex:129: Spark.Dsl.Extension.dsl!/1 (spark 0.3.8) lib/spark/dsl/extension.ex:158: Spark.Dsl.Extension.get_persisted/3 (ash 2.5.10) lib/ash/filter/filter.ex:2986: Ash.Filter.do_hydrate_refs/2 (ash 2.5.10) lib/ash/policy/check/relates_to_actor_via.ex:3: Ash.Policy.Check.RelatesToActorVia.try_eval/2 (ash 2.5.10) lib/ash/policy/check/relates_to_actor_via.ex:3: Ash.Policy.Check.RelatesToActorVia.try_strict_check/3 (ash 2.5.10) lib/ash/policy/checker.ex:63: Ash.Policy.Checker.do_strict_check_facts/3 (ash 2.5.10) lib/ash/policy/checker.ex:88: anonymous fn/2 in Ash.Policy.Checker.strict_check_policies/3 (elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3 (elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3 (ash 2.5.10) lib/ash/policy/checker.ex:9: anonymous fn/2 in Ash.Policy.Checker.strict_check_facts/1 (elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3 (elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3 (ash 2.5.10) lib/ash/policy/authorizer.ex:790: Ash.Policy.Authorizer.do_strict_check_facts/1 (ash 2.5.10) lib/ash/policy/authorizer.ex:372: Ash.Policy.Authorizer.strict_check/2 (ash 2.5.10) lib/ash/engine/request.ex:550: Ash.Engine.Request.do_strict_check/3 (ash 2.5.10) lib/ash/engine/request.ex:518: anonymous fn/2 in Ash.Engine.Request.strict_check/2 (elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3 (elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3 (ash 2.5.10) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1 (ash 2.5.10) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1 (ash 2.5.10) lib/ash/engine/engine.ex:650: Ash.Engine.advance_request/2 (ash 2.5.10) lib/ash/engine/engine.ex:556: Ash.Engine.fully_advance_request/2 (ash 2.5.10) lib/ash/engine/engine.ex:497: Ash.Engine.do_run_iteration/2 (elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3 (ash 2.5.10) lib/ash/engine/engine.ex:440: Ash.Engine.run_iteration/1 (ash 2.5.10) lib/ash/engine/engine.ex:257: Ash.Engine.run_to_completion/1 (ash 2.5.10) lib/ash/engine/engine.ex:202: Ash.Engine.do_run/2 (ash 2.5.10) lib/ash/engine/engine.ex:141: Ash.Engine.run/2 (ash 2.5.10) lib/ash/actions/read.ex:170: Ash.Actions.Read.do_run/3 (ash 2.5.10) lib/ash/actions/read.ex:90: Ash.Actions.Read.run/3 (ash 2.5.10) lib/ash/api/api.ex:1005: Ash.Api.read_one/3 (ash 2.5.10) lib/ash/api/api.ex:998: Ash.Api.read_one!/3 test/aggregate_test.exs:44: (test)
2023-01-29 19:05:34 +13:00
{
"attributes": [
{
"allow_nil?": false,
"default": "fragment(\"uuid_generate_v4()\")",
"generated?": false,
"primary_key?": true,
"references": null,
"size": null,
"source": "id",
"type": "uuid"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "is_active",
"type": "boolean"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": {
"destination_attribute": "id",
"destination_attribute_default": null,
"destination_attribute_generated": null,
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"name": "users_organization_id_fkey",
"on_delete": null,
"on_update": null,
"schema": "public",
"table": "orgs"
},
"size": null,
"source": "organization_id",
"type": "uuid"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "name",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": {
"destination_attribute": "id",
"destination_attribute_default": null,
"destination_attribute_generated": null,
"multitenancy": {
"attribute": "id",
"global": true,
"strategy": "attribute"
},
"name": "users_org_id_fkey",
"on_delete": null,
"on_update": null,
"schema": "public",
"table": "multitenant_orgs"
},
"size": null,
"source": "org_id",
"type": "uuid"
}
],
"base_filter": null,
"check_constraints": [],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true,
"hash": "D8E17F78D925AF35AC9D21FF6D606B82AB249A4E0A2BD6B6B83DD486A0F2264D",
"identities": [],
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"repo": "Elixir.AshPostgres.TestRepo",
"schema": null,
"table": "users"
}