Repository navigation
fix(audit): interpret duplicate HTML image attributes with first-value semantics - #210
Conversation
drevendev
left a comment
There was a problem hiding this comment.
Exact-head content review — COMMENT (self-authored PR)
Reviewed HEAD: aa7cbe059f74d0ac4902215b89aed40ec58440e6 (BeautifulRepo PR #210).
I inspected the complete four-file diff, the repository's review/contributor/security contracts, the audit implementation and related tests. The implementation uses the first HTMLParser attribute value, warns on duplicated image attributes of interest, and reuses those admitted values for alt/name classification and raw asset detection. The three new regressions check opposing alt order, role/ARIA cases and opposing source order. No blocking implementation defect found in this bounded source review.
One concrete guide correction: In guides/repository-audit.md under Image alternatives, the new inline-code examples are written as alt=\\"Description\\" and alt=\\"\\" (with literal backslashes). Markdown code spans preserve the backslashes. A standalone Python standard-library HTMLParser probe confirmed that <img alt=\\"\\"> yields a nonempty backslash/quote-containing alt value, not the empty alt="" value the example intends. Please remove the backslashes in both inline-code examples. This is a reader-facing example defect, not a blocker of the corrected first-value algorithm.
Verification: Exact-head Quality checks completed successfully, six of six jobs including Windows; the Python 3.11 CI log reports 483 passed tests and the self-audit reports zero findings. I inspected source and CI logs, and ran only the isolated stdlib parsing probe—not the repository tests locally. This does not certify browser rendering or screen-reader behavior.
Acceptance boundary: The authenticated GitHub actor is drevendev, also the PR author. This COMMENT is a scoped content judgement, not independent reviewer approval or proof of any provider-enforced acceptance gate.
andy-zen-dev
left a comment
There was a problem hiding this comment.
Independent exact-head review — aa7cbe059f74d0ac4902215b89aed40ec58440e6 (PR #210).
Verdict: APPROVE for the bounded offline-audit fix. I reviewed all four changed files and surrounding _HTMLFacts, _absolute_image_findings, and _inspect_markdown logic, the three new behavioral regressions, the audit guide, the changelog, AGENTS.md/CONTRIBUTING.md, and the existing self-authored COMMENT review. No merge-blocking defect found.
The previous dict(attrs) retained the last repeated HTML attribute while HTML parsing uses the first. The replacement preserves the first occurrence, warns on repeated image alt/src/role/selected ARIA attributes, and passes those same admitted attributes to the existing image-naming and remote-source checks. The new tests cover both alt-order cases, role/ARIA precedence, and remote-first/local-first source precedence. An independent Python standard-library HTMLParser probe confirmed that duplicate image attrs arrive in order, including lower-cased duplicates, and that the guide's backslash-escaped quote example would parse differently from the intended empty attribute.
Nonblocking documentation follow-up (already reported in the author COMMENT): In guides/repository-audit.md, the inline examples alt=\\\"Description\\\" and alt=\\\"\\\" contain literal backslashes. Please use alt="Description" and alt="" for accurate copyable HTML examples. This does not affect the checker or the new tests and needs no duplicate issue/comment.
Exact-head CI: Quality checks 41155372331 completed successfully: six of six jobs (Python 3.11/3.14, Windows, both Action self-tests, lint). Independent local repository suite: NOT RUN; only the isolated stdlib parser probe was executed. This source-checker review does not certify browser rendering or assistive-technology behavior.
Reader problem
The offline repository-entry audit used
dict(attrs)for raw HTML images. Python'sHTMLParserexposes repeated attributes as pairs, but converting them to a dict silently keeps the last occurrence. HTML parsing keeps the first. A README could therefore appear to have meaningful image alt text when its first alt is empty, or be flagged as empty when the first alt was actually meaningful. Duplicated image sources could likewise hide a remote-image dependency.Bounded repair
<img>attribute, matching the HTML Standard's duplicate-attribute handling.image.duplicate_attributewarnings for duplicatedalt,src,role,aria-label,aria-labelledby, andaria-hidden.srcprecedence.Verification
master: exactly four files changed, five commits ahead, zero behind as prepared.HTMLParserduplicate-pair behavior in a small standalone probe. Repository-wide suite not run locally; verify current PR CI at exact HEAD before acceptance.This fixes source-inspection fidelity, not full HTML parsing, rendered accessibility, or screen-reader conformance. Related to existing audit unit BR-AUDIT-011 and visual-accessibility #16; it does not close #16.