fluree / core

Fluree releases and public bug reports
0 stars 0 forks source link

`/history` API has mapping mistakes for `f:previous` #63

Open aaj3f opened 7 months ago

aaj3f commented 7 months ago

Description

It appears that certain IRIs are getting mis-mapped when returned in the commit-details of a /history query. See, for example, the following query and result (specifically the f:previous: { @id: ex:yeti-mutation-event } line)

/history query

{
    "@context": {
        "ex": "http://example.org/",
        "schema": "http://schema.org/",
        "f": "https://ns.flur.ee/ledger#"
    },
    "from": "cookbook/base",
    "t": { "from": "latest" },
    "commit-details": true
}

Abbreviated results:

[
    {
        "f:commit": {
            "f:alias": "cookbook/base",
            "@id": "fluree:commit:sha256:bbwtbm4mzecknt72i2rhboz7f74ohbzsuesm35gjfpaxtawngh7x3",
            ...,
            "f:previous": {
                "@id": "ex:yeti-mutation-event"
            },
            "f:data": {
                "f:previous": {
                    "@id": "fluree:db:sha256:bb2a6elisfmgiaachdbb5eunpge65uhlzsjhkq7hweqrkczssln5q"
                },
                ...,
                "f:assert": [
                    {
                        "schema:description": "All humans are yetis now!!",
                        "id": "ex:yeti-mutation-event"
                    },
                    ...
                ],
                ...
            },
            ...
        }
    }
]

Full results

[
    {
        "f:commit": {
            "f:alias": "cookbook/base",
            "@id": "fluree:commit:sha256:bbwtbm4mzecknt72i2rhboz7f74ohbzsuesm35gjfpaxtawngh7x3",
            "f:time": 1700141476450,
            "f:previous": {
                "@id": "ex:yeti-mutation-event"
            },
            "f:v": 0,
            "f:branch": "main",
            "f:address": "fluree:file://cookbook/base/main/commit/c3318153cec5782f2238f9bcd2ef151e1a3750f01ca810c4f9297ad86c993018.json",
            "f:data": {
                "f:previous": {
                    "@id": "fluree:db:sha256:bb2a6elisfmgiaachdbb5eunpge65uhlzsjhkq7hweqrkczssln5q"
                },
                "f:address": "fluree:file://cookbook/base/main/commit/7d7c95140af027ed8014d14bd438670bfdb70a957053c4ebd07d0a2e7d314b09.json",
                "f:flakes": 231,
                "f:size": 21387,
                "f:t": 9,
                "f:assert": [
                    {
                        "schema:description": "All humans are yetis now!!",
                        "id": "ex:yeti-mutation-event"
                    },
                    {
                        "@type": "ex:Yeti",
                        "schema:name": "Andy the Yeti",
                        "id": "ex:andrew"
                    }
                ],
                "f:retract": []
            },
            "f:defaultContext": {
                "@id": "fluree:context:74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b"
            }
        }
    }
]
dpetran commented 7 months ago

Do you have the steps to reproduce this? We've got plenty of tests that check the value of the previous key, so I don't think it's as straightforward as just doing a history query.