Skip to content

Preserve build and runtime specifications#208

Merged
TorstenDittmann merged 2 commits into
mainfrom
fix/build-specification
Jul 14, 2026
Merged

Preserve build and runtime specifications#208
TorstenDittmann merged 2 commits into
mainfrom
fix/build-specification

Conversation

@TorstenDittmann

@TorstenDittmann TorstenDittmann commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve build and runtime specifications independently when exporting functions and sites
  • apply each source specification to the matching destination field
  • retain compatibility with legacy resources that only contain specification
  • add focused serialization and compatibility coverage

Testing

  • composer lint
  • ./vendor/bin/phpunit tests/Migration/Unit/Resources
  • targeted PHPStan analysis for the changed resource classes and tests
  • PHP syntax checks for all changed PHP files

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR properly separates build and runtime specifications for migrated functions and sites, replacing the previous behavior where a single getSpecification() value was used for both. The Func and Site resource classes each gain a dedicated buildSpecification property with graceful fallback to the legacy specification field.

  • Func / Site model changes: new buildSpecification constructor param; fromArray reads runtimeSpecification/buildSpecification with specification as legacy fallback; getBuildSpecification() applies a ?: fallback to $this->specification when buildSpecification is empty.
  • Source / destination wiring: Sources/Appwrite.php now passes the two fields separately, and Destinations/Appwrite.php calls the typed accessors instead of the generic getSpecification().
  • New test: SpecificationTest covers explicit values and the legacy single-field case for Func; a parallel Site legacy test is absent.

Confidence Score: 5/5

Safe to merge — the logic change is backward-compatible and the destination correctly uses the typed accessors throughout.

All changed paths are straightforward and backward-compatible: getBuildSpecification() falls back to the legacy specification field, so existing resources without an explicit build spec continue to behave identically. The only observable gap is that jsonSerialize() emits the raw (possibly empty) buildSpecification rather than the resolved value, but the destination code reads the field through the accessor, so no migration is broken by this.

Func.php and Site.php — both jsonSerialize() implementations output the unresolved buildSpecification field instead of the value returned by getBuildSpecification().

Important Files Changed

Filename Overview
src/Migration/Resources/Functions/Func.php Adds buildSpecification property with fallback logic; jsonSerialize() emits raw (potentially empty) buildSpecification rather than the resolved value from getBuildSpecification()
src/Migration/Resources/Sites/Site.php Same pattern as Func: adds buildSpecification property with correct fallback in accessor, but jsonSerialize() outputs the raw unresolved field
src/Migration/Destinations/Appwrite.php Correctly switches from getSpecification() to getBuildSpecification() / getRuntimeSpecification() for both functions and sites; uses the method accessors so the fallback logic is respected
src/Migration/Sources/Appwrite.php Correctly separates runtimeSpecification and buildSpecification when constructing Func and Site from source data, replacing the previous combined fallback expression
tests/Migration/Unit/Resources/SpecificationTest.php New test file covering build/runtime spec separation and legacy fallback for Func; missing a Site-specific legacy-fallback test case

Reviews (2): Last reviewed commit: "Preserve build and runtime specification..." | Re-trigger Greptile

@TorstenDittmann TorstenDittmann changed the title Fix migration build specification Preserve build and runtime specifications Jul 14, 2026
@TorstenDittmann TorstenDittmann merged commit daf1008 into main Jul 14, 2026
4 checks passed
@TorstenDittmann TorstenDittmann deleted the fix/build-specification branch July 14, 2026 14:04
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.

2 participants