fix: correct 6 competitive-matrix drift-automation bugs (public-docs safety)#331
Merged
Conversation
commit: |
…safety)
The weekly update-competitive-matrix.ts auto-commits to public docs
(docs/index.html + docs/migrate-from-*/index.html). Six pre-existing bugs
wrote wrong data or silently skipped updates:
1. Migration-page paths pointed at docs/migrate-from-*.html but the pages are
directories (index.html); every migration update was silently skipped.
Fixed paths and added the missing mokksy/ai-mocks mapping.
2. Unanchored keyword regexes flipped cells on substrings ("cli"->"client",
"sse"->"assess"). Added non-alphanumeric boundary lookarounds.
3. countProviders over-counted via substrings ("cohere"->"coherent",
"aws"->"flaws") and a redundant gemini group. Bounded matching + deduped.
4. String.replace let literal dollar sequences in HTML be interpreted. Switched
the HTML-derived replacements to function form so text stays literal.
5. Migration feature-cell updater assumed the competitor was the first data
column while the count updater used header-name lookup. Both now share one
header-name column resolver.
6. Orphaned variant key "Realtime translate/whisper" never matched its rule
"Realtime transcription/translation"; renamed so the rule gets variants.
Tests: converted the pre-existing mirror test file to import the real script
(exports added + import.meta main-guard) and added red-green repros for each
bug plus a regression guard for the OpenRouter router/fallback entry.
jpr5
force-pushed
the
fix/competitive-matrix-bugs
branch
from
July 23, 2026 01:56
28e81b4 to
0d09c50
Compare
jpr5
marked this pull request as ready for review
July 23, 2026 01:59
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.
Why
scripts/update-competitive-matrix.tsruns weekly (.github/workflows/update-competitive-matrix.yml) and auto-commits to public, customer-facing docs (docs/index.htmlanddocs/migrate-from-*/index.html). Six pre-existing bugs (all predate #328) caused it to write wrong data or silently skip updates. This PR fixes all six and adds real red→green regression coverage.#328's single new FEATURE_RULES entry ("OpenRouter router / fallback simulation") and its migration-variant entry are left untouched and are covered by an explicit regression guard.The 6 bugs & fixes
COMPETITOR_MIGRATION_PAGESmapped todocs/migrate-from-*.html, but the pages are directories (.../index.html), soexistsSyncalways failed → every migration-page update silently skipped.mokksy/ai-mockshad no mapping at all./index.html; added themokksy/ai-mocksmapping. (Note:VidaiMockwas already mapped; the genuinely missing competitor wasmokksy/ai-mocks.)cli→"client"/"click",sse→"assess" → false ✗→✓ flips in public docs.keywordRegex()wraps each keyword in non-alphanumeric boundary lookarounds(?<![a-z0-9])…(?![a-z0-9]); works for literal tokens, path/regex keywords, and edge-punctuation keywords alike.countProvidersover-counted via substrings (cohere→"coherent",aws→"flaws") plus a redundantgemini.*interactionsgroup double-counting Gemini.String.replace(pattern, htmlString)let literal$,$&,$1in HTML be interpreted → corrupted/duplicated output (3 sites).(…) => textso replacement text stays literal.findMigrationCompetitorColumn()(token-aware header-name match — avoids the"vidaimock"⊇"aimock"substring trap)."Realtime translate/whisper"never matched its rule label"Realtime transcription/translation"→ that rule got no migration variants, cells never flipped.Tests
A 1168-line
competitive-matrix.test.tsalready existed but reimplemented the script logic inline (a mirror), so it tested copies that mirrored the bugs — it could never catch them. Converted it to import the real script (addedexports + animport.metamain-guard so importing doesn't runmain()), fixed the one assertion that encoded the buggy behavior (countProvidersall-groups14→13), and added red→green repros for each bug plus a regression guard for the OpenRouter entry.Red → Green (fixture-based, no network)
RED — bug repros run against the pre-fix script (enabling refactor only, no behavioral change):
The 13 failures were exactly:
maps every mapped competitor to a file that actually exists on disk;includes a mapping for the mokksy/ai-mocks competitordoes not flip "CLI server" from the words "client"/"click";does not flip "Chat Completions SSE" from the word "assess"does not count "cohere" inside "coherent" or "aws" inside "flaws";counts Gemini exactly once;counts all 13 provider groups …applyChanges does not duplicate the row when replacement text contains $&;updateProviderCounts does not corrupt the table when a cell contains $&flips the competitor cell even when aimock is the first data column;resolves the column when the header text differs from the competitor key (Mokksy)returns variants for the real rule label 'Realtime transcription/translation';flips a migration row that uses a variant label for the realtime rule(The #328 OpenRouter guard tests and the positive-control tests passed in the RED run, as expected.)
GREEN — after the 6 fixes:
Full suite / build / lint (no regressions):
Live end-to-end —
npx tsx scripts/update-competitive-matrix.ts --dry-runagainst real GitHub still firesmain(), parses all 4 competitors + the 38-row / 6-column matrix, and reports "No changes detected" (no spurious flips).Scope / safety
#328's FEATURE_RULES + variant entry unchanged; guarded by regression tests.🤖 Generated with Claude Code
https://claude.ai/code/session_01KamK73Wu5heLxJEogM6hHC