Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
エラーログのマスキングの仕組みづくりに役立ったASTの話
Search
Kenichi Shihota
February 24, 2026
Programming
0
110
エラーログのマスキングの仕組みづくりに役立ったASTの話
ASTを活用し、エラーマスキング解除の漏れを警告するLinterを実装した事例を紹介しています。
Kenichi Shihota
February 24, 2026
Tweet
Share
Other Decks in Programming
See All in Programming
nuget-server - あなたが必要だったNuGetサーバー
kekyo
PRO
0
150
JPUG勉強会 OSSデータベースの内部構造を理解しよう
oga5
2
230
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
240
AI活用のコスパを最大化する方法
ochtum
0
120
「やめとこ」がなくなった — 1月にZennを始めて22本書いた AI共創開発のリアル
atani14
0
350
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
300
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
680
atmaCup #23でAIコーディングを活用した話
ml_bear
4
730
要求定義・仕様記述・設計・検証の手引き - 理論から学ぶ明確で統一された成果物定義
orgachem
PRO
21
10k
AIプロダクト時代のQAエンジニアに求められること
imtnd
2
660
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
4
380
ご飯食べながらエージェントが開発できる。そう、Agentic Engineeringならね。
yokomachi
1
280
Featured
See All Featured
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
130
Thoughts on Productivity
jonyablonski
75
5.1k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
240
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
[SF Ruby Conf 2025] Rails X
palkan
2
810
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.7k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
210
WENDY [Excerpt]
tessaabrams
9
36k
Transcript
エラーログのマスキングの仕組みづくりに 役⽴ったASTの話
⾃⼰紹介 Kumoichi14 経歴: 新卒1年⽬ 職種: バックエンドエンジニア 趣味: スマブラ(⼤乱闘)
プレゼンテーション構成 ‧マスキングを導⼊したことにより出てきた課題 ‧課題解決にASTがどう役⽴ったか ‧マスキングとマスキング解除の挙動の紹介 はじまり
1. コード上での呼び出し 2. ログへの出⼒結果 ※変数 title の値が⾃動的に検知‧加⼯されます。 errorsx.Errorf(“invalid title: %s”,
title) invalid title: ***** マスキングの挙動例 string, struct など
1. コード上での呼び出し 2. ログへの出⼒結果 errorsx.Errorf(“invalid title: %s”, mask.WithoutMasking(title)) invalid title:
GolangTokyo マスキングの対象外とする挙動例
なぜマスキングされる型に対して、マスキング対象外と する関数を毎回つけるのか
この「付与忘れ」を仕組みで防ぎたかった マスキング対象外とする関数(withoutMasking) をつけ忘れる可能性があった 課題
ASTを活用してLinterを作れば、特定の関数の付与のし 忘れなどを検知できると知った
コードを「情報のツリー」として捉える ソースコードを単なる⽂字列ではなく、コンピューターが理解 できる階層構造(⽊構造)に変換したものです。 • 役割の明確化: パッケージ名、関数名、引数、リテラル値などを、 意味を持つ最小単位(ノード)として個別に識別。 AST(抽象構⽂⽊)とは
CallExpr 関数呼び出し全体 FUN(SelectorExpr) 呼び出す対象 X(Ident) 受信者 / 左側 SEL(Ident) 選択子
/ 右側 Arg([]AST.Expr) 引数リスト Arg[0](BasicLit) リテラル値 Arg[1](Ident) 変数 errorsx.Errorf(“invalid title: %s”, title) errorsx.Errorf errorsx Errorf “invalid title: %s“ title ["invalid title: %s", title] errorsx.Errorf(“invalid title: %s”, title)
コードの差分を取得 ① パッケージ名がerrorsxを含むものがあるかを確かめる ② 関数名がErrofであることを確かめる ③ 変数(title)がWithoutMasking付与対象内の型であることを確かめる ここまで確認が取れたら、警告を出す mask.WithoutMasking()つけ忘れ検知の流れ
CallExpr 関数呼び出し全体 FUN(SelectorExpr) 呼び出す対象 SEL(IDENT) 選択子 Arg([]AST.EXPR) 引数リスト Arg[0](BASICLIT) リテラル値
Arg[1](IDENT) 変数 errorsx.Errorf(“invalid title: %s”, title) errorsx.Errorf Errorf “invalid title: %s“ title ["invalid title: %s", title] X(Ident) 受信者 / 左側 SEL(Ident) 選択子 / 右側 errorsx Errorf “errorsx”であることを確認
CallExpr 関数呼び出し全体 FUN(SelectorExpr) 呼び出す対象 Arg([]AST.EXPR) 引数リスト Arg[0](BASICLIT) リテラル値 Arg[1](IDENT) 変数
errorsx.Errorf(“invalid title: %s”, title) errorsx.Errorf Errorf “invalid title: %s“ title ["invalid title: %s", title] “Errorf”であることを確認 X(Ident) 受信者 / 左側 SEL(Ident) 選択子 / 右側 errorsx Errorf
CallExpr 関数呼び出し全体 FUN(SelectorExpr) 呼び出す対象 Arg([]AST.EXPR) 引数リスト Arg[0](BASICLIT) リテラル値 Arg[1](IDENT) 変数
errorsx.Errorf(“invalid title: %s”, title) errorsx.Errorf “invalid title: %s“ title ["invalid title: %s", title] titleがマスキング対象内の型であるこ とを確認(analysis.Pass.TypesInfoが型 情報を持っている) titleの型はstringであるので マスキング対象内の型 X(Ident) 受信者 / 左側 SEL(Ident) 選択子 / 右側 errorsx Errorf
Linterでの関数付与忘れの検知 errorsx.Errorf(“invalid title: %s”, title) ASTを利用した検知の仕組み エラーログに出していい値なことを確認したうえで、 mask.WithoutMaskingを付与してください
学び
ご静聴ありがとうございました