fix(unic-pr-review): stop silently dropping linked Work Items on large PRs#255
Merged
orioltf merged 8 commits intoJun 17, 2026
Conversation
…e PRs discoverWorkItems now takes a workItemRefs array directly (not prMetadata), throws on absent/non-array input, and the ADO Fetcher hoists workItemRefs to a top-level FETCHER_OUTPUT field so it survives inline on large PRs. review-pr.md Step 1.5 treats absent key as a data-loss Notice + continue (third ADR-0004 state), not as a silent empty-WI result. ADR-0010 and ADR-0004 amended; CONTEXT.md Work Item definition updated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Format ADR-0004 markdown with Prettier (CI Biome+Prettier check) - Normalise CRLF→LF in structural test to fix Windows Node test failures Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixes: - Update README.md discoverWorkItems section to new signature (HIGH) - Update ADR-0001 amendment to new discoverWorkItems(workItemRefs) signature (HIGH) - Add per-ref validation (id/url guards) in discoverWorkItems (LOW) - Add CLI integration tests for discover-work-items subcommand (MEDIUM) - Fix inaccurate comment about JSON blocks in contract test (LOW) - Add depth-tracker multi-line assumption comment in contract test (LOW) - Update AGENTS.md ADR-0004 one-liner with lost-in-handoff state (LOW) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
Author
⚡ Self-Fix Report (Aggressive)Status: COMPLETE Fixes Applied (7 total)
View all fixes
Tests Added
Skipped (2)
Validation✅ Type check | ✅ Lint (6 pre-existing infos, 0 errors) | ✅ Tests (705 passed, 6 new) Self-fix by Archon · aggressive mode · fixes pushed to |
Both ado-fetcher describe tests computed extractJsonBlocks + .find identically; extract to a shared const at the describe scope. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The simplify commit wrapped the find() call across multiple lines; Biome's formatter requires it on one line at this width. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Summary review-pr.md Step 1.5 sets NOTICES_CONTEXT.lostInHandoff on the work-item data-loss path, but renderNotices() had no branch for it, so the durable Summary Notice was silently dropped (the early terminal print still fired). Add the render branch + typedef + unit tests so the Notice actually renders at the top of the Review Summary and posts to the PR. Completes AC#5 of #252. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
discoverWorkItems(prMetadata)→discoverWorkItems(workItemRefs): takes the refs array directly, throws on undefined/non-array so data-loss can never collapse into the silent "no Work Items" caseworkItemRefsto a top-levelFETCHER_OUTPUTfield (summary tier, kept inline) instead of burying it inside the largeprMetadatablob that gets abbreviated on big PRsreview-pr.mdStep 1.5 now distinguishes absent key (data-loss → loud Notice + continue) from explicit[](legitimate no-WI → silent)Closes #252
Why
PR #5647 (96 files, ~453 KB diff) had 3 linked Work Items (
42602,42610,42611). The ADO Fetcher fetched them successfully butworkItemRefswas buried inside the largeprMetadatablob. The agent abbreviated the blob to keep its inline return small;workItemRefswas the casualty. The?? []guard then silently collapsed "data lost in transit" into "no Work Items linked", the Intent Check was never spawned, and the review ran with no intent coverage and no warning.Test plan
pnpm --filter unic-pr-review test— 699 tests pass (0 fail)pnpm --filter unic-pr-review typecheck— cleantests/work-item-discovery-contract.test.mjs) verifiesreview-pr.mdpipesworkItemRefs(notprMetadata) todiscover-work-itemsandado-fetcher.mdStep 6 hasworkItemRefsat top-level indentdiscoverWorkItemstests rewritten to refs-array signature; absent-key test flipped from→ []to→ throwsgh pr checks(CI) — to verify after merge🤖 Generated with Claude Code