Skip to content

Codegen: clear stale models on regen + fetch timeouts#70

Merged
AndroidPoet merged 1 commit into
mainfrom
fix/codegen-stale-cleanup-timeouts
Jun 22, 2026
Merged

Codegen: clear stale models on regen + fetch timeouts#70
AndroidPoet merged 1 commit into
mainfrom
fix/codegen-stale-cleanup-timeouts

Conversation

@AndroidPoet

Copy link
Copy Markdown
Owner

Two robustness fixes from a codegen audit.

Stale-file cleanup (matters most for autoSync)

Before writing, the CLI and Gradle task delete the generator-owned subpackages (tables/, enums/) under the target package. A table/enum dropped from the schema no longer leaves an orphan .kt that compiles against something that no longer exists. Cleanup is scoped to those subpackages via SupabaseModelGenerator.generatedSubpackages, so hand-written code elsewhere in the package is safe. A new invariant test asserts every generated file lands under a cleaned subpackage (so cleanup can never miss a model kind).

Fetch timeouts

SchemaFetcher now sets 30s connect / 60s request timeouts, so a stalled connection fails the build with a clear error instead of hanging the compile pipeline forever.

Both codegen modules build green (tests + detekt + spotless). Lands under Unreleased.

Delete the generator-owned subpackages (tables/, enums/) before writing so a table/enum
dropped from the schema doesn't leave an orphan file — critical for autoSync (regenerates
every build). Cleanup is scoped to those subpackages, so hand-written code in the package
is untouched; a new invariant test asserts every generated file lands under a cleaned dir.
Add 30s connect / 60s request timeouts to SchemaFetcher so a stalled fetch fails fast
instead of hanging the compile.
@AndroidPoet AndroidPoet merged commit ede71ee into main Jun 22, 2026
6 of 8 checks passed
@AndroidPoet AndroidPoet deleted the fix/codegen-stale-cleanup-timeouts branch June 22, 2026 07:29
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