[WIP] Split file writing step for JavaScript sources#5945
Closed
[WIP] Split file writing step for JavaScript sources#5945
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation Plan: Split Large JavaScript Source File Writing
Problem
The compiler writes multiple JavaScript source files in a single step using heredoc commands (
cat > file << 'EOF'). When the total size of all these heredoc commands exceeds 21000 characters, it violates GitHub Actions' step size limits, causing workflow compilation failures.Solution
Implemented automatic chunking of JavaScript file writes to split large steps into multiple smaller steps that stay under the 21KB limit.
Implementation Checklist
Changes Made
1. Added
JavaScriptFileWritestruct (mcp_servers.go)2. Created
writeJavaScriptFilesInChunks()helper function (mcp_servers.go)cat > <path> << '<EOF>'3. Refactored safe-outputs JavaScript writing (mcp_servers.go)
writeJavaScriptFilesInChunks()4. Refactored safe-inputs JavaScript writing (mcp_servers.go)
writeJavaScriptFilesInChunks()5. Added comprehensive tests (mcp_servers_test.go)
TestJavaScriptFileChunking: Tests single/multiple files and automatic chunkingTestJavaScriptFileChunkingPreservesOrder: Validates file order preservationManual Testing Results
Compiled
safe-output-health.md:Compiled
test-python-safe-input.md:Test Results
Unit Tests: ✅ PASS - All unit tests pass without regressions
Integration Tests: One pre-existing failure in
TestSafeOutputsMCPBundlerIntegrationTechnical Details
Size Calculation:
"cat > <path> << '<EOF>'\n""<EOF>\n"Chunking Algorithm:
Benefits
✅ Prevents compilation failures for workflows with large JavaScript dependencies
✅ Maintains file order and dependencies
✅ Automatic and transparent - no changes needed to workflow definitions
✅ Follows existing pattern used for prompt content splitting
✅ Well-tested with comprehensive unit tests
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.