Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
90dc376
docs(spec): aippatch — proto/SQL PATCH framework design
btc May 8, 2026
780ef4e
spec: idle auto-cancel design (3 review rounds applied)
btc May 8, 2026
c5454a1
docs(spec): aippatch — apply round-1 review fixes
btc May 8, 2026
9e74abb
docs(spec): aippatch — apply round-2 review fixes
btc May 8, 2026
73e32ae
docs(spec): aippatch — apply round-3 review fixes (final pass)
btc May 8, 2026
c79c7df
plan: idle auto-cancel implementation
btc May 8, 2026
7f87d0b
docs(spec): aippatch — apply round-4 review fixes
btc May 8, 2026
fe3c0ed
docs(spec): aippatch — apply round-5 review fixes
btc May 8, 2026
f8808ab
docs(spec): aippatch — apply round-6 review fixes
btc May 8, 2026
1b53fe9
plan: aippatch implementation — 45 TDD tasks across 9 phases
btc May 8, 2026
4659137
plan(aippatch): apply round-1 review fixes
btc May 8, 2026
243be9b
plan(aippatch): apply round-2 review fixes
btc May 8, 2026
4aed796
plan(aippatch): apply round-3 review polish
btc May 8, 2026
f60fd5d
chore(deps): add huandu/go-sqlbuilder and pg_query_go/v6 for aippatch
btc May 8, 2026
6f8a4ea
chore(build): emit buf.binpb FileDescriptorSet from make generate
btc May 8, 2026
34ebeb7
feat(aippatch): bootstrap runtime package skeleton
btc May 8, 2026
9049e4a
feat(aippatch): runtime types — Mapping, Binding, AutoSetClause, Enum…
btc May 8, 2026
80a873f
docs(aippatch): clarify AutoSetClause comment — codegen-time validation
btc May 8, 2026
2b405cc
feat(aippatch): connect.* error helpers
btc May 8, 2026
1f8fd4e
test(aippatch): fixture proto + migrations for self-contained tests
btc May 8, 2026
08c06a0
style(aippatch): proto file structure — imports before options
btc May 8, 2026
7f11be2
test(aippatch): testcontainer helper for runtime tests
btc May 8, 2026
5bb443a
feat(aippatch): Validate — happy path with binding indexing and proto…
btc May 8, 2026
f48482a
style(aippatch): gofmt validate_test.go
btc May 8, 2026
d51060b
feat(aippatch): Validate — codec subset selection and FromText constr…
btc May 8, 2026
5034ab9
test(aippatch): Validate — error cases (missing field, duplicates, mi…
btc May 8, 2026
c1f5a06
feat(aippatch): encode — scalar pass-through (string, bool, int32, in…
btc May 8, 2026
c9f782b
test(aippatch): encode — timestamp codec
btc May 8, 2026
6850a5d
feat(aippatch): encode — enum codec via ToText
btc May 8, 2026
f01fe70
feat(aippatch): decode — scalars (string, bool, int32 from int4/int2,…
btc May 8, 2026
493fe73
feat(aippatch): decode — uuid via google/uuid canonical formatter
btc May 8, 2026
151185c
feat(aippatch): decode — timestamp from time.Time
btc May 8, 2026
1a29c37
feat(aippatch): decode — enum from text via FromText
btc May 8, 2026
2002428
feat(aippatch): Apply — sanity guards (nil mapping, unvalidated, nil …
btc May 8, 2026
b25de54
feat(aippatch): Apply — empty mask handling and UpdateAllWritable def…
btc May 8, 2026
4e97c56
feat(aippatch): Apply — mask path validation (nested, unknown, non-wr…
btc May 8, 2026
d808f4b
feat(aippatch): Apply — full happy-path SET/WHERE/RETURNING via go-sq…
btc May 8, 2026
84ddaf6
fix(aippatch): classify encode errors as Internal, not InvalidArg
btc May 8, 2026
8434467
test(aippatch): Apply — soft-delete and PK mismatch return NotFound
btc May 8, 2026
f8ba3d6
test(aippatch): Apply — Op.Where validates bound columns
btc May 8, 2026
7990581
test(aippatch): Apply — AutoSet (clock_timestamp) bumps updated_at
btc May 8, 2026
2bdd65b
test(aippatch): Apply — round-trip all v0 codec paths against testcon…
btc May 8, 2026
c13d421
feat(aippatchgen): bootstrap CLI with flag parsing
btc May 8, 2026
4d218b1
feat(aippatchgen): yaml schema + loader
btc May 8, 2026
ba30d9a
feat(aippatchgen): proto FileDescriptorSet reader
btc May 8, 2026
ec0a24c
feat(aippatchgen): SQL migration parser via pg_query_go (CREATE/ALTER…
btc May 8, 2026
2a0c982
chore: promote pg_query_go/v6 from indirect to direct dep
btc May 8, 2026
e5e28d0
feat(aippatchgen): ResourceModel and Diagnostic types
btc May 8, 2026
5176efe
feat(aippatchgen): processAll/processResource skeleton (compatibility…
btc May 8, 2026
16e736f
feat(aippatchgen): compatibility table per spec (StringKind/BoolKind/…
btc May 8, 2026
9b41723
test(aippatchgen): diagnostic golden tests (nullable, bad identifier,…
btc May 8, 2026
0f80b27
feat(aippatchgen): resource emit template + gofmt
btc May 8, 2026
627eaa6
feat(aippatchgen): init.gen.go template (Codecs registry + InitPatches)
btc May 8, 2026
21701a3
feat(aippatchgen): run() pipeline + --check mode
btc May 8, 2026
17ea83d
feat: add aippatch.yaml — User resource configuration
btc May 8, 2026
b249cbb
build: wire aippatchgen into make generate + make test
btc May 8, 2026
2cf3640
feat: generate internal/patches/{user,init}.gen.go via aippatchgen
btc May 8, 2026
a102898
feat: wire patches.InitPatches() into drill startup
btc May 8, 2026
c8b6064
refactor(rpc/user): UpdateProfile uses aippatch.Apply via patches.Use…
btc May 8, 2026
3049622
refactor(backend): remove UpdateDisplayName (superseded by aippatch.A…
btc May 9, 2026
b37809f
style(rpc/user): gofmt server.go — import ordering
btc May 9, 2026
11e8884
test(aippatchgen): add diagnostic golden tests for auto_set edge cases
btc May 9, 2026
71dac9a
test(aippatch): TestApply_CloneOfPreservesInputFields
btc May 9, 2026
7478faf
refactor(aippatchgen): remove dead autoSetCols map
btc May 9, 2026
42b8b2c
refactor(aippatch): add connectUnimplemented helper for code symmetry
btc May 9, 2026
b62aac3
fix(aippatchgen): pointer-ize signatures to satisfy gocritic lint
btc May 9, 2026
aea3308
fix(aippatchgen): tighten AutoSet literal validation
btc May 9, 2026
e4b72d4
fix(aippatch): enum-out-of-map returns InvalidArgument
btc May 9, 2026
c388756
feat(aippatchgen): validate PK/SoftDelete column existence
btc May 9, 2026
96472d5
feat(aippatchgen): validate proto_enum descriptor + yaml map keys
btc May 9, 2026
1cebce5
test(aippatch): TestApply_ParticipatesInCallerTx
btc May 9, 2026
db5c0d9
docs(aippatch): doc comments on Apply + Binding fields
btc May 9, 2026
6467f7c
refactor(aippatchgen): use strconv.Quote for template string interpol…
btc May 9, 2026
e6a3dba
refactor(aippatch): use %w for error wrapping in apply.go
btc May 9, 2026
18aa164
fix(aippatchgen): pointer-ize remaining gocritic violations in main.go
btc May 9, 2026
f082b76
refactor(aippatch): round-2 polish
btc May 9, 2026
057b1b0
refactor(aippatchgen): dedupe codec diagnostics via brokenCodecs set
btc May 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ web/dist/
/drill
/drillctl
/stripescenario
/aippatchgen
cov.out
coverage.out
coverage-cross.out
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test-protos:
@echo "=== buf generate (verify clean) ==="
buf generate
@git diff --exit-code internal/pb/ web/src/pb/ || (echo "FAIL: buf generate produced uncommitted changes" && exit 1)
go run ./thirdparty/aippatch/cmd/aippatchgen --check

test-frontend:
@echo "=== frontend deps ==="
Expand Down Expand Up @@ -124,6 +125,9 @@ deps:
# Regenerate protobuf code from .proto sources.
generate:
buf generate
buf build -o buf.binpb
sqlc generate
go run ./thirdparty/aippatch/cmd/aippatchgen

# Run golangci-lint (same config as CI).
lint:
Expand Down
26 changes: 26 additions & 0 deletions aippatch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
codecs:
enum_role:
proto_enum: drill.v1.UserRole
map:
USER_ROLE_CANDIDATE: candidate
USER_ROLE_ADMIN: admin
enum_plan:
proto_enum: drill.v1.UserPlan
map:
USER_PLAN_FREE: free
USER_PLAN_PRO: pro

resources:
- message: drill.v1.User
table: users
pk: id
soft_delete: deleted_at
empty_mask: error
writable: [display_name]
go_package_path: github.com/btc/drill/internal/pb/drill/v1
auto_set:
updated_at: NOW()
overrides:
create_time: { column: created_at }
role: { codec: enum_role }
plan: { codec: enum_plan }
Binary file added buf.binpb
Binary file not shown.
5 changes: 5 additions & 0 deletions cmd/drill/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/btc/drill/internal/events"
"github.com/btc/drill/internal/handler"
"github.com/btc/drill/internal/migrate"
"github.com/btc/drill/internal/patches"
)

func main() {
Expand Down Expand Up @@ -79,6 +80,10 @@ func runWithContext(ctx context.Context) error {
}
defer b.Close()

if err := patches.InitPatches(); err != nil {
return fmt.Errorf("aippatch: %w", err)
}

oauthStateKey := auth.DeriveKey(cfg.Auth.TokenSecret, "oauth-state")
auth.SetupGothProviders(&cfg.OAuth, cfg.Auth.BaseURL, oauthStateKey)

Expand Down
Loading
Loading