Skip to content

feat(plugin): add local Lua tests and hook debugging - #708

Merged
aooohan merged 1 commit into
mainfrom
codex/plugin-test-run
Sep 12, 2026
Merged

aooohan merged 1 commit into
mainfrom
codex/plugin-test-run

Conversation

@aooohan

@aooohan aooohan commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Adds vfox plugin test and vfox plugin run so plugin authors can test a local checkout and inspect typed hook results without registering a plugin or initializing SDK state.

Tests use ordinary Lua assertions, one VM per file, offline HTTP fixtures, environment/platform overrides and Lua/HTTP deadlines. The hook bridge supports all hooks and preserves production loading and codecs. Invalid plugin/hook/result types now report errors, and PreUse registration uses the correct case. Includes a sample plugin and English/Chinese documentation.

Validation: local full suite with CI=true, focused development tests with the race detector, native build, Linux/Windows cross-compilation, and VitePress build passed. GitHub CI and E2E passed on Linux, macOS and Windows for commit 581f43d; Fish completion, Windows shell/install regressions, and Codecov checks also passed.

CI: https://github.com/version-fox/vfox/actions/runs/34683389180
E2E: https://github.com/version-fox/vfox/actions/runs/34683389184

Copilot AI lite review requested due to automatic review settings September 12, 2026 08:29
@codecov

codecov Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.44444% with 287 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.09%. Comparing base (70d41d5) to head (581f43d).

Files with missing lines Patch % Lines
internal/plugin_development.go 0.00% 84 Missing ⚠️
internal/plugin/luai/codec/decode.go 34.25% 61 Missing and 10 partials ⚠️
internal/plugin/development.go 79.21% 21 Missing and 16 partials ⚠️
cmd/commands/plugin.go 0.00% 35 Missing ⚠️
internal/plugin/development_output.go 76.40% 14 Missing and 7 partials ⚠️
internal/plugin/development_http.go 77.77% 6 Missing and 6 partials ⚠️
internal/plugin/luai/module/http/http.go 64.00% 7 Missing and 2 partials ⚠️
internal/plugin/lua_plugin.go 76.47% 6 Missing and 2 partials ⚠️
internal/plugin/luai/vm.go 0.00% 8 Missing ⚠️
internal/plugin/luai/module/module.go 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #708      +/-   ##
==========================================
+ Coverage   32.03%   35.09%   +3.05%     
==========================================
  Files          87       92       +5     
  Lines        6006     6514     +508     
==========================================
+ Hits         1924     2286     +362     
- Misses       3819     3922     +103     
- Partials      263      306      +43     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aooohan
aooohan merged commit b5a19ae into main Sep 12, 2026
11 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The changes span plugin loading, Lua execution, HTTP handling, CLI behavior, and cross-platform workflows, warranting final human review.

Pull request overview

Adds local Lua plugin testing and hook debugging via vfox plugin test and vfox plugin run, with isolated VMs, fixtures, deadlines, validation, and bilingual documentation.

Changes:

  • Adds plugin test/run CLI workflows.
  • Improves Lua hook loading and typed codec handling.
  • Adds HTTP fixtures, output capture, deadlines, and isolation.
  • Adds regression tests, sample plugins, and documentation.
File summaries
File Summary
internal/plugin/plugin.go Fixes hook registration and cleanup.
internal/plugin/luai/vm.go Validates hooks and preserves typed results.
internal/plugin/luai/module/module.go Adds HTTP and output configuration.
internal/plugin/luai/module/http/http.go Adds contextual requests and output routing.
internal/plugin/luai/codec/encode.go Supports embedded field encoding.
internal/plugin/luai/codec/decode.go Adds strict typed decoding.
internal/plugin/luai/codec/decode_test.go Tests codec behavior and regressions.
internal/plugin/lua_plugin.go Improves loading and hook result handling.
internal/plugin/loading_regression_test.go Tests malformed plugins and registration.
internal/plugin/development.go Implements isolated Lua development execution.
internal/plugin/development_test.go Tests hooks, HTTP, isolation, output, and deadlines.
internal/plugin/development_output.go Handles diagnostics and process execution.
internal/plugin/development_http.go Implements offline fixture HTTP transport.
internal/plugin_development.go Orchestrates plugin test/run operations.
examples/plugins/sample/tests/windows_test.lua Adds platform override coverage.
examples/plugins/sample/tests/fixtures/releases.json Provides HTTP fixture data.
examples/plugins/sample/tests/available_test.lua Adds sample hook tests.
examples/plugins/sample/README.md Documents sample usage.
examples/plugins/sample/main.lua Provides the sample plugin implementation.
docs/zh-hans/plugins/create/testing.md Adds the Chinese testing guide.
docs/zh-hans/plugins/create/howto.md Updates Chinese plugin guidance.
docs/plugins/create/testing.md Adds the English testing guide.
docs/plugins/create/howto.md Updates English plugin guidance.
docs/.vitepress/zh.ts Adds Chinese documentation navigation.
docs/.vitepress/en.ts Adds English documentation navigation.
cmd/plugin_test.go Adds CLI integration tests.
cmd/commands/plugin.go Registers plugin test/run commands.
cmd/cmd.go Registers plugins and routes errors to stderr.
Review details
  • Files reviewed: 28/28 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants