Skip to content
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

Time travel queries for objects with a status field not showing in before/after JSON #88

Open
jathanism opened this issue Sep 14, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@jathanism
Copy link
Contributor

jathanism commented Sep 14, 2021

Steps to reproduce

  • Create an object that has a status field (like a Device) setting the status to Active
  • Create a new branch
  • Change the status field value to another value (e.g. Planned)

Expected behavior

  • The column should render with before/after values

Observed behavior

  • No before/after in the column
  • The commit reflects the change from "Active" to "Planned"

Cursor_and_Updated_foo-bar1_-_Nautobot

  • But the diff table view does not reflect this:

Cursor_and_develop_-_Nautobot

Debug

I was attempting to fix this by debugging the inner render_before_after_diff() function inside of dolt.dynamic.diff_factory.DiffListViewBase.wrap_render_func().

On line 249 in the code, I am seeing that the value variable is "Planned" when it should be "Active" since this should be the before state:

(Pdb) value
<Status: Planned>

I confirmed that the JSON blob being generated in the from/to query annotations is missing the from_status and to_status fields. In this debug example the object was not a Device, but the issue appears to the the same:

(Pdb) print(json.dumps(record.diff, indent=4))
{
    "diff_type": "modified",
    "from_asn": 1668,
    "from_commit": "2q52d50tovr5fh4pk3bgn47gbaar7bt5",
    "from_commit_date": "2021-09-10T19:33:03.851Z",
    "from_created": "2021-09-10T00:00:00Z",
    "from_description": "ATDN",
    "from_id": "de25a1c7a76a48ed94811d9a96018489",
    "from_last_updated": "2021-09-10T19:33:03.632807Z",
    "root": "to",
    "to_asn": 1668,
    "to_commit": "veumh6tms0pmv4il05jlnpsucjdqs1ae",
    "to_commit_date": "2021-09-10T19:59:01.928Z",
    "to_created": "2021-09-10T00:00:00Z",
    "to_description": "AOL Transit Data Network",
    "to_id": "de25a1c7a76a48ed94811d9a96018489",
    "to_last_updated": "2021-09-10T19:57:37.601194Z"
}

It appears to me that the to_queryset and from_queryset inside of dolt.diffs.two_dot_diffs() need to be tweaked a little.

@jathanism jathanism added the bug Something isn't working label Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant