[repository-quality] 🎯 Repository Quality Improvement Report - Compile-Time Interface Satisfaction Assertions (2026-07-15) #45742
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-07-16T13:24:48.702Z.
|
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
🎯 Repository Quality Improvement Report - Compile-Time Interface Satisfaction Assertions
Analysis Date: 2026-07-15
Focus Area: Compile-Time Interface Satisfaction Assertions
Strategy Type: Custom
Custom Area: Yes — zero
var _ Interface = (*Concrete)(nil)guards exist in all production Go files; this is a never-covered, repo-specific gap directly affecting refactoring safety for the 7+ engine typesExecutive Summary
The repository defines 21 interfaces across
pkg/andcmd/, including the criticalCodingAgentEnginecomposite interface (itself composed of 10 sub-interfaces) implemented by 7+ concrete engine types. Zero production files contain a compile-time interface satisfaction assertion (var _ Interface = (*ConcreteType)(nil)). Only 5 such assertions exist, all in test files, covering onlyLogAnalysis/MutableLogAnalysisfor two types and one engine type in a single test.This means any refactoring that silently breaks an engine's contract (e.g., removing a method, changing a signature) will be caught only at the call site, potentially far from the broken type, making root cause analysis harder. The
ConditionNodeinterface (10 concrete expression node types) andSHAResolverinterface (ActionResolver concrete type) are similarly unguarded.Adopting the Go idiom of placing
var _ Interface = (*Type)(nil)assertions directly in the implementation files collapses the feedback loop from "somewhere fails to compile" to "this file fails to compile at its declaration site" — a zero-cost, no-runtime-overhead improvement.Full Analysis Report
Focus Area: Compile-Time Interface Satisfaction Assertions
Current State Assessment
Metrics Collected:
var _ Interface = ...assertionsvar _ Interface = ...assertionsCodingAgentEngineconcrete implementorsConditionNodeconcrete implementorsSHAResolverconcrete implementorsFileCreationTrackerconcrete implementorsValidatableToolconcrete implementorsToolConfigconcrete implementorsFindings
Strengths
pkg/cli/log_aggregation_test.goalready demonstrates the pattern correctly (var _ LogAnalysis = (*DomainAnalysis)(nil)) — the team knows the idiompkg/workflow/pi_engine_test.gohas one engine assertion (var _ CodingAgentEngine = NewPiEngine())Areas for Improvement
CodingAgentEngine— 7 concrete types (CopilotEngine,GeminiEngine,AntigravityEngine,ClaudeEngine,CodexEngine,PiEngine,BehaviorDefinedEngine,UniversalLLMConsumerEngine) have zero production-side assertions; the sub-interfaces (Engine,CapabilityProvider,WorkflowExecutor,MCPConfigProvider,LogParser,SecurityProvider,ModelEnvVarProvider,InferenceProviderResolver,AgentFileProvider,ConfigRenderer,HarnessRunner) are also unguarded in productionConditionNode— 10 expression node structs (ExpressionNode,AndNode,OrNode,NotNode,DisjunctionNode,FunctionCallNode,PropertyAccessNode,StringLiteralNode,BooleanLiteralNode,ComparisonNode) have no assertionsSHAResolver—ActionResolverinpkg/workflow/action_resolver.gohas no assertionFileCreationTracker—FileTrackerinpkg/cli/file_tracker.gohas no assertion; it's injected viaSetFileTrackerand silently ignored if nilValidatableTool,ToolConfig,CommandProvider— single-implementor interfaces with no guardsDetailed Analysis
Why it matters for this repo specifically:
The
CodingAgentEngineinterface is a 10-interface composite. Adding a new method to any sub-interface (e.g.,HarnessRunner) requires all 7+ concrete engine types to implement it. Today, the compiler points to call sites inpkg/workflow/compiler_orchestrator_engine.goor similar, not to the concrete type file. With assertions incopilot_engine.go,gemini_engine.go, etc., the compiler immediately flags the right file.The expression
ConditionNodehierarchy (pkg/workflow/expression_nodes.go) is the most concentrated: all 10 concrete types live in one file, making a single block of assertions trivial to add and highly protective during future AST refactoring.SHAResolveris used as a parameter type in 12+ functions acrosspkg/workflow/andpkg/cli/.ActionResolverinaction_resolver.gois the sole production implementation; an assertion there prevents silent drift.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Add compile-time assertions for all CodingAgentEngine concrete types
Priority: High
Estimated Effort: Small
Focus Area: Compile-Time Interface Satisfaction Assertions
Description: Add
var _ CodingAgentEngine = (*CopilotEngine)(nil)(and equivalent for each engine) in each concrete engine's Go file. For value-receiver engines (PiEngine, CodexEngine), use the value formvar _ CodingAgentEngine = PiEngine{}. Also add assertions for the sub-interfaces (e.g.var _ HarnessRunner = (*CopilotEngine)(nil)) in the concrete type files if the type is known to implement them.Acceptance Criteria:
pkg/workflow/copilot_engine.gohasvar _ CodingAgentEngine = (*CopilotEngine)(nil)pkg/workflow/gemini_engine.gohasvar _ CodingAgentEngine = (*GeminiEngine)(nil)pkg/workflow/antigravity_engine.gohasvar _ CodingAgentEngine = (*AntigravityEngine)(nil)pkg/workflow/claude_engine.gohasvar _ CodingAgentEngine = (*ClaudeEngine)(nil)pkg/workflow/codex_engine.gohasvar _ CodingAgentEngine = (*CodexEngine)(nil)(or value form)pkg/workflow/pi_engine.gohasvar _ CodingAgentEngine = (*PiEngine)(nil)(or value form)pkg/workflow/behavior_defined_engine.gohasvar _ CodingAgentEngine = (*BehaviorDefinedEngine)(nil)pkg/workflow/universal_llm_consumer_engine.gohasvar _ CodingAgentEngine = (*UniversalLLMConsumerEngine)(nil)make buildpasses after changesCode Region:
pkg/workflow/copilot_engine.go,pkg/workflow/gemini_engine.go,pkg/workflow/antigravity_engine.go,pkg/workflow/claude_engine.go,pkg/workflow/codex_engine.go,pkg/workflow/pi_engine.go,pkg/workflow/behavior_defined_engine.go,pkg/workflow/universal_llm_consumer_engine.goEnsure
make buildpasses after all changes.Ensure
make buildpasses after the change.(SHAResolver is defined in
pkg/actionpinsand aliased inpkg/workflow/action_pins.go)pkg/cli/file_tracker.go, theFileTrackerstruct must satisfyworkflow.FileCreationTracker. Add:Check the existing import of the workflow package; if missing, add it.
Ensure
make buildpasses after both changes.pkg/workflow/mcp_config_types.go, aftertype MapToolConfig map[string]any, add:Ensure
make buildpasses after both changes.Beta Was this translation helpful? Give feedback.
All reactions