Skip to content

Replace silent CREATE PROTO BUNDLE ignore with --ignore-proto-bundles flag#88

Merged
daichirata merged 1 commit into
masterfrom
feature/ignore-proto-bundles-flag
May 20, 2026
Merged

Replace silent CREATE PROTO BUNDLE ignore with --ignore-proto-bundles flag#88
daichirata merged 1 commit into
masterfrom
feature/ignore-proto-bundles-flag

Conversation

@daichirata

@daichirata daichirata commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

CREATE PROTO BUNDLE was silently dropped in NewDatabase, while the analogous unsupported statement CREATE MODEL required users to opt in via the --ignore-models flag. This PR unifies the two patterns under the explicit-opt-in approach by introducing --ignore-proto-bundles.

Problem with the silent path

// Before (internal/hammer/diff.go)
case *ast.CreateProtoBundle:
    // CREATE PROTO BUNDLE is not supported, ignore it.

This has two issues:

  • Users can't tell that hammer just stripped a statement from their schema, so a CREATE PROTO BUNDLE typo or paste mistake never produces an error.
  • If hammer later grows real CREATE PROTO BUNDLE support, schemas that relied on the silent drop will suddenly start emitting diffs the user never asked for.

Changes

  • DDLOption gains an IgnoreProtoBundles bool field.
  • ParseDDL filters *ast.CreateProtoBundle when the flag is set, matching the existing *ast.CreateModel handling.
  • The silent case *ast.CreateProtoBundle: in NewDatabase is removed, so the statement now falls through to the default unexpected ddl statement error path.
  • --ignore-proto-bundles is added to apply / create / diff / export.
  • The three ignore create proto bundle in {from,to,both} tests set ignoreProtoBundles: true and continue to verify the flag's behaviour.
  • README's Flags section lists the new flag.

… flag

CREATE PROTO BUNDLE was silently dropped in NewDatabase, while the
analogous unsupported statement CREATE MODEL required users to opt in
via the --ignore-models flag. The silent path has two problems:

- Users can't tell that hammer just stripped a statement from their
  schema, so a CREATE PROTO BUNDLE typo or paste mistake never produces
  an error.
- If hammer later grows real CREATE PROTO BUNDLE support, schemas that
  relied on the silent drop will suddenly start emitting diffs the user
  never asked for.

Add IgnoreProtoBundles to DDLOption and a corresponding
--ignore-proto-bundles flag to apply / create / diff / export. Drop the
silent case in NewDatabase so the default behaviour now errors out with
"unexpected ddl statement", matching how --ignore-models handles
CREATE MODEL.

Existing tests (`ignore create proto bundle in {from,to,both}`) are
updated to set ignoreProtoBundles: true and continue to verify the
flag's behaviour. README's Flags section gets the new entry.

Behavioural impact: this is a breaking change for users who were
relying on the silent ignore added in PR #84 (v0.7.0-beta.7). The fix
is to pass `--ignore-proto-bundles` and the previous behaviour is
restored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@daichirata daichirata merged commit 97bfae5 into master May 20, 2026
12 checks passed
@daichirata daichirata deleted the feature/ignore-proto-bundles-flag branch May 20, 2026 11:26
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.

1 participant