Skip to content

feat: add Checker and Shipper interfaces, update README, and implement tests - #12

Merged
kazeburo merged 6 commits into
mainfrom
feat/check-and-ship
Aug 15, 2026
Merged

feat: add Checker and Shipper interfaces, update README, and implement tests#12
kazeburo merged 6 commits into
mainfrom
feat/check-and-ship

Conversation

@kazeburo

@kazeburo kazeburo commented Aug 15, 2026

Copy link
Copy Markdown
Member

PR Type

Enhancement, Tests, Documentation


Description

  • Add Checker and Shipper execution modes

  • Genericize Runner[T] message handling

  • Share flag parsing and configuration construction

  • Document APIs and test all modes


Diagram Walkthrough

flowchart LR
  CLI["CLI arguments"] 
  Parser["Shared flag parser"]
  Runner["Runner[T]"]
  Checker["Checker"]
  Shipper["Shipper"]
  Output["Exit code and output"]
  CLI -- "parse" --> Parser
  Parser -- "execute" --> Runner
  Parser -- "execute" --> Checker
  Parser -- "execute" --> Shipper
  Runner -- "return message and status" --> Output
  Checker -- "map checker status" --> Output
  Shipper -- "return OK after side effect" --> Output
Loading

File Walkthrough

Relevant files
Enhancement
flagrun.go
Add generic runner, checker, and shipper APIs                       

flagrun.go

  • Make Runner generic through Runner[T].
  • Add Checker and Shipper interfaces with Check and Ship entry points.
  • Centralize Flagrun setup and command-line argument parsing.
  • Map checkers.Checker statuses to plugin exit codes and handle nil
    results.
+110/-27
Tests
flagrun_check_test.go
Test checker execution and status mapping                               

flagrun_check_test.go

  • Add table-driven tests for all checker statuses.
  • Cover checker help, version, and public Check behavior.
  • Verify checker messages and mapped exit codes.
+112/-0 
flagrun_go_test.go
Update generic runner execution tests                                       

flagrun_go_test.go

  • Update runner tests for generic internalGo setup.
  • Add coverage for runners returning arbitrary message types.
  • Verify error messages are formatted into output strings.
+54/-6   
flagrun_shipper_test.go
Test shipper execution and CLI handling                                   

flagrun_shipper_test.go

  • Add tests confirming shipper execution side effects.
  • Cover help and version paths without invoking the shipper.
  • Verify public Ship returns OK.
+65/-0   
Documentation
README.md
Document runner checker and shipper usage                               

README.md

  • Document Runner[T], Checker, and Shipper interfaces.
  • Add usage examples for Check and Ship.
  • Clarify output behavior and shared options across entry points.
+74/-5   
Dependencies
go.mod
Add Mackerel checker dependency                                                   

go.mod

  • Add github.com/mackerelio/checkers dependency.
+1/-0     

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

(Review updated until commit 9217c3b)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing import

The new Checker example calls os.Exit but does not import os, so users cannot compile it as shown. The same omission exists in the new Shipper example.

import (
    "github.com/mackerelio/checkers"
    "github.com/monitoring-forge/flagrun"
)

Comment thread flagrun.go
Comment thread flagrun.go Outdated
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 763d846

Comment thread flagrun.go Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit a1efaf4

Comment thread flagrun.go Outdated
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit d6d0b1e

@github-actions

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 9217c3b

Comment thread README.md
@kazeburo
kazeburo merged commit e399e39 into main Aug 15, 2026
3 checks passed
@kazeburo
kazeburo deleted the feat/check-and-ship branch August 15, 2026 15:02
@github-actions github-actions Bot mentioned this pull request Aug 15, 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