@diegovelasquezweb/a11y-engine 0.11.44 → 0.11.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -671,6 +671,39 @@ export async function applyFindingFix(input) {
|
|
|
671
671
|
|
|
672
672
|
const validation = validateAiPatchOutput(patchOutput, projectDir, candidateSet);
|
|
673
673
|
if (!validation.ok) {
|
|
674
|
+
// When Claude returns no changes, it may be because a prior fix (e.g. the DOM
|
|
675
|
+
// batch) already resolved this issue. Verify by checking if the pattern's
|
|
676
|
+
// context_reject_regex now matches the surroundingLines of the target element.
|
|
677
|
+
// If it does, the element is already accessible — count as resolved.
|
|
678
|
+
if (validation.reason === "AI patch output has no changes") {
|
|
679
|
+
const patternId = finding.pattern_id || finding.patternId || "";
|
|
680
|
+
const patternDef = (ASSETS.remediation.codePatterns?.patterns || [])
|
|
681
|
+
.find((p) => p.id === patternId);
|
|
682
|
+
const rejectRegex = patternDef?.context_reject_regex;
|
|
683
|
+
if (rejectRegex) {
|
|
684
|
+
const context = [aiInput.finding.surroundingLines, aiInput.finding.matchLine]
|
|
685
|
+
.filter(Boolean)
|
|
686
|
+
.join("\n");
|
|
687
|
+
try {
|
|
688
|
+
if (new RegExp(rejectRegex, "i").test(context)) {
|
|
689
|
+
return buildResult({
|
|
690
|
+
applied: true,
|
|
691
|
+
reason: "",
|
|
692
|
+
message: "Already resolved by a prior fix.",
|
|
693
|
+
changedFiles: [],
|
|
694
|
+
patch: "",
|
|
695
|
+
verifyRule: "",
|
|
696
|
+
verifyRoute: "/",
|
|
697
|
+
findingTitle: finding.title || "",
|
|
698
|
+
branchSlug: slugify(`${findingId}-${patternId}`),
|
|
699
|
+
usage: claudeUsage,
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
} catch {
|
|
703
|
+
// Invalid regex in pattern definition — fall through to the error return
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
674
707
|
return buildResult({
|
|
675
708
|
applied: false,
|
|
676
709
|
reason: FIX_ERROR_CODES.PATCH_GENERATION_FAILED,
|