Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

OCSF shorthand renders Unknown and Other severities as [INFO]

オープン 初心者向け
#3,886 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
observability

調査の方向性

crates/openshell-ocsf/src/format/shorthand.rs の severity_tag から始め、severity_char およびそこにあるテストと比較してください。crates/openshell-ocsf/src/enums/severity.rs を読み、その後 cargo test -p openshell-ocsf を実行してください。完了条件は、0..=6 と 99 のマッピング全体がカバーされ、Unknown と Other が Informational と区別され、関連するヘルパー関数と一貫していることです。

索引モデルが issue の本文から書いたものです。

説明

state:triage-needed

OCSF shorthand renders Unknown and Other severities as [INFO]

User Story

As someone reading sandbox OCSF audit logs in openshell.log or a gRPC log push, I want the severity tag on each line to reflect the event's actual severity, so that an event of unclassified severity is distinguishable from one deliberately marked informational.

Problem Statement

severity_tag in crates/openshell-ocsf/src/format/shorthand.rs maps only 2..=6 explicitly and sends every other value to a _ => "[INFO]" arm:

pub fn severity_tag(severity_id: u8) -> &'static str {
    match severity_id {
        2 => "[LOW]",
        3 => "[MED]",
        4 => "[HIGH]",
        5 => "[CRIT]",
        6 => "[FATAL]",
        _ => "[INFO]",
    }
}

SeverityId has two members outside 2..=6 that are real, serializable values: Unknown = 0 and Other = 99 (crates/openshell-ocsf/src/enums/severity.rs). Both land in the _ arm, so they render as [INFO] — the same tag as SeverityId::Informational = 1, which is the default severity for most builders (api_activity, base, config, http, lifecycle, network, process, ssh all default to SeverityId::Informational).

The two sibling helpers in the same module already disagree with this. severity_char (line 27) maps both 0 and 99 to ' ', and its test test_severity_char_mapping asserts exactly that. SeverityId::shorthand_char in the enum also returns ' ' for both. severity_tag is the one that is actually used for rendering (format_shorthand, line 202), and it is the one that is wrong.

Impact / Why This Matters

[INFO] is the most common tag in the log, so folding two distinct severities into it makes an unclassified event indistinguishable from an informational one. For an audit trail this means a line that reads as routine cannot be triaged by severity alone; an operator filtering for non-informational events would not surface it. The full OCSF JSON is still correct — severity_id serializes as 0 or 99 — so this is a display-projection bug, not a data bug, but openshell.log is what most operators read.

There is no workaround today. The only way to recover the real severity is to read the JSONL file rather than the shorthand log.

Acceptance Criteria
  • severity_tag(0) and severity_tag(99) do not return "[INFO]".
  • severity_tag(0) and severity_tag(99) are identical to each other and distinct from severity_tag(1).
  • severity_tag is consistent with severity_char and SeverityId::shorthand_char for the same input.
  • A unit test covers the full 0..=6 plus 99 mapping, not just the 0..=6 range that was already handled.
  • severity_tag(1) through severity_tag(6) are unchanged, so existing log consumers are unaffected.
Reproduction Steps
  1. Build any event whose severity_id is 0 or 99 through the OCSF builders, or call severity_tag directly.
  2. Format it with OcsfEvent::format_shorthand.
  3. Observe the severity tag in the output.
severity_tag(0)  == "[INFO]"   // expected: distinct from Informational
severity_tag(99) == "[INFO]"   // expected: distinct from Informational
severity_tag(1)  == "[INFO]"   // Informational
severity_char(0) == ' '        // Unknown — the two helpers disagree
severity_char(99) == ' '       // Other  — the two helpers disagree
Environment
  • OpenShell: main at commit cf1bbb965
  • OS: Windows 11
  • Toolchain: 1.98.0-x86_64-pc-windows-gnu (the pinned 1.95.0 MSVC toolchain needs link.exe, which is not installed on this machine, so I built with the GNU toolchain for the same x86_64-pc-windows target)
  • No mise run available in this environment, so verification was cargo test -p openshell-ocsf and cargo clippy -p openshell-ocsf --all-targets -- -D warnings rather than mise run pre-commit
Logs

Not applicable — this is a formatting defect, reproducible with a direct unit assertion as shown above.

Notes

I have a branch and a candidate fix ready at aniruddhaadak80:fix/ocsf-severity-tag-unknown (one-line change plus a test), but I am not opening a PR yet because the vouch-check workflow will auto-close it. I would rather ask first.

I picked [UNKN] to match the existing 5-character tags ([INFO], [LOW], [MED], [HIGH]), which keeps the log column alignment. A maintainer may prefer a different spelling, or may prefer severity_tag to derive from SeverityId::shorthand_char / label() so the three helpers cannot drift apart again — I think that is the more durable fix, but it is a larger diff and I did not want to make that call unilaterally.

主要言語
Rust
スター
8.7k
フォーク
1.3k
平均マージ
1日 21時間
マージ済み PR(30日)
344

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NVIDIA/OpenShell のほかの issue

NVIDIA/OpenShell の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。