You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
store import should import tests as assertions #398
I took a look at this and I don't think it reproduces on current main any more — it looks like it was fixed by #446 and the issue was just never closed.
#446 ("support importing assertions as part of a store") landed on 2025-02-07 and added importAssertions in cmd/store/import.go, which converts each test's check entries into client.ClientAssertion values and calls WriteAssertions. This issue was filed 2024-09-25 and @Corgam's comment is from 2025-01-10, so both predate that change. #446's description says it closes #224, which is probably why this one stayed open.
I verified end-to-end against main (d4469b1) rather than just reading the code:
Started openfga/openfga:latest and built the CLI from main.
Ran fga store import on the repo's own tests/fixtures/basic-store.fga.yaml, which uses model_file, tuple_file and a tests[].check block with assertions: {owner: true}.
Read the results back from the server.
GET /stores/{store_id}/assertions/{model_id} returned:
LoadTuples in internal/storetest/storedata.go merges tuples, tuple_file and tuple_files, and resolves each test's own tuple_file, so I couldn't find a path where they're dropped.
One thing worth noting in case it's what was originally meant: importAssertions only converts check entries. list_objects and list_users tests are skipped, because WriteAssertions only models check-style assertions server-side. That's an API limitation rather than a bug, but if the intent was for those to become assertions too, that'd be a separate feature request.
Happy to open a PR adding an integration-test case that asserts the imported assertions actually reach the server if that'd be useful — the current fixtures in tests/import-tests-cases.yaml only check the command's stdout and exit code, so there's no regression guard on this specific behaviour. Otherwise I think this can be closed.
@Corgam — if you're still seeing this on a recent version, a repro .fga.yaml and your CLI version would help.
Activity
Corgam commentedon Jan 10, 2025
For me, the
tuplesdefined in the.fga.yamlfile are not imported correctly either.ahmedashraffcih commentedon Sep 24, 2026
I took a look at this and I don't think it reproduces on current
mainany more — it looks like it was fixed by #446 and the issue was just never closed.#446 ("support importing assertions as part of a store") landed on 2025-02-07 and added
importAssertionsincmd/store/import.go, which converts each test'scheckentries intoclient.ClientAssertionvalues and callsWriteAssertions. This issue was filed 2024-09-25 and @Corgam's comment is from 2025-01-10, so both predate that change. #446's description says it closes #224, which is probably why this one stayed open.I verified end-to-end against
main(d4469b1) rather than just reading the code:openfga/openfga:latestand built the CLI frommain.fga store importon the repo's owntests/fixtures/basic-store.fga.yaml, which usesmodel_file,tuple_fileand atests[].checkblock withassertions: {owner: true}.GET /stores/{store_id}/assertions/{model_id}returned:{"assertions":[{"tuple_key":{"object":"group:foo","relation":"owner","user":"user:anne"},"expectation":true,"contextual_tuples":[],"context":null}]}So the test was imported as an assertion as expected.
On @Corgam's follow-up about
tuples— those import correctly too. The same run'sPOST /stores/{store_id}/readreturned the tuple fromtuple_file:{"tuples":[{"key":{"user":"user:anne","relation":"owner","object":"group:foo","condition":null}}]}LoadTuplesininternal/storetest/storedata.gomergestuples,tuple_fileandtuple_files, and resolves each test's owntuple_file, so I couldn't find a path where they're dropped.One thing worth noting in case it's what was originally meant:
importAssertionsonly convertscheckentries.list_objectsandlist_userstests are skipped, becauseWriteAssertionsonly models check-style assertions server-side. That's an API limitation rather than a bug, but if the intent was for those to become assertions too, that'd be a separate feature request.Happy to open a PR adding an integration-test case that asserts the imported assertions actually reach the server if that'd be useful — the current fixtures in
tests/import-tests-cases.yamlonly check the command's stdout and exit code, so there's no regression guard on this specific behaviour. Otherwise I think this can be closed.@Corgam — if you're still seeing this on a recent version, a repro
.fga.yamland your CLI version would help.Corgam commentedon Sep 24, 2026
Unfortunately, I do not work on this anymore, neither I have the old code. So I cannot help, sorry.