[repository-quality] 🎯 Repository Quality Improvement Report - Interface Contract Completeness & Compile-Time Safety Gap #44556
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Analysis Date: 2026-07-09
Focus Area: Interface Contract Completeness & Compile-Time Safety Gap
Strategy Type: Custom
Custom Area: Yes — gh-aw defines 20 public interfaces across
pkg/workflowandpkg/cli, including a compositeCodingAgentEngineinterface with 8 sub-interfaces. Only 1/9 concrete engine types has avar _ CodingAgentEngine = ...compile-time assertion. Silent interface drift on engine structs is the single largest hidden refactoring hazard in this codebase.Executive Summary
gh-aw defines 20 public interfaces, including the composite
CodingAgentEngine(which embeds 8 sub-interfaces:Engine,CapabilityProvider,WorkflowExecutor,MCPConfigProvider,LogParser,SecurityProvider,ModelEnvVarProvider,ConfigRenderer). Nine concrete engine structs implement this interface — but onlyPiEnginehas a compile-timevar _ CodingAgentEngine = NewPiEngine()assertion. The other 8 engines (AntigravityEngine,ClaudeEngine,CopilotEngine,CodexEngine,GeminiEngine,OpenCodeEngine,CrushEngine,UniversalLLMConsumerEngine) are silently assumed to comply. Similarly, optional interfaces (HarnessProvider,AgentFileProvider,LLMProviderResolver) and structural interfaces (ConditionNode,ToolConfig,ValidatableTool) have zero compile-time checks at their implementation sites.Without
var _assertions, adding or modifying an interface method can silently break implementors. The Go compiler only reports the error when the concrete type is assigned to the interface at a call site — often deep in tests or at runtime — rather than at the definition site. With 9 engine implementations and an 8-sub-interface composite, the risk surface is significant: a single missing method rename propagates to 9 compilation errors only discovered at assignment.The pattern is partially understood:
pkg/cli/log_aggregation_test.gohas correctvar _ LogAnalysis = (*DomainAnalysis)(nil)checks forLogAnalysisandMutableLogAnalysis. These assertions should be replicated for all 20 interfaces at their canonical implementation sites.Full Analysis Report
Focus Area: Interface Contract Completeness & Compile-Time Safety Gap
Current State Assessment
Metrics Collected:
CodingAgentEngine)var _ CodingAgentEngine = ...assertionsvar _ HarnessProvider = ...assertionsvar _ AgentFileProvider = ...assertionsvar _ LLMProviderResolver = ...assertionsvar _ ConditionNode = ...assertionsvar _ ToolConfig = ...assertionsvar _ ValidatableTool = ...assertionsvar _ SHAResolver = ...assertionsvar _ FileCreationTracker = ...assertionsvar _ CommandProvider = ...assertionsvar _ LogAnalysis/MutableLogAnalysis = ...in testsFindings
Strengths
pkg/cli/log_aggregation_test.godemonstrates the correct pattern with 4var _assertions forLogAnalysisandMutableLogAnalysisacrossDomainAnalysisandFirewallAnalysis.pkg/workflow/pi_engine_test.go:304hasvar _ CodingAgentEngine = NewPiEngine()as a dedicated test functionTestPiEngine_ImplementsCodingAgentEngine.pkg/workflow/copilot_engine_test.go:2670hasvar _ HarnessProvider = engineinside an existing test case.EngineRegistry.Registervalidates at runtime that all engines implementCodingAgentEngine(checked via type assertion during engine registration inagentic_engine.go), providing a second safety net.Areas for Improvement
CodingAgentEngineconcrete implementations lack top-level compile-time assertions; engine method drift is only caught at registration call sites, not at definition.HarnessProvider(ClaudeEngine, CodexEngine) andAgentFileProvider(8 engines) lack assertions; both are cast via type assertions insafe_outputs_config_runtime.go,engine_config_dir.go— silent failures surface as wrong behaviour, not compile errors.ConditionNode— 10 concrete structs (ExpressionNode,AndNode,OrNode,NotNode,DisjunctionNode,FunctionCallNode,PropertyAccessNode,StringLiteralNode,BooleanLiteralNode,ComparisonNode) with no assertions; adding a required method to the interface would silently leave all 10 non-compliant.ToolConfig/MapToolConfigandValidatableTool/GitHubToolConfiglack assertions; both are widely used in permissions validation.SHAResolver/ActionResolver,FileCreationTracker, andCommandProviderlack assertions; lower risk due to single implementor each but still useful as documentation.Detailed Analysis
CodingAgentEngineinterface structure:The composite interface embeds 8 sub-interfaces. Each sub-interface has 1–5 methods. Total method surface: ~25 methods. Any engine added in the future without all 25 will cause a runtime panic in
EngineRegistry.Register— not a compile error. The existingvar _check inpi_engine_test.gois the only test that catches this at compile time (and only for PiEngine). The 8 unchecked engines are:AntigravityEnginepkg/workflow/antigravity_engine.goClaudeEnginepkg/workflow/claude_engine.goCopilotEnginepkg/workflow/copilot_engine.goCodexEnginepkg/workflow/codex_engine.goGeminiEnginepkg/workflow/gemini_engine.goOpenCodeEnginepkg/workflow/opencode_engine.goCrushEnginepkg/workflow/crush_engine.goUniversalLLMConsumerEnginepkg/workflow/universal_llm_consumer_engine.goOptional interfaces (
HarnessProvider,AgentFileProvider,LLMProviderResolver):These are accessed via type assertion (
engine.(AgentFileProvider)), which silently returnsfalseif the assertion fails. Avar _assertion in the engine's own file documents the intentional implementation and catches regressions if a method is removed from the struct.HarnessProviderimplementors:ClaudeEngine,CopilotEngine,CodexEngineAgentFileProviderimplementors:AntigravityEngine,ClaudeEngine,CopilotEngine,CodexEngine,GeminiEngine,PiEngine,OpenCodeEngine,CrushEngine(plusBaseEnginedefault)LLMProviderResolverimplementors:ClaudeEngine,PiEngine,CopilotEngine,CodexEngineCorrect placement:
var _assertions should live in the non-test source file of the concrete type (e.g.,var _ CodingAgentEngine = (*ClaudeEngine)(nil)at the top ofclaude_engine.go, near the struct definition). Using(*T)(nil)avoids allocating an instance. The 4 assertions inlog_aggregation_test.gouse this pattern correctly.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Add
var _ CodingAgentEngineassertions for all 8 unchecked engine implementationsPriority: High
Estimated Effort: Small
Focus Area: Interface Contract Completeness
Description: Add compile-time interface satisfaction checks for all concrete engine types that implement
CodingAgentEnginebut currently lack avar _assertion. Each assertion should be placed in the engine's primary source file, after the struct definition, using the(*T)(nil)nil-pointer pattern.Acceptance Criteria:
var _ CodingAgentEngine = (*AntigravityEngine)(nil)added topkg/workflow/antigravity_engine.govar _ CodingAgentEngine = (*ClaudeEngine)(nil)added topkg/workflow/claude_engine.govar _ CodingAgentEngine = (*CopilotEngine)(nil)added topkg/workflow/copilot_engine.govar _ CodingAgentEngine = (*CodexEngine)(nil)added topkg/workflow/codex_engine.govar _ CodingAgentEngine = (*GeminiEngine)(nil)added topkg/workflow/gemini_engine.govar _ CodingAgentEngine = (*OpenCodeEngine)(nil)added topkg/workflow/opencode_engine.govar _ CodingAgentEngine = (*CrushEngine)(nil)added topkg/workflow/crush_engine.govar _ CodingAgentEngine = (*UniversalLLMConsumerEngine)(nil)added (or omitted with a comment ifUniversalLLMConsumerEngineis intentionally not a fullCodingAgentEngine)go build ./pkg/workflow/...passesCode Region:
pkg/workflow/*_engine.go(all engine definition files)Task 2: Add
var _assertions forHarnessProvider,AgentFileProvider, andLLMProviderResolverPriority: High
Estimated Effort: Small
Focus Area: Optional Interface Compliance Documentation
Description: Three optional interfaces are implemented by subsets of engines and accessed via type assertions (
engine.(AgentFileProvider)). Addingvar _assertions documents the intentional implementation and catches regressions when a method is removed.Acceptance Criteria:
var _ HarnessProvider = (*ClaudeEngine)(nil)inpkg/workflow/claude_engine.govar _ HarnessProvider = (*CopilotEngine)(nil)inpkg/workflow/copilot_engine.go(currently only in test)var _ HarnessProvider = (*CodexEngine)(nil)inpkg/workflow/codex_engine.govar _ AgentFileProvider = (*AntigravityEngine)(nil),(*ClaudeEngine)(nil),(*CopilotEngine)(nil),(*CodexEngine)(nil),(*GeminiEngine)(nil),(*PiEngine)(nil),(*OpenCodeEngine)(nil),(*CrushEngine)(nil)— each in their respective filevar _ LLMProviderResolver = (*ClaudeEngine)(nil),(*PiEngine)(nil),(*CopilotEngine)(nil),(*CodexEngine)(nil)— each in their respective filego build ./pkg/workflow/...passes with no errorsCode Region:
pkg/workflow/claude_engine.go,pkg/workflow/copilot_engine.go,pkg/workflow/codex_engine.go,pkg/workflow/antigravity_engine.go,pkg/workflow/gemini_engine.go,pkg/workflow/pi_engine.go,pkg/workflow/opencode_engine.go,pkg/workflow/crush_engine.goTask 3: Add
var _assertions forConditionNodeandToolConfigimplementorsPriority: Medium
Estimated Effort: Small
Focus Area: Expression Tree & Tool Configuration Interface Safety
Description:
ConditionNodehas 10 concrete implementors (ExpressionNode,AndNode,OrNode,NotNode,DisjunctionNode,FunctionCallNode,PropertyAccessNode,StringLiteralNode,BooleanLiteralNode,ComparisonNode) — none have compile-time checks.ToolConfighasMapToolConfigas its key implementor. Both are structural interfaces with simple method sets but high refactoring risk.Acceptance Criteria:
var _ ConditionNode = (*ExpressionNode)(nil)and assertions for all 10ConditionNodeimplementors added topkg/workflow/expression_nodes.govar _ ToolConfig = (MapToolConfig)(nil)(orMapToolConfig{}) added topkg/workflow/mcp_config_types.govar _ ValidatableTool = (*GitHubToolConfig)(nil)added topkg/workflow/permissions_toolset_data.gogo build ./pkg/workflow/...passesCode Region:
pkg/workflow/expression_nodes.go,pkg/workflow/mcp_config_types.go,pkg/workflow/permissions_toolset_data.goIn pkg/workflow/expression_nodes.go, add a block of var _ ConditionNode assertions after all struct definitions: var ( _ ConditionNode = (*ExpressionNode)(nil) _ ConditionNode = (*AndNode)(nil) _ ConditionNode = (*OrNode)(nil) _ ConditionNode = (*NotNode)(nil) _ ConditionNode = (*DisjunctionNode)(nil) _ ConditionNode = (*FunctionCallNode)(nil) _ ConditionNode = (*PropertyAccessNode)(nil) _ ConditionNode = (*StringLiteralNode)(nil) _ ConditionNode = (*BooleanLiteralNode)(nil) _ ConditionNode = (*ComparisonNode)(nil) ) Note: DisjunctionNode also has a RenderMultiline() method that is not part of ConditionNode. The assertion checks only that Render() is present, which is the interface contract. In pkg/workflow/mcp_config_types.go, add after the MapToolConfig methods: var _ ToolConfig = (MapToolConfig)(nil) In pkg/workflow/permissions_toolset_data.go, add after GitHubToolConfig methods: var _ ValidatableTool = (*GitHubToolConfig)(nil) Run `go build ./pkg/workflow/...` to confirm.Task 4: Add
var _assertions forSHAResolver,FileCreationTracker, andCommandProviderPriority: Low
Estimated Effort: Small
Focus Area: Single-Implementor Interface Documentation
Description: Three interfaces each have a single concrete implementor. While the risk of undetected drift is lower (a compile error will appear at assignment sites when the interface is broken), adding
var _assertions serves as documentation of intentional interface compliance and co-locates the contract with the implementation.Acceptance Criteria:
var _ SHAResolver = (*ActionResolver)(nil)added topkg/workflow/action_resolver.go(note:SHAResolverinpkg/workflowis a type alias foractionpins.SHAResolver— verify the assertion should be againstactionpins.SHAResolver)var _ FileCreationTracker = ...added for the concrete type that implements it (checkcompiler_types.gocallsites to find the implementor)var _ CommandProvider = (*cobra.Command)(nil)added topkg/cli/interfaces.goas documentation thatcobra.Commandsatisfies the interface (importgithub.com/spf13/cobra)go build ./...passesCode Region:
pkg/workflow/action_resolver.go,pkg/workflow/compiler_types.go,pkg/cli/interfaces.go📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
var _ CodingAgentEnginefor 8 engines — Priority: High (Task 1 above). Prevents silent interface drift on the coreCodingAgentEnginecontract.HarnessProvider,AgentFileProvider,LLMProviderResolver) — Priority: High (Task 2). Documents intentional compliance and prevents regression when methods are moved.Short-term Actions (This Month)
var _forConditionNode(10 implementors) andToolConfig— Priority: Medium (Task 3). Expression tree refactoring risk.pkg/linters/analyzer that flagstype T structdeclarations inpkg/workflow/with an// implements Xcomment but no correspondingvar _ X = (*T)(nil)in the same file.Long-term Actions (This Quarter)
var _assertions from test files to production files — The 4 assertions inlog_aggregation_test.gobelong inlog_aggregation.goitself. This ensures they catch interface drift even without running tests. Priority: Low.📈 Success Metrics
var _assertion coverage: 6/~45 implementors (13%) → 45/45 (100%)CodingAgentEngineimplementors: 8 → 0Next Steps
References:
Generated by Repository Quality Improvement Agent
Beta Was this translation helpful? Give feedback.
All reactions