Skip to content

fix(config): translate the approval card's security note in the zh UI - #857

Merged
gloryfromca merged 3 commits into
EverMind-AI:mainfrom
yudongyouqing:fix/zh_sensitive_notes
Oct 10, 2026
Merged

gloryfromca merged 3 commits into
EverMind-AI:mainfrom
yudongyouqing:fix/zh_sensitive_notes

Conversation

@yudongyouqing

Copy link
Copy Markdown
Contributor

Summary

  • change_view now sends sensitive_key (the path a reason belongs to) beside the English sensitive sentence, so the card can translate the note; the sentence itself stays untouched because raven_config describe shows it to the model.
  • The approval card renders the note through gui.confirm.cfg.why.<path> and falls back to the English sentence when the catalogue has no entry.
  • i18n/messages.json gains every reachable reason (19 catalog settings + 70 channel fields, counting the host's enabled / allow_from / workspace socket fields) in both locales; ui-tui/src/i18n/messages.generated.ts regenerated from it.
  • New tests/test_i18n_sensitive_notes.py walks the catalog and the channel specs and holds the catalogue to them: an entry exists per reason, the en column equals the source sentence, and zh is present, so new reasons cannot regress silently.

Type

  • Fix

Verification

  • Relevant tests pass locally: uv run pytest tests/test_i18n_sensitive_notes.py tests/test_config_self_surface.py -> 105 passed; uv run pytest tests/test_raven_config_tool.py -> 131 passed; npx vitest run src/features/composer/approve.test.ts -> 50 passed
  • Relevant lint / type checks pass locally: ruff check + ruff format --check on the changed files; ty check at the pre-change baseline (18 platform-only diagnostics on Windows); npm run type-check; eslint on the two changed web files; npm run gen:check -> generated.ts matches the contract (205 methods)
  • User-facing docs or screenshots are updated when needed: not needed, catalogue strings only

Risk

  • Security impact considered: only a translated rendering of an existing warning is added; the English sentence remains the fallback and the model-facing copy is untouched
  • Backward compatibility considered: sensitive_key is additive, and a surface that ignores it keeps the previous behaviour
  • Rollback path is clear: plain revert, no data or protocol migration

Related Issues

Fixes #851

@0xKT
0xKT requested a review from gloryfromca October 10, 2026 02:30

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Blocking: accepted camelCase channel paths still leave the zh security note in English.

I reviewed the full diff and the relevant self-configuration, channel normalization, approval-card, and i18n code and history. I also checked AGENTS.md, CONTEXT-MAP.md, the Runtime/Web UI architecture constraints, compatibility with accepted path aliases, and that the added tests were not weakened.

Verification: uv run pytest tests/test_i18n_sensitive_notes.py tests/test_raven_config_tool.py -x (132 passed); npm test -- --run src/features/composer/approve.test.ts in ui-web (50 passed); node scripts/gen-i18n.mjs --check in ui-tui (up to date); uv run python scripts/check_source_language.py github/main...HEAD (passed); git diff --check github/main...HEAD (passed). The focused suites pass but do not exercise an accepted camelCase channel-field spelling.

Comment thread raven/config/self_surface.py Outdated
The zh note catalogue carries its entries under the declared field names,
but the card sent the path as the call spelled it, so an accepted camelCase
alias (channels.discord.gatewayUrl) missed its entry and fell back to the
English sentence, the very symptom the catalogue exists to remove. The card
now resolves the leaf to its declared spelling, for a direct set and for a
field nested in an object set alike, and the regression tests cover an
accepted alias both ways.
A setting under a wildcard pattern carries its zh entry under the pattern
(providers.*.apiBase), but the card sent the key as the instance spelled it
(providers.openai.apiBase), so the lookup missed and the note fell back to
English. The note key now names the declaration itself: a channel field its
declared field, a wildcard setting its pattern.
@yudongyouqing
yudongyouqing force-pushed the fix/zh_sensitive_notes branch from f2cff23 to 0201c8a Compare October 10, 2026 03:11

@gloryfromca gloryfromca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No blockers; this can merge as far as I am concerned.

Reviewed the current revision and confirmed the earlier camelCase channel-path blocker is fixed for direct and object-nested sets. The declared-key normalization also correctly covers wildcard setting instances.

Coverage: AGENTS.md and CONTEXT-MAP.md; the Runtime and Web UI architecture constraints; the full diff and follow-up commits; self-configuration and approval-card callers; relevant history; backward compatibility with runtimes that omit sensitive_key; and whether the tests were weakened. No new findings. The thread I opened is resolved.

Verification: uv run pytest tests/test_i18n_sensitive_notes.py tests/test_raven_config_tool.py tests/test_config_self_surface.py tests/test_permissions_gate.py -x (550 passed); npm test -- --run src/features/composer/approve.test.ts in ui-web (50 passed); node scripts/gen-i18n.mjs --check in ui-tui (up to date); uv run python scripts/check_source_language.py github/main...HEAD (passed); git diff --check github/main...HEAD (passed).

@gloryfromca
gloryfromca merged commit f77d744 into EverMind-AI:main Oct 10, 2026
27 checks passed
LivXue pushed a commit that referenced this pull request Oct 12, 2026
…#857)

## Summary

- `change_view` now sends `sensitive_key` (the path a reason belongs to)
beside the English `sensitive` sentence, so the card can translate the
note; the sentence itself stays untouched because `raven_config
describe` shows it to the model.
- The approval card renders the note through
`gui.confirm.cfg.why.<path>` and falls back to the English sentence when
the catalogue has no entry.
- `i18n/messages.json` gains every reachable reason (19 catalog settings
+ 70 channel fields, counting the host's enabled / allow_from /
workspace socket fields) in both locales;
`ui-tui/src/i18n/messages.generated.ts` regenerated from it.
- New `tests/test_i18n_sensitive_notes.py` walks the catalog and the
channel specs and holds the catalogue to them: an entry exists per
reason, the en column equals the source sentence, and zh is present, so
new reasons cannot regress silently.

## Type

- [x] Fix

## Verification

- [x] Relevant tests pass locally: `uv run pytest
tests/test_i18n_sensitive_notes.py tests/test_config_self_surface.py` ->
105 passed; `uv run pytest tests/test_raven_config_tool.py` -> 131
passed; `npx vitest run src/features/composer/approve.test.ts` -> 50
passed
- [x] Relevant lint / type checks pass locally: `ruff check` + `ruff
format --check` on the changed files; `ty check` at the pre-change
baseline (18 platform-only diagnostics on Windows); `npm run
type-check`; eslint on the two changed web files; `npm run gen:check` ->
generated.ts matches the contract (205 methods)
- [ ] User-facing docs or screenshots are updated when needed: not
needed, catalogue strings only

## Risk

- [x] Security impact considered: only a translated rendering of an
existing warning is added; the English sentence remains the fallback and
the model-facing copy is untouched
- [x] Backward compatibility considered: `sensitive_key` is additive,
and a surface that ignores it keeps the previous behaviour
- [x] Rollback path is clear: plain revert, no data or protocol
migration

## Related Issues

Fixes #851
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.

fix: the config approval card shows its security note in English in the zh UI

2 participants