Commit 32eaa23
authored
feat(cli,api,store): binding CRUD, multi-destination cred add, cred update (#24)
* feat(store): add UpdateBinding method with optional field updates
* feat(cli): add sluice binding CRUD subcommand
* feat(cli): support multiple --destination on cred add
* feat(cli): add sluice cred update for value replacement
* feat(api): add PATCH endpoints for binding and credential updates
* chore: verify acceptance criteria for binding-cli plan
* docs: document sluice binding and cred update, mark plan complete
* fix: address review findings from binding-cli plan
Squashed fixes from review phases 1 through 4 and codex iterations 1-10:
- preserve OAuth refresh_token when not supplied (CLI + API)
- sync paired allow rule when binding destination, ports, or protocols change
- add EnvVar field to BindingUpdateOpts; --env-var and --protocols on update
- reject duplicate binding add via case-insensitive UNIQUE index (migrations 000005, 000007)
- migration aborts on conflicting binding dedup so data loss is surfaced to operators
- classify API errors: 409 Conflict on duplicates, 400 only for ErrBindingValidation, 500 otherwise
- wrap validation errors (port range, destination glob, protocols, env_var) with ErrBindingValidation sentinel
- close TOCTOUs: AddBinding env_var check transactional; RemoveBindingWithRuleCleanup in one tx; UpdateBindingWithRuleSync transactional; PostApiCredentials/PatchApiCredentialsName acquire reloadMu
- CAS-protect credential rollback against concurrent writers (vault.RollbackAdd, store.RemoveCredentialMetaCAS)
- PatchApiCredentialsName and handleCredUpdate use credential_meta as authoritative type source
- updatePairedRuleTx walks both cred-add and binding-add source prefixes
- recompileEngine/rebuildResolver failures now return 500 to callers instead of WARN+success
- return 500 on rebuildResolver failures in PostApiCredentials/DeleteApiCredentialsName
- consolidated source-prefix constants into store package
- deleted dead UpdateBinding/UpdateRuleDestinationBySource/SyncPairedAllowRule code
- extracted parsePortsList helper into flagutil.go
- updated CLAUDE.md and openapi.yaml to match new behavior
* refactor(store): consolidate binding-cli migrations into 000005
The binding-cli branch added 000005, 000006, and 000007 across separate
review iterations. None have shipped to production, so they should be one
atomic schema change. The consolidated 000005 drops idx_bindings_env_var,
detects conflicting (credential, LOWER(destination)) bindings, dedups
exact duplicates with their paired allow rules, and creates the
case-insensitive unique index in a single migration.
* fix(store): use %w for wrapped error formatting (errorlint)1 parent 41daecc commit 32eaa23
22 files changed
Lines changed: 8708 additions & 1039 deletions
File tree
- api
- cmd/sluice
- docs/plans/completed
- internal
- api
- store
- migrations
- vault
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
85 | | - | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
89 | 99 | | |
90 | 100 | | |
91 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
298 | 329 | | |
299 | 330 | | |
300 | 331 | | |
| |||
352 | 383 | | |
353 | 384 | | |
354 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
355 | 392 | | |
356 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
357 | 436 | | |
358 | 437 | | |
359 | 438 | | |
| |||
794 | 873 | | |
795 | 874 | | |
796 | 875 | | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
797 | 880 | | |
798 | 881 | | |
799 | 882 | | |
| |||
816 | 899 | | |
817 | 900 | | |
818 | 901 | | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
819 | 962 | | |
820 | 963 | | |
821 | 964 | | |
| |||
0 commit comments