Use core v0.44.0: closed sets are enums, reasons are coded messages - #171
Merged
Merged
Conversation
- Pin tw-api v0.44.0 and regenerate src/generated/tw-api.ts. - Rust: match on the new enums (L1Step/L1Peer, Protocol, login mode and account family) instead of strings; the listen notice speaks the new gw.listen.nic_offline code. - UI: fields that became Msg (attempt, model-list, probe, sign-in, credential and config-rejected reasons, dry-run rule errors) render through coreText; the local copies of closed sets (guard mode, rule action, content match, condition field, dialect, protocol, on_proxy_fail, proxy kind, billing, login status, group kind...) are replaced by the generated unions, and the as*/is* narrowing helpers they needed are gone. - coreText understands Msg::in_context: the reason is translated by its own code and the context (which upstream's credential, which proxy's password, which Z.ai sign-in step, credential write-back) is put back in front, recognised by the English lead so a reason that carries the same argument itself is not prefixed twice. This replaces inUpstream. - Chinese for every new code in v0.44.0's MSG_CODES (gw.oauth.*, gw.chatgpt.token_*, gw.models.*, gw.probe.*, control.chatgpt_login.*, control.zai_login.*, config.secret.*, config.rotate.*, adopt.diag managed drop-in and GNU sed); retired codes removed. - CI: the Linux job fetches the released twcore like the other jobs instead of building it from the tag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- groupKindLabel, originLabel, stageLabel, takesEffectText, modelSourceLabel, skipLabel and the L1 step/skip labels take the generated unions; their string fallbacks are gone. - coreText no longer carries a copy of the Z.ai sign-in step phrases: that vocabulary is core's to expose, not something to match on here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Pins core v0.44.0 (Core#174, Core#176).
What changed in core
Stringon the wire areslug_enum!enums now (same wire words), exported to TypeScript as string-literal unions.Msg(code + args + English) instead of English sentences.Msg::in_contextkeeps the reason's code and adds the context (upstream / proxy / provider / Z.ai sign-in step) as an argument plus an English lead.{detail}wrappers (gw.credentials.failed,control.credentials_failed,gw.config.proxy_password,l1.config.proxy_password), the hand-written value checks (security.unknown_mode,security.unknown_match,control.unsupported_*,control.unknown_signin_mode,control.unknown_account_family,control.rule.unknown_condition,control.group.unknown_strategy), andgw.listen.nic_no_addr→gw.listen.nic_offline.Here
L1Step/L1Peer,Protocol,ChatgptLoginMode,ZaiFamily); the listen notice speaksgw.listen.nic_offline; the query-string test checks percent-encoding with a hand-written value since the protocol's query fields are all numbers and enums now.asMode/asAction/isGroupKind/isGuardnarrowing helpers they needed. Label functions for closed sets (groupKindLabel,originLabel,stageLabel,takesEffectText,modelSourceLabel,skipLabel, L1 step/skip) take the unions and lose their string fallbacks. Selects narrow by looking the value up in their option list, no casts.RequestRow.secretsitems carry nokind(history rebuilds them from the security log, which has none).Msggoes throughcoreText(config-rejected banner, credential write-back banner, attempt chain, dry-run rule errors, model-list/probe reasons, ChatGPT and Z.ai sign-in errors, OAuth failure). UI-made reasons are wrapped withplain(), as elsewhere. Sentences that append their own full stop to a reason now strip the reason's trailing one.coreTextandin_context: the reason is translated by its own code and the context is put back in front (无法获取上游「官方」的凭据:…,无法读取代理「hk」的密码:…, the credential write-back leads). The context is recognised by the English lead, not by the argument alone, because some reasons carry the same argument themselves (gw.oauth.not_configuredhasupstream) and would otherwise be prefixed twice. Layers nest. This replacesinUpstream, which had exactly that double-prefix problem oncecredential_failedwrapped aconfig.credential.*reason. The Z.ai sign-instepcontext is left alone on purpose: its vocabulary is core's to expose, so in Chinese those reasons show without the step for now.MSG_CODES(gw.oauth.*,gw.chatgpt.token_*,gw.models.*,gw.probe.*,control.chatgpt_login.*,control.zai_login.*,control.provider_test.oauth_unsaved,control.rotation.written,config.secret.*,config.rotate.*,adopt.diag.managed_dropin[.detail],adopt.diag.delete_line_gnu,gw.listen.nic_offline); retired entries removed.tests/msg_codes.rspasses both ways.twcore-{x86_64,aarch64}-unknown-linux-gnu, so the Linux job runsfetch-core.shlike the others instead ofcargo install --git … --tag.Verified
pnpm typecheck,pnpm test,pnpm build,cargo fmt --check, clippy-D warnings,cargo test(incl.msg_codes,ts_bindings, the control-plane seam test against the v0.44.0 twcore).-D warnings,dbus-run-session -- cargo testwith the released aarch64 Linux twcore.🤖 Generated with Claude Code