<p dir="auto">clicking one or multiple task instances from /taskinstance/list/ view and choosing any new state, results in error screen</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/4283/96177660-3180bc80-0efc-11eb-8056-c9e3303b81a6.png"><img width="1177" alt="Screen Shot 2020-10-15 at 3 34 54 PM" src="https://user-images.githubusercontent.com/4283/96177660-3180bc80-0efc-11eb-8056-c9e3303b81a6.png" style="max-width: 100%;"></a></p>
<p dir="auto">As part of the work on AIP-39 we want to make it so that <em>every</em> TaskInstance in the DB has DagRun.</p>
<p dir="auto">Now at "run time" this is already the case (baring the case where someone might delete a DagRun. Rare, now only possible by direct DB? I can't remember if Browse -&gt; DagRuns allows deleting anymore or not) but in our tests this is far from the case</p>
<p dir="auto">There are countless examples of where the tests just directly create TaskInstances, without a matching DagRun.</p>
<p dir="auto">We need to fix that so that the tests reflect reality.</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="939996671" data-permission-text="Title is private" data-url="https://github.com/apache/airflow/issues/16889" data-hovercard-type="pull_request" data-hovercard-url="/apache/airflow/pull/16889/hovercard" href="https://github.com/apache/airflow/pull/16889">#16889</a> is part of this -- creating a pytest fixture to reduce amount of duplication in tests</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="967189556" data-permission-text="Title is private" data-url="https://github.com/apache/airflow/issues/17556" data-hovercard-type="pull_request" data-hovercard-url="/apache/airflow/pull/17556/hovercard" href="https://github.com/apache/airflow/pull/17556">#17556</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> We probably also want to enforce foreign key constraints between DagRun and TaskInstance once we've done this (see also <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="945406015" data-permission-text="Title is private" data-url="https://github.com/apache/airflow/issues/17030" data-hovercard-type="pull_request" data-hovercard-url="/apache/airflow/pull/17030/hovercard" href="https://github.com/apache/airflow/pull/17030">#17030</a>)</li>
</ul>