<#9484 feat: Add `meltano state edit` to manually ...
# meltano-repo-activity
g
#9484 feat: Add
meltano state edit
to manually patch state
Pull request opened by mahangu Adds a
meltano state edit
command that allows users to interactively edit pipeline state using their default text editor. The command pulls the current state for a given state ID, opens it in
$EDITOR
with pretty-formatted JSON, and saves changes back to the state backend after validation. Key features: • Opens state in user's configured editor • Pretty-formats JSON with proper indentation for readability • Error messages show line/column info for JSON syntax errors • Validates state format has
singer_state
top-level key • Handles cancellation, empty content, and no-change scenarios gracefully • Includes confirmation prompt consistent with other destructive state operations Usage: # Edit state for a specific pipeline meltano state edit tap-github:target-postgres # Edit state for a single extractor meltano state edit tap-salesforce # Create new state if it doesn't exist meltano state edit new-pipeline-state The command opens your default editor with formatted JSON like: { "singer_state": { "bookmarks": { "users": { "replication_key_value": "2023-12-01T000000Z", "replication_key": "updated_at" } } } } Related Issues • Closes #9375 ## Summary by Sourcery Introduce a new interactive CLI command
meltano state edit
to open and save pipeline state in the user’s default editor with JSON formatting, validation, and overwrite confirmation, and back it with comprehensive tests. New Features: • Add
state edit
command to interactively open and update state JSON in the default text editor Enhancements: • Pretty-format JSON, validate presence of top-level
singer_state
, handle cancellations, empty or unchanged edits, and report JSON syntax errors with line/column information • Prompt for confirmation before overwriting existing state Tests: • Add tests for state edit covering existing and new state creation, cancellation, no-op edits, invalid JSON and state format, empty content, and confirmation prompt Chores: • Extract
invoke_with_state_service
helper in tests to streamline StateService mocking meltano/meltano