Skip to content

fix(frontend): base v2 verified badge on real DB hash matches#3815

Merged
gantoine merged 3 commits into
masterfrom
fix/verified-badge-hash-match
Jul 18, 2026
Merged

fix(frontend): base v2 verified badge on real DB hash matches#3815
gantoine merged 3 commits into
masterfrom
fix/verified-badge-hash-match

Conversation

@gantoine

Copy link
Copy Markdown
Member

Description
Explain the changes or enhancements you are proposing with this pull request.

Fixes #3806
Fixes #3807

The v2 game-details "Verified ROM" badge was gated on crc_hash being present:

const verified = computed(() => Boolean(currentRom.value?.crc_hash));

A crc_hash (and md5/sha1) is computed for essentially every ROM, so the badge appeared on ROMs that never matched any hash database, e.g. the 7z-compressed Astro Boy GBA ROM in #3806 (which fails to match because of the separate archive-hashing bug #3808, but was still shown as verified).

What changed

  • New frontend/src/v2/utils/romVerification.ts — single source of truth for what "verified" means, mirroring the backend's _filter_by_verified (roms_handler.py). A ROM is verified only when a Hasheous signature match flag is set. Exports VERIFICATION_DATABASES, VERIFICATION_KEYS, matchesDatabase(), and isRomVerified().
  • GameDetails.vue — the header badge now derives from isRomVerified(currentRom) instead of crc_hash.
  • MetadataTab.vue — the per-database chips are now driven by the shared VERIFICATION_DATABASES, so the badge, the chip list, and the backend filter can't drift apart. Fixes the RetroAchievements chip to use ra_match (an actual hash match) instead of ra_id (mere metadata linkage), and adds the previously-missing WHDLoad / PureDOS databases.
  • Clarify the badge ([UI/UX] Clarify "verified ROM" status #3807) — the header tooltip now explains what "verified" means (a database hash match via Hasheous / RetroAchievements) via a new rom.verified-rom-hint key added to all 18 locales (translated for en/fr/es/it/pt/de, English placeholder elsewhere). The short "Verified ROM" label is kept as the icon's aria-label.

Note: this is the display/clarity fix. The underlying "7z hashing hashes the archive instead of the ROM" problem is tracked separately in #3808 (backend rahasher.py).

AI assistance disclosure
Per CONTRIBUTING.md.

This PR was written with AI assistance (Claude Code). All changes were reviewed by the author.

Checklist
Please check all that apply.

  • I've tested the changes locally
  • I've updated relevant comments
  • I've assigned reviewers for this PR
  • I've added unit tests that cover the changes

Screenshots (if applicable)

N/A

Verification

  • romVerification.test.ts: 6 unit tests (no-metadata, hashed-but-unmatched, per-key match, MAME arcade/mess, RA via ra_match, keys-are-flattened) — pass.
  • npm run typecheck: clean.
  • check_i18n_locales.py + check_i18n_sorted.py: pass.
  • trunk fmt + trunk check on all touched files: no issues.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 18, 2026 23:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps

greptile-apps Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR bases the verified-ROM UI on actual database hash matches. The main changes are:

  • Adds a shared definition of verification databases and match flags.
  • Uses that definition for the game header badge and metadata chips.
  • Corrects RetroAchievements matching and adds WHDLoad and PureDOS.
  • Adds explanatory tooltip text to all supported locales.

Confidence Score: 4/5

The verified badge tooltip needs a keyboard-accessibility fix before merging.

  • The frontend verification keys match the backend filter and API schema.
  • Missing, partial, and false-valued metadata is handled correctly.
  • The tooltip activator cannot receive focus, so keyboard users cannot open it.

frontend/src/v2/components/GameDetails/GameHeader.vue

Important Files Changed

Filename Overview
frontend/src/v2/utils/romVerification.ts Adds shared verification helpers whose match keys align with the backend filter and generated API schema.
frontend/src/v2/components/GameDetails/MetadataTab.vue Moves database chips to the shared definitions and corrects the displayed database match sources.
frontend/src/v2/views/GameDetails.vue Changes the header badge to require an actual database hash match.
frontend/src/v2/components/GameDetails/GameHeader.vue Adds the explanatory tooltip, but leaves its parent activator unreachable by keyboard.
frontend/src/v2/utils/romVerification.test.ts Covers missing and unmatched metadata, every configured flag, MAME variants, and RetroAchievements semantics.

Fix All in Claude Code

Reviews (1): Last reviewed commit: "fix(frontend): base v2 verified badge on..." | Re-trigger Greptile

Comment thread frontend/src/v2/components/GameDetails/GameHeader.vue
@gantoine
gantoine force-pushed the fix/verified-badge-hash-match branch from b186e00 to 7eb8929 Compare July 18, 2026 23:53
The v2 details "Verified ROM" badge was gated on `crc_hash` being
present, but a hash is computed for essentially every ROM (including
compressed archives that never matched any database). This made the
badge appear on unverified ROMs (#3806).

Introduce `romVerification` as the single source of truth, mirroring
the backend's `_filter_by_verified`: a ROM is verified only when a
Hasheous signature match flag is set. Drive the header badge, the
Metadata-tab per-database chips, and (fixed) the RetroAchievements chip
(`ra_match`, not `ra_id`) from the same shared list, and add the
previously missing WHDLoad / PureDOS databases.

Also clarify what the badge means (#3807): the header tooltip now spells
out that it is a database hash match (Hasheous / RetroAchievements), with
the short label kept as the icon's accessible name.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gantoine
gantoine force-pushed the fix/verified-badge-hash-match branch from 7eb8929 to 5a44db1 Compare July 18, 2026 23:53
gantoine and others added 2 commits July 18, 2026 19:53
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Use the generated SimpleRom type for the verification helpers instead of
an ad-hoc structural type.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gantoine
gantoine merged commit b8d6ec2 into master Jul 18, 2026
12 checks passed
@gantoine
gantoine deleted the fix/verified-badge-hash-match branch July 18, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI/UX] Clarify "verified ROM" status [Bug] Verified ROM checkmark shows on non hash matched roms

2 participants