Skip to content

Conversation

@laceett
Copy link

@laceett laceett commented Jan 23, 2026

/## Clever Coding Standards Agreement

Clever Coding Standards Agreement

JIRA

ASOC-710

Overview

Implemented the --inputfile flag for sfncli to avoid ARG_MAX limits.

Changes

  • Added --inputfile flag in sfncli.go:

    • Boolean flag that enables file-based input mode
    • Requires --workdirectory to be set (since we need a directory to write the file)
  • Updated TaskRunner struct in runner.go:

    • Added inputFile bool field to track the mode
    • Updated NewTaskRunner() constructor to accept inputFile parameter
  • Modified Process() method in runner.go:

    • When inputFile is enabled:
      • Validates that workDirectory is set (returns error if not)
      • Writes JSON input to WORK_DIR/input.json in the task's temporary directory
      • Passes the file path as the argument instead of raw JSON
    • When disabled: maintains existing behavior (passes JSON as CLI argument)
    • Added path/filepath import for file path operations
  • Updated README.md:

    • Added --inputfile flag to the usage section
    • Updated high-level logic section to explain the new file-based input behavior

Testing

  • Updated all test cases in runner_test.go:
    • Modified all NewTaskRunner() calls to include the new inputFile parameter (set to false for existing tests to maintain backward compatibility)

Rollout

This feature addresses the specific use case where the api-v3-finalizer worker processes migrations with thousands of district IDs. Payloads regularly exceed 100KB, hitting ARG_MAX limits. With this change, workers can read input from a file instead of parsing command-line arguments.

Rollback

Should not affect existing feature.

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