test(schema): enforce Rust and frontend client parity#380
test(schema): enforce Rust and frontend client parity#380IvGolovach wants to merge 7 commits intojunhoyeo:mainfrom
Conversation
|
@IvGolovach is attempting to deploy a commit to the Inevitable Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
1 issue found across 11 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/tokscale-core/tests/frontend_client_parity.rs">
<violation number="1" location="crates/tokscale-core/tests/frontend_client_parity.rs:151">
P2: The parity test parses `clientRegistry.ts` with a brittle line-based string parser. It only recognizes a closing brace/bracket when it appears as `"\n}"`/`"\n]"` and expects each line to be a simple `key: value` pair, so harmless formatting changes (indentation before the closing brace, inline comments, quoted keys, multiline values) will panic the test and create false CI failures.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
2 issues found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/frontend/src/lib/clientRegistry.ts">
<violation number="1" location="packages/frontend/src/lib/clientRegistry.ts:38">
P2: The registry JSON is cast with `as ClientRegistryData`, so its contents are not validated against the hard-coded ClientType/LegacyClientId unions. If clientRegistry.json adds a new client ID/alias without updating these unions, TypeScript will still accept the JSON and `CLIENT_IDS` will contain values not represented in the union, breaking exhaustiveness checks downstream. Consider validating with `satisfies` or deriving the unions from the JSON so changes cannot bypass type checks.</violation>
</file>
<file name="packages/frontend/src/lib/clientRegistry.json">
<violation number="1" location="packages/frontend/src/lib/clientRegistry.json:62">
P2: Most localSourceLogos paths point to logo files that do not exist in `packages/frontend/public/assets/logos/`, so the UI will render broken images for those clients. Add the missing assets or adjust the paths.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| "synthetic": "https://raw.githubusercontent.com/junhoyeo/tokscale/main/.github/assets/client-synthetic.png" | ||
| }, | ||
| "localSourceLogos": { | ||
| "opencode": "/assets/logos/opencode.png", |
There was a problem hiding this comment.
P2: Most localSourceLogos paths point to logo files that do not exist in packages/frontend/public/assets/logos/, so the UI will render broken images for those clients. Add the missing assets or adjust the paths.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/src/lib/clientRegistry.json, line 62:
<comment>Most localSourceLogos paths point to logo files that do not exist in `packages/frontend/public/assets/logos/`, so the UI will render broken images for those clients. Add the missing assets or adjust the paths.</comment>
<file context>
@@ -0,0 +1,102 @@
+ "synthetic": "https://raw.githubusercontent.com/junhoyeo/tokscale/main/.github/assets/client-synthetic.png"
+ },
+ "localSourceLogos": {
+ "opencode": "/assets/logos/opencode.png",
+ "claude": "/assets/logos/claude.jpg",
+ "codex": "/assets/logos/openai.jpg",
</file context>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary
ClientIdcrushsubmissionsWhy
Tokscale has already hit real submit-path regressions when Rust client support moved ahead of frontend validation and display surfaces. This PR adds a structural guardrail so new or renamed clients cannot be added in Rust without the frontend surfaces being updated in lockstep.
Diff scope
packages/frontend/src/lib/clientRegistry.tsas the single frontend source of truth for supported client IDs, legacy aliases, display names, logos, and colorstokscale-core::ClientIdplus the intentional frontend-onlysyntheticentrycrushto frontend submit/display surfaces so explicit CLI submission paths do not drift from core supportTest proof
cargo test -p tokscale-core467 passed, 0 failed, 1 ignoredcargo test -p tokscale-cli310 passed, 0 failed, 1 ignored74 passed, 0 failedcargo clippy --workspace --all-features -- -D warningsbun x vitest run packages/frontend/__tests__/api/*.test.ts packages/frontend/__tests__/lib/*.test.ts115 passedcargo fmt --all --checkgit diff --checkVerification-pack proof
Not applicable - no infra, governance, or migration verification-pack scope.
Migration notes
Not applicable - no schema or data migration.
CI context confirmation
CI context names unchanged.
Rollback plan
git revert <merge_commit_sha>git revert <squash_commit_sha>Known residual risks
syntheticremains an intentional frontend-only entry and is treated as such by the parity testBlackholeHero.tsxthat was not introduced by this changeRelated