Add no-preflight bucket registration (v0.16.1)#51
Open
drernie wants to merge 6 commits into
Open
Conversation
f68e423 to
db7085c
Compare
- Document --no-preflight no-prompt contract in --yes/--no-preflight help and drop redundant --yes from README example. - catalog acl --no-preflight --dry-run now lists skipped local steps (spec/7-no-preflight.md §140). - Add CLI-boundary tests: BucketAddError → stderr + exit 1, and --no-preflight without --yes does not prompt (spec §144). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a “GraphQL-only” bucket registration path that skips local AWS S3/SNS preflight/setup, allowing bucket registration to rely on the catalog stack’s IAM probe (matching admin UI behavior). It adds --no-preflight support to both quiltx bucket add and quiltx catalog acl, plus supporting docs/spec and CLI-boundary tests.
Changes:
- Add
--no-preflightto bucket registration flows (bucket add,catalog acl) with an env-var override (QUILTX_NO_PREFLIGHT=1). - Implement a GraphQL-only
add_bucket_without_preflight()helper with structured union-result error mapping. - Add/extend tests and documentation covering no-preflight behavior, dry-run output, and non-zero exits on bucketAdd errors.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Bumps locked quiltx version to 0.16.1. |
pyproject.toml |
Bumps project version to 0.16.1. |
quiltx/_version.py |
Bumps runtime version string to 0.16.1. |
quiltx/bucket.py |
Adds GraphQL-only add_bucket_without_preflight() and bucketAdd union error mapping helpers. |
quiltx/tools/bucket.py |
Adds --no-preflight CLI flag, env-var handling, and a no-preflight execution/dry-run path. |
quiltx/acl.py |
Threads no_preflight through ACL bucket registration to use GraphQL-only path. |
quiltx/tools/catalog/acl.py |
Adds --no-preflight, env-var fallback, and dry-run “skipped steps” notice. |
tests/test_bucket.py |
Adds CLI-boundary tests for no-preflight bucket add, env var behavior, and union error messaging. |
tests/test_acl.py |
Adds tests ensuring no-preflight routes through GraphQL-only registration and dry-run notice output. |
README.md |
Documents when/why to use --no-preflight and provides examples. |
README_DEV.md |
Documents the two registration paths for developers. |
spec/7-no-preflight.md |
Adds a detailed design/spec document for no-preflight behavior and decisions. |
CHANGELOG.md |
Adds 0.16.1 release notes for no-preflight. |
AGENTS.md |
Updates tool docs to mention --no-preflight behavior. |
Comments suppressed due to low confidence (1)
quiltx/tools/bucket.py:391
- The
--no-promptguard doesn’t currently honor the “(or --dry-run)” part of the error message:quiltx bucket add --dry-run --no-promptwill still fail unless--yesis provided (sinceargs.dry_runisn’t checked here). Update the condition to allow--no-promptwhen--dry-runis set (and keep the existing--no-preflightexemption).
no_preflight = bool(args.no_preflight or _env_flag("QUILTX_NO_PREFLIGHT"))
if (
getattr(args, "no_prompt", False)
and not getattr(args, "yes", False)
and not no_preflight
):
print(
"Error: --no-prompt requires --yes (or --dry-run) to avoid interactive prompts.",
file=sys.stderr,
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- catalog acl: import shared _env_flag helper from quiltx.tools.bucket
instead of inlining the QUILTX_NO_PREFLIGHT parsing (clearer, single
source of truth).
- catalog acl: only print the no-preflight dry-run notice when the diff
actually has buckets to add; emitting it for a reconciled config or
policy-only changes misrepresents what --no-preflight would skip.
- bucket add: error message for --no-prompt without --yes was misleading
("(or --dry-run)" did not match enforced behavior); reword to
"(or --no-preflight)", which does match.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Move env_flag helper to quiltx.cli_common so catalog acl no longer imports quiltx.tools.bucket (which pulls in heavy CLI-only deps like boto3 at import time). - bucket add --no-preflight --force: preserve the prior catalog title on re-add instead of silently resetting it to the bucket name. Matches the non-no-preflight --force path. - acl.apply_acl: in the no_preflight branch, call bucket_lib.add_bucket_without_preflight() directly instead of routing through _register_bucket_with_retry with an unused control_account_id. Removed the now-dead no_preflight param from _register_bucket_with_retry. - Drop stale '# pragma: no cover' on the apply_acl bucket-add exception handler — the new no-preflight failure test exercises it. - Spec wording: GraphQL union errors are mapped to typename-tagged, actionable CLI messages, not surfaced verbatim. BucketDoesNotExist and InsufficientPermissions now include the typename in their rendered message for consistency with other union variants. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.
Summary
--no-preflighttoquiltx bucket addandquiltx catalog aclso bucket registration can skip local S3/SNS owner setup and let the catalog stack probe via GraphQL.bucketAddhelper that preserves structured union error messages.Review fixes (v0.16.1)
--no-preflight's no-prompt contract in--yeshelp,--no-preflighthelp, and the README example (spec/7-no-preflight.md §144).--yesis now explicitly unnecessary forbucket add --no-preflight.catalog acl --no-preflight --dry-runnow lists the skipped local AWS steps (spec §140) instead of returning before no-preflight is evaluated.test_add_no_preflight_bucket_add_error_exits_nonzero— assertsBucketAddErrorfromadd_bucket_without_preflightis rendered to stderr with a non-zero exit.test_add_no_preflight_does_not_prompt_without_yes— asserts the spec §144 no-prompt contract.test_acl_tool_dry_run_no_preflight_lists_skipped_steps— covers the dry-run output forcatalog acl --no-preflight --dry-run.Validation
./poe lint— black + mypy clean../poe test— 333 passed, 1 skipped.Greptile Summary
This PR adds a
--no-preflightflag toquiltx bucket addandquiltx catalog acl, providing a GraphQL-only registration path that mirrors the catalog admin UI — skipping local S3/SNS bucket-owner setup and letting the catalog stack probe with its own IAM. A newadd_bucket_without_preflightlibrary helper maps the full GraphQL union-error type to structured, human-readable messages.quiltx/bucket.pyhelper (add_bucket_without_preflight,BucketAddError,_bucket_add_typename,_bucket_add_error_message) covers all documented union variants includingBucketDoesNotExist,InsufficientPermissions, and SNS/validation errors.--no-preflightis threaded through_cmd_add→_cmd_add_no_preflight(bucket tool) and_run→apply_acl→_register_bucket_with_retry(ACL tool), withQUILTX_NO_PREFLIGHT=1as a scripted override; the dry-run path lists the skipped local AWS steps.BucketAddError.Confidence Score: 4/5
Safe to merge; the no-preflight path is well-isolated and the full owner-setup path is unchanged.
The core logic — skipping local S3/SNS setup and delegating to the GraphQL union — is correct and well-tested. The three findings are all style/maintainability issues: a duplicated env-var check, a dry-run notice that fires when no bucket registrations are actually planned, and a stale pragma comment. None of them affect the happy path or the error path in production.
quiltx/tools/catalog/acl.py — env-var duplication and the no-changes dry-run notice condition; quiltx/acl.py — stale pragma on the exception block.
Important Files Changed
add_bucket_without_preflight,BucketAddError, and private helpers_bucket_add_typename,_field_value,_bucket_add_error_message. Logic is sound; union-error mapping covers all documented variants.--no-preflightCLI flag,_env_flaghelper,_cmd_add_no_preflighthandler, and_print_no_preflight_dry_runrich table; no-preflight path is correctly gated behind the outer try-except in_cmd_add.no_preflightthroughapply_acland_register_bucket_with_retry; the no-preflight branch passescontrol_account_id or ""but that value is ignored inside_register_bucket_with_retrywhenno_preflight=True, which is harmless but slightly misleading.--no-preflightto the ACL tool; env-var check is inlined instead of reusing_env_flag, and the dry-run notice is shown even when no changes exist (buckets_to_add is empty).# pragma: no coverin the exception block it now exercises.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["quiltx bucket add BUCKET"] --> B{no-preflight flag\nor env var?} B -- No --> C[bucket-owner path\nresolve session\nmerge bucket policy\nensure SNS topic\nGraphQL bucketAdd with SNS ARN] B -- Yes --> D[_cmd_add_no_preflight] D --> E{dry-run?} E -- Yes --> F[print skipped AWS steps\nreturn 0] E -- No --> G{already registered?} G -- Yes and force --> H[admin.buckets.remove] G -- Yes no force --> I[print already-registered\nreturn 0] H --> J[add_bucket_without_preflight\nGraphQL bucketAdd\nsns_notification_arn is None] G -- No --> J J --> K{GraphQL typename} K -- BucketAddSuccess --> L[return AddBucketResult\nalready_registered=False] K -- BucketAlreadyAdded --> M[return AddBucketResult\nalready_registered=True] K -- error typename --> N[raise BucketAddError\nhuman-readable message] N --> O[print to stderr\nreturn 1]Comments Outside Diff (1)
quiltx/acl.py, line 656-659 (link)# pragma: no coverafter new testThe
except Exceptionblock here is now exercised bytest_apply_acl_no_preflight_failure_does_not_rollback, which injects aRuntimeErrorthrough the mockedadd_bucket_without_preflight. The pragma was correct before this PR, but keeping it means the coverage report will under-report actual test coverage and the comment "external API surface" no longer accurately describes why the branch exists.Reviews (1): Last reviewed commit: "CHANGELOG: 0.16.1" | Re-trigger Greptile