Skip to content

fix(trust-pack): translate policy reasons, SIEM status, and OWASP note to ja - #266

Merged
killertcell428 merged 1 commit into
masterfrom
fix/trust-pack-ja-i18n
Sep 2, 2026
Merged

killertcell428 merged 1 commit into
masterfrom
fix/trust-pack-ja-i18n

Conversation

@killertcell428

Copy link
Copy Markdown
Owner

Why

ROADMAP.md names Japanese-language output as one of the two things that actually differentiate Aigis (the other is trust-pack itself — 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

Section Symptom Cause
03 policy snapshot All 16 default rules' "reason" column shown in English aigis/policy.py's default_policy() hardcodes English reason strings; _policy_snapshot() never translated them
01 / 04 (x3 spots) "SIEM forwarding: not detected (forwarders are configured in code...)" leaked verbatim into ja output _detect_siem_forwarder() returned a pre-built English sentence, not a fact
02 control matrix Weekly-report row's OWASP column read "— (cross-cutting; not an OWASP risk category)" No ja variant existed for that field

Fix

  • Added a rule-id → Japanese-reason dict in trust_pack.py, looked up by _policy_snapshot() for lang="ja". A rule id not in the dict (i.e. a user-authored rule) falls back to its own reason unchanged. 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).
  • Moved the OWASP explanation into what_it_does/what_it_does_ja (which already had a ja variant) and simplified owasp_llm to "—".

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 while pyproject.toml moved on. This surfaced directly in aigis --version and in trust-pack's own "Aigis vX.Y.Z" line and the policy YAML's "Generated by" comment. Bumped to 2.0.1; added tests/test_version.py comparing it to pyproject.toml on every run so this can't silently drift again.
  • save_policy() hardcoded "Generated by Aigis v0.3.0"; now reads __version__.
  • Joined two lines in the audit-log-evidence template (en + ja) that were split mid-sentence in the source, producing an odd hard line break in the rendered Markdown.

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 in test_trust_pack.py, +1 test_version.py)
  • ruff check / ruff format --check clean
  • Regenerated pack manually scanned for the three known leak patterns — 0 hits in .ja.md files (still present, correctly, in the literal YAML block)

…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>
@killertcell428
killertcell428 merged commit 5874cbb into master Sep 2, 2026
14 checks passed
@killertcell428
killertcell428 deleted the fix/trust-pack-ja-i18n branch September 2, 2026 06:26
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