Skip to content

refactor with using flagrun and saferio - #23

Merged
kazeburo merged 1 commit into
mainfrom
feat/refactor-with-flagrun-saferio
Sep 21, 2026
Merged

kazeburo merged 1 commit into
mainfrom
feat/refactor-with-flagrun-saferio

Conversation

@kazeburo

@kazeburo kazeburo commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

PR Type

Enhancement, Bug fix, Tests, Documentation


Description

  • Adopt flagrun for standardized plugin execution.

  • Use saferio for secure atomic state handling.

  • Reject state-file symlinks without target modification.

  • Expand Japanese usage and metric documentation.


Diagram Walkthrough

flowchart LR
  Runtime["Plugin runtime"] 
  Flagrun["flagrun command runner"]
  Metrics["Mackerel metrics plugin"]
  State["CPU state JSON"]
  Saferio["saferio secure I/O"]
  Runtime -- "delegates execution" --> Flagrun
  Flagrun -- "runs" --> Metrics
  Metrics -- "reads and writes" --> State
  State -- "secured by" --> Saferio
Loading

File Walkthrough

Relevant files
Enhancement
2 files
main.go
Replace custom CLI flow with flagrun                                         
+8/-44   
usageplugin.go
Move plugin methods onto runtime options                                 
+14/-17 
Miscellaneous
2 files
open_unix.go
Remove Unix-specific secure file opener                                   
+0/-15   
open_windows.go
Remove Windows-specific secure file opener                             
+0/-12   
Bug fix
1 files
statsfile.go
Delegate JSON state I/O to saferio                                             
+3/-40   
Tests
2 files
statsfile_test.go
Test legacy state and symlink safety                                         
+46/-19 
usageplugin_test.go
Update metric tests for option receiver                                   
+7/-7     
Configuration changes
1 files
Makefile
Build all Go sources without commit metadata                         
+4/-5     
Documentation
1 files
README.md
Expand Japanese installation and metric documentation       
+128/-30
Dependencies
1 files
go.mod
Add flagrun and saferio dependencies                                         
+4/-1     

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.

@kazeburo
kazeburo merged commit 41836d6 into main Sep 21, 2026
3 checks passed
@kazeburo
kazeburo deleted the feat/refactor-with-flagrun-saferio branch September 21, 2026 02:32
@github-actions github-actions Bot mentioned this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant