Repository navigation
fix(adr): protect namespace unlink with response ETags - #925
Hangyi (HangyiWang) merged 4 commits into
Conversation
Capture the namespace GET response ETag and require If-Match on the replacement PUT. Preserve the existing no-retry and no-wait contracts; reject missing ETags before RBAC or writes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The implementation safely prevents stale writes and includes comprehensive regression coverage.
0 open findings
What changed in this PR
Protects ADR namespace endpoint removal from overwriting concurrent updates using ETag-based conditional PUTs.
Changes:
- Captures and validates namespace response ETags.
- Sends ETags through
If-Matchand preserves HTTP 412 conflicts. - Adds regression coverage, help guidance, and release notes.
| File | Description |
|---|---|
HISTORY.rst |
Documents concurrency protection. |
azext_iot/adr/providers/link.py |
Implements ETag-conditional endpoint removal. |
azext_iot/adr/_help.py |
Explains conflict and rerun behavior. |
azext_iot/tests/adr/test_adr_link_delete_unit.py |
Covers ETags, conflicts, and reruns. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Azure SRE Agent - automated reviewReviewing Mechanics check out. I verified the two non-obvious plumbing assumptions against the vendored SDK at this head (
Blocking
Suggestions
Nits
Checked and clean (recording the negatives so they do not get re-derived):
Automated review — may be incomplete; please treat findings as input rather than as a gate. |
Keep the shared offline CLI fixture migration together with ETag-aware unlink mocks. Record the unlink fix in the 1.1.0b1 release notes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure SRE Agent - automated reviewReviewing The increment is a single commit — Blocking None. Suggestions None new. Nits None. Checked and clean (the merge resolution, verified end to end):
Carried over from the
Note: This is an automated review and may be incomplete. |
Reject weak or malformed entity tags before RBAC, normalize HTTP optional whitespace, and preserve the original 412 while logging rerun guidance. Cover wire headers, failure side effects, and CLI diagnostics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure SRE Agent - automated reviewReviewing One commit, Closed by this commit (verified, nothing further needed)
Suggestions
Nits
Summary Mechanically correct and well tested at the unit level; the commit does exactly what the two open inline threads asked for, and the HISTORY.rst and Automated review — may be incomplete. I did not restate Copilot's two inline comments beyond noting that this commit resolves them. |
Name the RFC character-boundary tag and give accepted and rejected ETag cases descriptive pytest IDs without changing coverage or runtime behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5b8438f
into
Azure:release/1.1.0-preview
Azure SRE Agent - automated reviewReviewing One commit, one file — azext_iot/tests/adr/test_adr_link_delete_unit.py. It gives the accepted and rejected entity-tag cases explicit pytest IDs and hoists the character-boundary tag into a named constant, answering Yuelin Zhao (@cheatsheet1999)'s inline note that the raw values were hard to read. No product code changed. Blocking None. Verified — the commit message's "without changing coverage" claim holds I checked this mechanically rather than by eye, since the values are mostly escape sequences. Parsing both revisions of the file and comparing every The extracted constant is also faithful. Spot-checking the rejection IDs against their values, they are all correct rather than approximate — Suggestions None for this increment. Nits None. Summary Clean readability-only change; the no-coverage-change claim is verified rather than taken on trust. Nothing to act on here. The two residuals from my previous review are untouched by this commit and still stand on the product code: the ETag is still captured before This is an automated review and may be incomplete; please verify findings before acting on them. |


Change
Protect
az iot adr ns link hub|dps|su removeagainst concurrent namespace updates. Capture the ETag from the GET response header and send it asIf-Matchon the replacement PUT. Missing or unusable ETags stop removal before RBAC changes or writes. A conflict returns the original HTTP 412 without retrying; rerun the command to re-read and revalidate the namespace. Existing no-wait behavior is unchanged.Evidence
2026-11-02-preview: matching ETag accepted, stale ETag rejected with HTTP 412, concurrent changes preserved. Disposable probe resources were deleted.Same protection is being applied to #906; GA deployment has not been live-validated.