Skip to content

Use core v0.44.0: closed sets are enums, reasons are coded messages - #171

Merged
fylorn merged 2 commits into
devfrom
chore/core-v0.44.0
Sep 24, 2026
Merged

fylorn merged 2 commits into
devfrom
chore/core-v0.44.0

Conversation

@fylorn

@fylorn fylorn commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Pins core v0.44.0 (Core#174, Core#176).

What changed in core

  • Closed sets that were String on the wire are slug_enum! enums now (same wire words), exported to TypeScript as string-literal unions.
  • Attempt, model-list, probe, credential, sign-in and config-rejected reasons are Msg (code + args + English) instead of English sentences. Msg::in_context keeps the reason's code and adds the context (upstream / proxy / provider / Z.ai sign-in step) as an argument plus an English lead.
  • Retired codes: the {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), and gw.listen.nic_no_addr → gw.listen.nic_offline.

Here

  • Rust: match on the enums (L1Step/L1Peer, Protocol, ChatgptLoginMode, ZaiFamily); the listen notice speaks gw.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.
  • UI types: the local copies of closed sets are gone in favour of the generated unions (guard mode, rule action, content match, condition field, dialect, protocol, on_proxy_fail, proxy kind, billing, model source/status, login status, group kind, guard…), along with the asMode/asAction/isGroupKind/isGuard narrowing 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.secrets items carry no kind (history rebuilds them from the security log, which has none).
  • Rendering: every field that became Msg goes through coreText (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 with plain(), as elsewhere. Sentences that append their own full stop to a reason now strip the reason's trailing one.
  • coreText and in_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_configured has upstream) and would otherwise be prefixed twice. Layers nest. This replaces inUpstream, which had exactly that double-prefix problem once credential_failed wrapped a config.credential.* reason. The Z.ai sign-in step context is left alone on purpose: its vocabulary is core's to expose, so in Chinese those reasons show without the step for now.
  • 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.*, 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.rs passes both ways.
  • CI: core now publishes twcore-{x86_64,aarch64}-unknown-linux-gnu, so the Linux job runs fetch-core.sh like the others instead of cargo install --git … --tag.

Verified

  • macOS: 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).
  • Linux (Ubuntu 22.04 container): clippy -D warnings, dbus-run-session -- cargo test with the released aarch64 Linux twcore.
  • Preview harness: the upstream page's model-list reason and probe reason, and a ChatGPT sign-in failure, render in Chinese from their codes.

🤖 Generated with Claude Code

fylorn and others added 2 commits September 24, 2026 19:23
- 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>
@fylorn
fylorn merged commit 9dfce3b into dev Sep 24, 2026
4 checks passed
@fylorn
fylorn deleted the chore/core-v0.44.0 branch September 24, 2026 11:35
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.

1 participant