Skip to content

fix(tuples): reject bulk-only flags on single-tuple writes - #107

Merged
sergiught merged 1 commit into
mainfrom
fix/reject-inert-bulk-flags
Aug 3, 2026
Merged

fix(tuples): reject bulk-only flags on single-tuple writes#107
sergiught merged 1 commit into
mainfrom
fix/reject-inert-bulk-flags

Conversation

@sergiught

Copy link
Copy Markdown
Owner

📝 Summary

--on-duplicate, --on-missing, --failed-file, --max-tuples-per-write, --max-parallel-requests and --file-format are all read inside the if file != "" branch of tuples write/tuples delete. On the single-tuple path they were never consulted and never mentioned:

$ ofga tuples write user:anne viewer document:roadmap --on-duplicate ignore
# still fails on a duplicate
$ ofga tuples delete user:anne viewer document:roadmap --failed-file failures.json
# no file, no warning

Setting one without --file is now a usage error naming the flag. This mirrors rejectInertConnectionFlags, the guard model test already applies to the connection flags it can't honour — the same footgun, the same treatment. Only flags explicitly set on the command line trip it (.Changed), so defaults and --file runs are unaffected.

🏷 Type of change

  • 🐛 Bug fix (non-breaking)
  • ✨ Feature (non-breaking)
  • 💥 Breaking change (users must update)
  • ♻️ Refactor (no functional change)
  • 📚 Docs only
  • 🛠 Build / CI / tooling

An invocation that previously appeared to succeed while ignoring what was asked now fails loudly, which is the point.

✅ How to verify

make check

TestBulkOnlyFlagsAreRejectedWithoutFile covers each flag on both write and delete; TestBulkOnlyFlagsAreAcceptedWithFile pins that they still work in a bulk run.

📋 Checklist

  • 🧪 Tests added or updated where it makes sense
  • 📖 Docs updated (README / command --help / examples) if behavior changed — the flags' help already scopes them to --file
  • 🏷 PR title follows Conventional Commits
  • 🟢 make check passes locally

--on-duplicate, --on-missing, --failed-file, --max-tuples-per-write,
--max-parallel-requests and --file-format are read only inside the --file
branch, so setting one on a single-tuple write or delete did nothing at all
and said nothing about it: `ofga tuples write user:anne viewer doc:1
--on-duplicate ignore` still failed on a duplicate.

Setting one without --file is now a usage error, mirroring the guard `model
test` already applies to the connection flags it cannot honour. Only flags
given on the command line trip it, so defaults are unaffected.
@sergiught
sergiught merged commit 38d698a into main Aug 3, 2026
7 checks passed
@sergiught
sergiught deleted the fix/reject-inert-bulk-flags branch August 3, 2026 06:37
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