feat(rest): the remediation record door, POST /v1/remediation-records #369
<h3>Code Review by Qodo</h3>
<code>🐞 Bugs (1)</code> <code>📘 Rule violations (0)</code> <code>📜 Skill insights (0)</code>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<br/>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
<details>
<summary> 1. <s>Scheduled runners cannot submit reports</s> <code>✓ Resolved</code></summary>
<br/>
<p><b>Resolving commit:</b> <a href="https://github.com/traust-security/traust-core/commit/ef49d242fb889cc119e794e7936f4620ffd22d69"><code>ef49d24</code></a></p>
<details>
><summary>Resolution reason</summary>
><br/>
><pre>
>The recording check in RemediationService.record_order now compares order.asset against
>REMEDIATE_FINDING (the scheduler's asset) instead of the removed REMEDIATION_RECORD constant, so
>orders created by POST /v1/remediations are accepted. The triage door's exclusion in decisions.py
>was also switched to REMEDIATE_FINDING, and the test suite gained a test that schedules via the
>native remediation flow, claims the order, and records its report successfully. The legacy
>'remediation' asset is explicitly refused (test case 'obsolete remediation asset'), which is a
>deliberate decision that the finding asked to be made explicit.
></pre>
></details>
<!-- qodo-finding-reference
<code>↗ src/traust_core/v1/services/remediation.py[R563]</code>
-->
<details>
><summary>Description</summary>
><br/>
><pre>
><b><i>record_order</i></b> requires an order asset named <b><i>remediation</i></b>, but
><b><i>RemediationSchedulingService.create</i></b> submits the work item’s order with the asset
><b><i>remediate_finding</i></b>. A runner claiming an order created by <b><i>POST /v1/remediations</i></b> receives a 403
>from the new recording door, even if that asset is added to the shared recording allowlist.
></pre>
></details>
<hr/>
</details>
<details>
<summary> 2. <s>A stale runner can resolve a newer work item</s> <code>✓ Resolved</code></summary>
<br/>
<p><b>Resolving commit:</b> <a href="https://github.com/traust-security/traust-core/commit/ef49d242fb889cc119e794e7936f4620ffd22d69"><code>ef49d24</code></a></p>
<details>
><summary>Resolution reason</summary>
><br/>
><pre>
>The diff changes record_order so that it now returns self.record(doc, provenance,
>work_item_id=order.work_item_id), passing the leased order's named work item into recording instead
>of relying on finding-based selection. It also enforces the native REMEDIATE_FINDING asset on the
>order. The added tests (test_named_order_cannot_record_another_work_item, parametrized for "another
>finding" and "newer attempt") cover the stale-order scenario where a still-leased order must not
>modify a newer item, matching the suggested regression test.
></pre>
></details>
<!-- qodo-finding-reference
<code>↗ src/traust_core/v1/services/remediation.py[R579]</code>
-->
<details>
><summary>Description</summary>
><br/>
><pre>
><b><i>record_order</i></b> calls <b><i>record</i></b> without the leased order’s <b><i>work_item_id</i></b>, so <b><i>_reported_item</i></b> selects
>an open item matching the report’s findings instead of the item named by the order. If the named
>item has been abandoned and another is opened for those findings, a still-leased order can attach
>its report and record resolutions against the newer item.
></pre>
></details>
<hr/>
</details>
<details>
<summary> 3. <s>Remediation runners can change triage</s> <code>✓ Resolved</code></summary>
<br/>
<p><b>Resolving commit:</b> <a href="https://github.com/traust-security/traust-core/commit/9773d1c416f424b074798f95a3de3d37cd1cdb4d"><code>9773d1c</code></a></p>
<details>
><summary>Resolution reason</summary>
><br/>
><pre>
>The triage door (FindingDecisions.record_triage) now checks the leased order's asset and refuses
>with ForbiddenError when it is the remediation asset, so a remediation lease cannot record triage. A
>regression test posts a triage report under a remediation lease and expects 403 with no writes.
></pre>
></details>
<!-- qodo-finding-reference
<code>↗ src/traust_core/v1/context/context.py[R777]</code>
-->
<details>
><summary>Description</summary>
><br/>
><pre>
><b><i>Context._wire</i></b> gives remediation recording the triage allowlist, but <b><i>record_triage</i></b> also accepts
>every asset on that list without excluding remediation orders. When <b><i>remediation</i></b> is added to
><b><i>recording.triage</i></b> to enable the new door, a runner holding a remediation lease can submit a triage
>report for that repository and record triage decisions.
></pre>
></details>
<hr/>
</details>
<details><summary><ins><strong>View high (2)</strong></ins></summary><br/>
<details>
<summary> 4. <s>Triage runners can resolve work items</s> <code>✓ Resolved</code></summary>
<br/>
<p><b>Resolving commit:</b> <a href="https://github.com/traust-security/traust-core/commit/88d53b52dc4d6651ae8d9e3229b5e883683f1129"><code>88d53b5</code></a></p>
<details>
><summary>Resolution reason</summary>
><br/>
><pre>
>N/A
></pre>
></details>
<!-- qodo-finding-reference
<code>↗ src/traust_core/v1/context/context.py[R777]</code>
-->
<details>
><summary>Description</summary>
><br/>
><pre>
><b><i>record_order</i></b> accepts any leased order whose asset appears in the triage recording allowlist,
>because that list is also used for remediation and no check requires a remediation order. When an
>operator allows a triage asset, its lease holder can submit a valid same-repository remediation
>report that attaches to an open work item and records finding resolutions without holding a
>remediation lease.
></pre>
></details>
<hr/>
</details>
<details>
<summary> 5. Runners can alter other repositories <code>🐞 Bug</code> <code>⛨ Security</code></summary>
<br/>
<details open>
><summary>Description</summary>
><br/>
><pre>
><b><i>record_order</i></b> authorizes the lease against <b><i>doc.metadata.repository</i></b>, but <b><i>record</i></b> chooses the work
>item from <b><i>doc.source_findings</i></b> without checking that those findings belong to the authorized
>repository. A runner leased to repository A can submit a report naming A while referencing an open
>work item’s findings in repository B, causing the report, Jira links, and resolutions to be written
>for B.
></pre>
></details>
<details>
><summary>Code</summary>
><br/>
><code>[src/traust_core/v1/services/remediation.py[515]](https://github.com/traust-security/traust-core/pull/369/files#diff-121ba6e02fa43c531f8660c422c27b3b075f3e4d890c049e467fe6e559222f9eR515-R515)</code>
>>+ repository = self._inventory.find_repository(doc.metadata.repository) >
></details>
<details>
><summary>Evidence</summary>
><br/>
><pre>
>The new authorization input comes solely from report metadata. The lease check compares the order
>with that supplied repository ID, whereas the unchanged recorder independently selects and updates a
>work item by the findings’ repository. The new wrong-repository test changes metadata rather than
>exercising the inverse mismatch.
></pre>
> <code>[src/traust_core/v1/services/remediation.py\[515-525\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/src/traust_core/v1/services/remediation.py/#L515-L525)</code>
<code>[src/traust_core/v1/services/operations.py\[365-378\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/src/traust_core/v1/services/operations.py/#L365-L378)</code>
<code>[src/traust_core/v1/services/operations.py\[407-415\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/src/traust_core/v1/services/operations.py/#L407-L415)</code>
<code>[src/traust_core/v1/services/remediation.py\[539-573\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/src/traust_core/v1/services/remediation.py/#L539-L573)</code>
<code>[src/traust_core/v1/services/remediation.py\[808-819\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/src/traust_core/v1/services/remediation.py/#L808-L819)</code>
<code>[tests/v1/rest/remediation/test_remediation_records.py\[227-235\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/tests/v1/rest/remediation/test_remediation_records.py/#L227-L235)</code>
></details>
<details>
><summary>Agent prompt</summary>
><br/>
>>The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The recording lease is checked against the report metadata, while the target work item is selected from finding IDs that may belong to another repository. > >## Fix Focus Areas >- src/traust_core/v1/services/remediation.py[505-525] >- src/traust_core/v1/services/remediation.py[808-819] >- tests/v1/rest/remediation/test_remediation_records.py[214-258] > >## Recommended Fix >Before recording, require the repository of every referenced finding and the selected work item to match the repository authorized by the leased order. Add a regression test with metadata naming the leased repository and findings belonging to a second repository; assert refusal and no changed rows or objects. >
<code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
></details>
<hr/>
</details>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-self-review-slot -->
<!-- qodo-context:start -->
<details><summary><strong>Context sources</strong></summary>
<div>Review mode: <code>Auto: ⚖️ Balanced</code>: Lease authorization and work-item scoping changes touch high-risk auth and concurrency areas; logic is modest.</div>
<!-- qodo-context:end -->
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-daily-tip:start -->
<details>
<summary><strong>Tip of the day</strong></summary>
<br/>
<pre>💡 Did you know, you can switch off images and animations for a plain-text comment</pre>
<a href="https://docs.qodo.ai/tips-and-tricks">More tips ↗</a> | <a href="https://app.qodo.ai/configurations?tab=display-preferences">Customize Qodo ↗</a> | <a href="https://docs.qodo.ai">Qodo docs ↗</a>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-daily-tip:end -->
<!-- https://github.com/traust-security/traust-core/commit/ef49d242fb889cc119e794e7936f4620ffd22d69 -->
<!-- qodo-previous-reviews:start -->
<!-- FOLDED_SECTION_START -->
<details>
<summary><strong>Previous reviews</strong></summary>
<br/>
Review updated until commit <a href="https://github.com/traust-security/traust-core/commit/ef49d242fb889cc119e794e7936f4620ffd22d69">ef49d24</a>
<details><summary>Results up to commit 98d5f0d <code>⚖️ Balanced</code></summary>
<br><code>🐞 Bugs (1)</code> <code>📘 Rule violations (0)</code> <code>📎 Requirement gaps (0)</code> <code>🎨 UX issues (0)</code> <code>🔗 Cross-repo conflicts (0)</code> <code>📜 Skill insights (0)</code>
<br/>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
<details>
<summary> 1. Runners can alter other repositories <code>🐞 Bug</code> <code>⛨ Security</code></summary>
<br/>
<details open>
><summary>Description</summary>
><br/>
><pre>
><b><i>record_order</i></b> authorizes the lease against <b><i>doc.metadata.repository</i></b>, but <b><i>record</i></b> chooses the work
>item from <b><i>doc.source_findings</i></b> without checking that those findings belong to the authorized
>repository. A runner leased to repository A can submit a report naming A while referencing an open
>work item’s findings in repository B, causing the report, Jira links, and resolutions to be written
>for B.
></pre>
></details>
<details>
><summary>Code</summary>
><br/>
><code>[src/traust_core/v1/services/remediation.py[515]](https://github.com/traust-security/traust-core/pull/369/files#diff-121ba6e02fa43c531f8660c422c27b3b075f3e4d890c049e467fe6e559222f9eR515-R515)</code>
>>+ repository = self._inventory.find_repository(doc.metadata.repository) >
></details>
<details>
><summary>Evidence</summary>
><br/>
><pre>
>The new authorization input comes solely from report metadata. The lease check compares the order
>with that supplied repository ID, whereas the unchanged recorder independently selects and updates a
>work item by the findings’ repository. The new wrong-repository test changes metadata rather than
>exercising the inverse mismatch.
></pre>
> <code>[src/traust_core/v1/services/remediation.py\[515-525\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/src/traust_core/v1/services/remediation.py/#L515-L525)</code>
<code>[src/traust_core/v1/services/operations.py\[365-378\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/src/traust_core/v1/services/operations.py/#L365-L378)</code>
<code>[src/traust_core/v1/services/operations.py\[407-415\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/src/traust_core/v1/services/operations.py/#L407-L415)</code>
<code>[src/traust_core/v1/services/remediation.py\[539-573\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/src/traust_core/v1/services/remediation.py/#L539-L573)</code>
<code>[src/traust_core/v1/services/remediation.py\[808-819\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/src/traust_core/v1/services/remediation.py/#L808-L819)</code>
<code>[tests/v1/rest/remediation/test_remediation_records.py\[227-235\]](https://github.com/traust-security/traust-core/blob/ef49d242fb889cc119e794e7936f4620ffd22d69/tests/v1/rest/remediation/test_remediation_records.py/#L227-L235)</code>
></details>
<details>
><summary>Agent prompt</summary>
><br/>
>>The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The recording lease is checked against the report metadata, while the target work item is selected from finding IDs that may belong to another repository. > >## Fix Focus Areas >- src/traust_core/v1/services/remediation.py[505-525] >- src/traust_core/v1/services/remediation.py[808-819] >- tests/v1/rest/remediation/test_remediation_records.py[214-258] > >## Recommended Fix >Before recording, require the repository of every referenced finding and the selected work item to match the repository authorized by the leased order. Add a regression test with metadata naming the leased repository and findings belonging to a second repository; assert refusal and no changed rows or objects. >
<code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
></details>
<hr/>
</details>
<!-- qodo-self-review-slot -->
</details>
<details><summary>Results up to commit eefa6d9 <code>⚖️ Balanced</code></summary>
<br><code>🐞 Bugs (0)</code> <code>📘 Rule violations (0)</code> <code>📎 Requirement gaps (0)</code> <code>🎨 UX issues (0)</code> <code>🔗 Cross-repo conflicts (0)</code> <code>📜 Skill insights (0)</code>
<br/>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
<details>
<summary> 1. <s>Triage runners can resolve work items</s> <code>✓ Resolved</code></summary>
<br/>
<p><b>Resolving commit:</b> <a href="https://github.com/traust-security/traust-core/commit/88d53b52dc4d6651ae8d9e3229b5e883683f1129"><code>88d53b5</code></a></p>
<details>
><summary>Resolution reason</summary>
><br/>
><pre>
>N/A
></pre>
></details>
<!-- qodo-finding-reference
<code>↗ src/traust_core/v1/context/context.py[R777]</code>
-->
<details>
><summary>Description</summary>
><br/>
><pre>
><b><i>record_order</i></b> accepts any leased order whose asset appears in the triage recording allowlist,
>because that list is also used for remediation and no check requires a remediation order. When an
>operator allows a triage asset, its lease holder can submit a valid same-repository remediation
>report that attaches to an open work item and records finding resolutions without holding a
>remediation lease.
></pre>
></details>
<hr/>
</details>
<!-- qodo-self-review-slot -->
</details>
<details><summary>Results up to commit 88d53b5 <code>⚖️ Balanced</code></summary>
<br><code>🐞 Bugs (0)</code> <code>📘 Rule violations (0)</code> <code>📎 Requirement gaps (0)</code> <code>🎨 UX issues (0)</code> <code>🔗 Cross-repo conflicts (0)</code> <code>📜 Skill insights (0)</code>
<br/>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
<details>
<summary> 1. <s>Remediation runners can change triage</s> <code>✓ Resolved</code></summary>
<br/>
<p><b>Resolving commit:</b> <a href="https://github.com/traust-security/traust-core/commit/9773d1c416f424b074798f95a3de3d37cd1cdb4d"><code>9773d1c</code></a></p>
<details>
><summary>Resolution reason</summary>
><br/>
><pre>
>The triage door (FindingDecisions.record_triage) now checks the leased order's asset and refuses
>with ForbiddenError when it is the remediation asset, so a remediation lease cannot record triage. A
>regression test posts a triage report under a remediation lease and expects 403 with no writes.
></pre>
></details>
<!-- qodo-finding-reference
<code>↗ src/traust_core/v1/context/context.py[R777]</code>
-->
<details>
><summary>Description</summary>
><br/>
><pre>
><b><i>Context._wire</i></b> gives remediation recording the triage allowlist, but <b><i>record_triage</i></b> also accepts
>every asset on that list without excluding remediation orders. When <b><i>remediation</i></b> is added to
><b><i>recording.triage</i></b> to enable the new door, a runner holding a remediation lease can submit a triage
>report for that repository and record triage decisions.
></pre>
></details>
<hr/>
</details>
<!-- qodo-self-review-slot -->
</details>
<details><summary>Results up to commit efef41b <code>⚖️ Balanced</code></summary>
<br><code>🐞 Bugs (0)</code> <code>📘 Rule violations (0)</code> <code>📎 Requirement gaps (0)</code> <code>🎨 UX issues (0)</code> <code>🔗 Cross-repo conflicts (0)</code> <code>📜 Skill insights (0)</code>
<br/>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
<details>
<summary> 1. <s>A stale runner can resolve a newer work item</s> <code>✓ Resolved</code></summary>
<br/>
<p><b>Resolving commit:</b> <a href="https://github.com/traust-security/traust-core/commit/ef49d242fb889cc119e794e7936f4620ffd22d69"><code>ef49d24</code></a></p>
<details>
><summary>Resolution reason</summary>
><br/>
><pre>
>The diff changes record_order so that it now returns self.record(doc, provenance,
>work_item_id=order.work_item_id), passing the leased order's named work item into recording instead
>of relying on finding-based selection. It also enforces the native REMEDIATE_FINDING asset on the
>order. The added tests (test_named_order_cannot_record_another_work_item, parametrized for "another
>finding" and "newer attempt") cover the stale-order scenario where a still-leased order must not
>modify a newer item, matching the suggested regression test.
></pre>
></details>
<!-- qodo-finding-reference
<code>↗ src/traust_core/v1/services/remediation.py[R579]</code>
-->
<details>
><summary>Description</summary>
><br/>
><pre>
><b><i>record_order</i></b> calls <b><i>record</i></b> without the leased order’s <b><i>work_item_id</i></b>, so <b><i>_reported_item</i></b> selects
>an open item matching the report’s findings instead of the item named by the order. If the named
>item has been abandoned and another is opened for those findings, a still-leased order can attach
>its report and record resolutions against the newer item.
></pre>
></details>
<hr/>
</details>
<details>
<summary> 2. <s>Scheduled runners cannot submit reports</s> <code>✓ Resolved</code></summary>
<br/>
<p><b>Resolving commit:</b> <a href="https://github.com/traust-security/traust-core/commit/ef49d242fb889cc119e794e7936f4620ffd22d69"><code>ef49d24</code></a></p>
<details>
><summary>Resolution reason</summary>
><br/>
><pre>
>The recording check in RemediationService.record_order now compares order.asset against
>REMEDIATE_FINDING (the scheduler's asset) instead of the removed REMEDIATION_RECORD constant, so
>orders created by POST /v1/remediations are accepted. The triage door's exclusion in decisions.py
>was also switched to REMEDIATE_FINDING, and the test suite gained a test that schedules via the
>native remediation flow, claims the order, and records its report successfully. The legacy
>'remediation' asset is explicitly refused (test case 'obsolete remediation asset'), which is a
>deliberate decision that the finding asked to be made explicit.
></pre>
></details>
<!-- qodo-finding-reference
<code>↗ src/traust_core/v1/services/remediation.py[R563]</code>
-->
<details>
><summary>Description</summary>
><br/>
><pre>
><b><i>record_order</i></b> requires an order asset named <b><i>remediation</i></b>, but
><b><i>RemediationSchedulingService.create</i></b> submits the work item’s order with the asset
><b><i>remediate_finding</i></b>. A runner claiming an order created by <b><i>POST /v1/remediations</i></b> receives a 403
>from the new recording door, even if that asset is added to the shared recording allowlist.
></pre>
></details>
<hr/>
</details>
<!-- qodo-self-review-slot -->
</details>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-previous-reviews:end -->
<a href="https://www.qodo.ai"><img src="https://www.qodo.ai/wp-content/uploads/2025/03/qodo-logo.svg" width="80" alt="Qodo Logo"></a>
Code review by qodo was updated up to the latest commit https://github.com/traust-security/traust-core/commit/eefa6d9607aeedd876cb20364ac5c12c0b9d6e82
Code review by qodo was updated up to the latest commit https://github.com/traust-security/traust-core/commit/88d53b52dc4d6651ae8d9e3229b5e883683f1129
9773d1c (amending 88d53b5 into the branch's single commit) takes Qodo's new finding and the mirror it implies:
record_triage now requires the leased order to be a triage order (src/traust_core/v1/services/findings/decisions.py) — the same guard record_order got on the remediation side. The shared triage allowlist (the NEED(contracts) shape smith-xyz asked about) cuts both ways: once an operator adds the remediation asset to recording.triage to enable this door, the allowlist alone would have admitted a remediation lease at the triage door too. Both doors now check the leased order's asset, so the borrow is safe in both directions until contracts lands a recording.remediation section. Regression case: remediation lease in test_triage_authority_and_provenance_refusals_precede_all_report_mutations (fails on 88d53b5).record_order refuses the report when its findings' single repository is not the repository the lease names (src/traust_core/v1/services/remediation.py, the covered check), with the findings of another repository regression case in test_order_authorization_refusals_leave_rows_and_objects_unchanged (fails on eefa6d9). The re-review's description for this still quotes the pre-fix code, so it reads as a stale listing rather than an open finding — happy to walk through the scenario if you see a path the guard misses.Suite: 11,353 passed.
Code review by qodo was updated up to the latest commit https://github.com/traust-security/traust-core/commit/9773d1c416f424b074798f95a3de3d37cd1cdb4d
<h3>Code Review by Qodo</h3>
<br/>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
_Nice, no open findings for this group_
<br/>
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended">
_Nice, no open findings for this group_
<br/>
<img src="https://img.shields.io/badge/Low-634FD1?style=flat-square" height="20px" alt="Informational">
_Nice, no open findings for this group_
<br/>
<!-- qodo-self-review-slot -->
<!-- https://github.com/traust-security/traust-core/commit/ef49d242fb889cc119e794e7936f4620ffd22d69 -->
Code review by qodo was updated up to the latest commit https://github.com/traust-security/traust-core/commit/efef41bbf352546648ff70efe8b2fb990ba88528
Qodo corrections — ef49d242
remediate_finding asset. Both scheduled leases and explicitly started native leases are supported. The unmerged remediation asset is refused even if allowlisted; no alias or second asset definition remains.work_item_id into the existing recorder. It scopes both finding-set selection and digest replay, so an abandoned attempt cannot mutate a newer item, another same-repository finding set cannot be substituted, and identical bytes on a named retry record against that retry. Orders with no named work item retain the existing finding-based behavior.All four new failing-before scenarios now pass. Existing replay, explicit-start, lease-owner, provenance, default-deny and triage/remediation separation coverage remains exercised.
Verification: make lint-fix passed; focused SQLite/PostgreSQL service/REST suite 397 passed; make test 11,500 passed / 1 skipped; normal pre-push lint/coverage 95.34% (same 11,500 tests); OpenAPI builds with 69 paths. A throwaway real HTTP server additionally proved schedule → claim → report, identical-byte named retry/replay, stale-order refusal and cross-repository refusal without writes.
The README documents the native asset, temporary triage config/source mapping, and named versus unbound order semantics. Current-head Qodo re-review is being requested; this is verification evidence, not a premature zero-findings claim.
/agentic_review
Code review by qodo was updated up to the latest commit https://github.com/traust-security/traust-core/commit/ef49d242fb889cc119e794e7936f4620ffd22d69
Qodo's current-head cross-repository listing is a false positive for the scenario described, not an unimplemented fix:
record: remediation.py lines 567–578. A sole foreign repository raises ForbiddenError; mixed-repository payloads are rejected by the existing recorder before publication.The scheduler-asset and named-work-item findings are fixed in ef49d242. The remaining cross-repository item should be dismissed/re-evaluated against this guard and counterexample; I am not claiming Qodo's displayed bug count is zero.
chubirka
gurnben
What
RemediationService.recordwas reachable only in-process, so a runner executing a remediation order could not hand its patch report back — SCI's remediation pipeline had no way to record a report at all. This addsPOST /v1/remediation-records, mirroring the verification-records door:rest/remediation/remediation_records.py): the report artifact as the payload (validated against the contracts remediation schema), provenance withrun_id == run_order_id, and the caller's leasedrun_order_id; responds with the recorded work item.RemediationService.record_order): wrapsrecordinOpsService.recordingauthorization — verified machine principal, live lease held by that principal, repository scope (resolved fromdoc.metadata.repository), asset allowlist, provenance source — exactly theVerificationService.record_orderpattern.Deviation from the verification door, and why: contracts has neither a
remediation_reportsource type nor arecording.remediationconfig section (checked: not on the pinned pin, not on contractsdevelopmenteither), andtests/v1/context/test_traust_yaml.pypinsRecordingConfig's keys to the contractstraustschema both ways. So the door records under the triage source and authorizes under the triage asset allowlist — matching what the in-process flow already uses for remediation provenance (SourceType.TRIAGE_REPORT) — withNEED(contracts: …)markers inservices/operations.pyandcontext/context.py. When contracts grows both, the flip is: a source-type value in_RECORDING_SOURCESand reading the door's own config section inContext._wire. A second, smaller deviation: norun_order_idis stored on the work item's assessment (verification stores one on the assessment it creates; remediation attaches to a pre-existing work-item assessment opened outside the order, so there is nothing to rebind — the door's replay test asserts the no-op instead).Unblocks progress-tracker followups 2026-11-02 ask A (plans
traust-standardization/9-validation-remediation/03, SCI filing provider lane 5). SDK half: traust-security/traust-sdkfeat/remediation-record-template.Checklist
developmentObjectStore; no in-memory stand-ins insrc/uow/seedsrc/); shared logic is one helpermake lint-fix && make testgreenChanged tests
Real Context/store tests exercise SQLite and PostgreSQL: native scheduled order recording, exact-byte preservation and replay, named-item isolation across findings and abandoned attempts, identical-byte retries, explicit starts without a named item, rejected obsolete assets, and unchanged rows/object bytes on authorization or payload refusal. Triage exclusion and remediation fixtures now use the scheduler-owned
remediate_findingasset.💘 Generated with Crush
Qodo corrections —
ef49d242remediate_findingasset. Both scheduled leases and explicitly started native leases are supported. The unmergedremediationasset is refused even if allowlisted; no alias or second asset definition remains.work_item_idinto the existing recorder. It scopes both finding-set selection and digest replay, so an abandoned attempt cannot mutate a newer item, another same-repository finding set cannot be substituted, and identical bytes on a named retry record against that retry. Orders with no named work item retain the existing finding-based behavior.All four new failing-before scenarios now pass. Existing replay, explicit-start, lease-owner, provenance, default-deny and triage/remediation separation coverage remains exercised.
Verification:
make lint-fixpassed; focused SQLite/PostgreSQL service/REST suite 397 passed;make test11,500 passed / 1 skipped; normal pre-push lint/coverage 95.34% (same 11,500 tests); OpenAPI builds with 69 paths. A throwaway real HTTP server additionally proved schedule → claim → report, identical-byte named retry/replay, stale-order refusal and cross-repository refusal without writes.The README documents the native asset, temporary triage config/source mapping, and named versus unbound order semantics. Current-head Qodo re-review is being requested; this is verification evidence, not a premature zero-findings claim.