🎯 Repository Quality Improvement Report - Workflow Input/Output Contract Validation #5606
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it was created by an agentic workflow more than 3 days ago. |
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 - Workflow Input/Output Contract Validation
Analysis Date: 2025-12-05
Focus Area: Workflow Input/Output Contract Validation
Strategy Type: Custom
Custom Area: Yes - This focus area addresses gh-aw's unique challenge of ensuring type safety and contract adherence in the workflow compilation pipeline, where markdown frontmatter is transformed into GitHub Actions workflows with safe output configurations.
Executive Summary
The gh-aw project compiles 152 markdown workflows into GitHub Actions with 98 safe output types, but lacks a formal input/output contract system. While the codebase has strong JSON schema validation (5,850 LOC across 3 schemas with 684 documented properties) and 69 typed config structs, there's no systematic validation of workflow inputs/outputs at compilation time or runtime. This gap creates potential for type mismatches, missing parameter validation, and unclear contracts between workflow authors and safe output processors.
Key findings: 26 of 98 non-test JavaScript safe output files (27%) lack JSDoc type annotations, making contract verification difficult. The schema infrastructure is robust but doesn't enforce input/output contracts for workflows. Only 17 explicit type validation patterns exist despite 69 config structs requiring validation. This custom analysis reveals an opportunity to introduce contract-first workflow development with compile-time validation.
Full Analysis Report
Focus Area: Workflow Input/Output Contract Validation
Rationale for This Custom Focus Area
Unlike standard quality categories (testing, security, documentation), this focus area is uniquely specific to gh-aw's architecture:
This analysis examines the entire contract validation lifecycle: frontmatter parsing → compilation → safe output processing → runtime execution.
Current State Assessment
Metrics Collected:
Findings
Strengths
Areas for Improvement
Missing workflow input/output system (Critical)
inputs:oroutputs:in frontmatterIncomplete JSDoc coverage (High)
@paramand@returnsannotationsImplicit type contracts (Medium)
46 uncompiled workflows (Medium)
Safe output contract documentation (Low)
Detailed Analysis
1. Workflow Input/Output System Gap
The JSON schema infrastructure is excellent for validating frontmatter structure, but there's no support for defining workflow inputs and outputs that can be passed between composed workflows. The
importsfield allows workflow composition, but there's no type-safe way to pass parameters.Current State:
Desired State:
2. Safe Input Parameter Validation
The
SafeInputParamstruct exists (7 references insafe_inputs.go) with type definitions, but there's no compile-time validation that JavaScript implementations match declared types:The gap: No validation that the JavaScript
script:,run:, orpy:implementations correctly handle the declared parameter types.3. JavaScript Safe Output Type Contracts
While 73% of safe outputs have JSDoc, the annotations aren't enforced or validated during compilation:
Good Example (create_discussion.cjs):
Missing Annotations:
26 files lack these annotations, making contract verification manual and error-prone.
4. Uncompiled Workflow Analysis
46 workflows (30%) exist as
.mdfiles without corresponding.lock.ymlfiles. This could indicate:Need systematic audit to determine intent and ensure consistency.
5. Type Validation Pattern Analysis
Only 17 explicit type validation patterns exist for 69 config structs (25% coverage). Most validation is implicit via Go's type system and struct tags. While this provides basic type safety, it doesn't catch:
🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: The following tasks are designed for GitHub Copilot agent execution. Please split these into individual work items for Claude to process.
Improvement Tasks
The following code regions and tasks should be processed by the Copilot agent. Each section is marked for easy identification by the planner agent.
Task 1: Add Workflow Input/Output Schema Support
Priority: High
Estimated Effort: Large
Focus Area: Workflow Contract Validation
Description:
Extend the JSON schema in
pkg/parser/schemas/main_workflow_schema.jsonto support workflow-levelinputsandoutputsdefinitions. This will enable type-safe parameter passing between composed workflows and provide compile-time validation of workflow contracts.Acceptance Criteria:
inputsproperty to main workflow schema with per-input type, description, required, and default fieldsoutputsproperty to main workflow schema with per-output type and description fieldspkg/parser/frontmatter.goto extract and validate input/output definitionsinputs:configuration receive required parametersCode Region:
pkg/parser/schemas/main_workflow_schema.json,pkg/parser/frontmatter.goTask 2: Enforce JSDoc Type Annotations for Safe Outputs
Priority: High
Estimated Effort: Medium
Focus Area: Safe Output Contract Documentation
Description:
Create a validation script and CI check to ensure all safe output JavaScript files have complete JSDoc type annotations. Add missing annotations to the 26 files currently lacking them.
Acceptance Criteria:
scripts/validate-jsdoc.shthat checks for@paramand@returnsin all.cjsfilesmake lint-jsdocthat runs the validationmake agent-finishpipelinedocs/for safe output authorscore.setOutput()calls have corresponding@returnsdocumentationCode Region:
pkg/workflow/js/*.cjs,scripts/,MakefileTask 3: Implement Safe Output Contract Registry
Priority: Medium
Estimated Effort: Medium
Focus Area: Safe Output Discovery and Documentation
Description:
Create an automated system that extracts JSDoc type information from safe output files and generates a machine-readable registry. This enables compile-time contract validation and provides a single source of truth for safe output types.
Acceptance Criteria:
scripts/generate-safe-output-registry.gothat parses JSDoc from all.cjsfilespkg/workflow/safe_outputs_registry.jsonwith schema for each safe outputmake generate-registrythat runs the scriptmake recompileworkflowCode Region:
scripts/generate-safe-output-registry.go,pkg/workflow/,MakefileError: Safe output 'create-discussion' missing required parameter 'title'
In: .github/workflows/quality-improvement.md
Line: 15
Expected configuration:
safe-outputs:
create-discussion:
title: "Discussion Title"
body: "Discussion Body"
Task 5: Audit and Classify Uncompiled Workflows
Priority: Low
Estimated Effort: Small
Focus Area: Workflow Ecosystem Health
Description:
Systematically identify the 46 markdown workflows without corresponding
.lock.ymlfiles and classify them as: intentional includes (should not be compiled), incomplete (need compilation), or stale (should be removed). Document findings and add metadata to indicate compilation intent.Acceptance Criteria:
scripts/audit-uncompiled-workflows.shthat lists all.mdfiles without.lock.ymlcompile: falseto intentional includes to document intent.lock.ymlfilescompilefieldcompile: falseflagCode Region:
.github/workflows/,pkg/parser/schemas/main_workflow_schema.json,scripts/For each uncompiled workflow, determine:
shared/*.md)?Add
compile: falsefrontmatter field to shared includes:Update schema to make
compilefield optional booleanDocument findings in a report with recommendations for each uncompiled workflow
Beta Was this translation helpful? Give feedback.
All reactions