Repository navigation
fix(trust-pack): translate policy reasons, SIEM status, and OWASP note to ja - #266
Merged
Merged
Conversation
…e to ja trust-pack claims Japanese output as a differentiator (ROADMAP.md), but three pieces of the generated pack were English regardless of --lang ja: - The policy snapshot's human-readable table showed all 16 default rules' `reason` in English, because aigis.policy.default_policy() hardcodes them and _policy_snapshot() never translated the lookup. Added a rule-id -> Japanese-reason dict in trust_pack.py; the literal YAML further down the same section is intentionally left untranslated, since it claims to be the actual file under version control. - "SIEM forwarding: not detected (forwarders are configured in code; see docs/forwarders.md)" leaked verbatim into ja output in three places (executive summary, audit log evidence x2), because _detect_siem_forwarder() returned a pre-built English sentence. Changed it to return bare facts (env var value / file path, or empty) and added _siem_status_text(lang) to render the sentence per language. - The weekly-report control's OWASP column read "— (cross-cutting; not an OWASP risk category)" in the ja control matrix. Moved that explanation into what_it_does/what_it_does_ja (which already had a ja variant) and simplified owasp_llm to "—". Also fixes two unrelated bugs found while reading this code: - `aigis.__version__` was "1.2.0", untouched since the v1.2.0 release (#228) — the v2.0.0 and v2.0.1 releases both missed updating it while pyproject.toml moved on. This surfaced directly in trust-pack's "Aigis vX.Y.Z" line and the policy YAML's "Generated by" comment, and in `aigis --version`. Bumped to 2.0.1 and added a regression test that compares it against pyproject.toml on every run. - `save_policy()` hardcoded "Generated by Aigis v0.3.0" in the YAML header; now reads `__version__`. Also joins two lines in the audit-log-evidence template (en and ja) that were split mid-sentence in the source, producing an odd hard line break in the rendered Markdown. Regenerated docs/sample-trust-pack/ end to end with the fixed code so the committed sample matches what `aigis trust-pack` actually produces today. Tests: 1786 passed (was 1781; +5 in test_trust_pack.py, +1 new test_version.py), ruff check clean, ruff format clean. Signed-off-by: killertcell428 <killertcell428@gmail.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.
Why
ROADMAP.md names Japanese-language output as one of the two things that actually differentiate Aigis (the other is
trust-packitself — see #265). Reading the generated pack end to end found it wasn't fully true: three pieces stayed in English regardless of--lang ja.What was broken
aigis/policy.py'sdefault_policy()hardcodes Englishreasonstrings;_policy_snapshot()never translated them_detect_siem_forwarder()returned a pre-built English sentence, not a factFix
trust_pack.py, looked up by_policy_snapshot()forlang="ja". A rule id not in the dict (i.e. a user-authored rule) falls back to its ownreasonunchanged. The literal YAML further down the same section is deliberately left untranslated — it claims to be the actual file under version control, and translating it would make the doc lie about what's on disk._detect_siem_forwarder()now returns bare facts (an env var value, a file path, or empty) instead of a finished sentence; new_siem_status_text(configured, detail, lang)renders the line per language. Applied at all 4 call sites (2 en, 2 ja — the en ones were already correct but now share the same function instead of a separate hardcoded string).what_it_does/what_it_does_ja(which already had a ja variant) and simplifiedowasp_llmto"—".Also fixed (found while reading this code, unrelated but real)
aigis.__version__was"1.2.0", untouched since the v1.2.0 release (release: v1.2.0 — 4 new detectors + trust-pack/audit CLI rollup #228) — both v2.0.0 and v2.0.1 missed updating it whilepyproject.tomlmoved on. This surfaced directly inaigis --versionand in trust-pack's own "Aigis vX.Y.Z" line and the policy YAML's "Generated by" comment. Bumped to2.0.1; addedtests/test_version.pycomparing it topyproject.tomlon every run so this can't silently drift again.save_policy()hardcoded"Generated by Aigis v0.3.0"; now reads__version__.docs/sample-trust-pack/
Regenerated end to end with the fixed code (
aigis init --agent claude-code --signed-audit && aigis trust-pack --lang both --org "Example Corp(サンプル株式会社)" --contact security@example.com, plus the HTML build) so the committed sample matches what the tool produces today, not a snapshot from v1.2.0.Test plan
pytest tests/— 1786 passed (was 1781; +5 intest_trust_pack.py, +1test_version.py)ruff check/ruff format --checkclean.ja.mdfiles (still present, correctly, in the literal YAML block)