Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(dev): preserve expired environment data on explicit renewal (#11223)
Danila Katalshov850f9c1ecfa3
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 4b735836c9..95b069919a 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -382,7 +382,9 @@ Three properties are worth knowing because the old flow lacked them:- **Temporary environments have a best-effort fallback.** `make upARGS=--ephemeral` records a 24-hour TTL. The next `make up` automaticallycollects expired and directory-less environments; `make gc` runs the same- collection explicitly.+ collection explicitly. Use `make up ARGS="--ttl 48"` to renew a checkout+ whose environment is still registered, even after expiry. The command keeps+ that environment's data and gives it a new 48-hour TTL.Run any command inside an environment's variables without repeating them:diff --git a/apps/docs/content/docs/developers/contributing.fr.mdx b/apps/docs/content/docs/developers/contributing.fr.mdxindex c84a7e8e46..fec5316433 100644--- a/apps/docs/content/docs/developers/contributing.fr.mdx+++ b/apps/docs/content/docs/developers/contributing.fr.mdx@@ -131,6 +131,8 @@ Pour exécuter une commande CLI depuis les sources :make cli ARGS="issue list"```+Pour renouveler un environnement encore enregistré, même s’il a expiré, lancez `make up ARGS="--ttl 48"` depuis sa copie de travail. Ses données sont conservées et sa durée de vie est prolongée de 48 heures à compter de la commande.+## Modifier des fonctionnalités frontendPlacez les fonctionnalités nécessaires à la fois à Web et à Desktop selon leur responsabilité :diff --git a/apps/docs/content/docs/developers/contributing.ja.mdx b/apps/docs/content/docs/developers/contributing.ja.mdxindex 80b09032c8..6e8a2a9f1f 100644--- a/apps/docs/content/docs/developers/contributing.ja.mdx+++ b/apps/docs/content/docs/developers/contributing.ja.mdx@@ -123,6 +123,8 @@ make sqlcmake cli ARGS="issue list"```+登録が残っている環境を更新するには、期限切れの場合でも、そのチェックアウトで `make up ARGS="--ttl 48"` を実行します。データは保持され、有効期限は実行時点から 48 時間後になります。+## フロントエンド機能の変更Web と Desktop の両方で必要な機能は、責務に応じて配置します。diff --git a/apps/docs/content/docs/developers/contributing.ko.mdx b/apps/docs/content/docs/developers/contributing.ko.mdxindex c644d71db5..f99afeb86a 100644--- a/apps/docs/content/docs/developers/contributing.ko.mdx+++ b/apps/docs/content/docs/developers/contributing.ko.mdx@@ -123,6 +123,8 @@ make sqlcmake cli ARGS="issue list"```+아직 등록된 환경은 만료된 후에도 해당 체크아웃에서 `make up ARGS="--ttl 48"`을 실행해 갱신할 수 있습니다. 데이터는 유지되며 만료 시점은 실행 시점부터 48시간 뒤로 설정됩니다.+## 프런트엔드 기능 변경Web과 Desktop에 모두 필요한 기능은 역할에 따라 배치합니다.diff --git a/apps/docs/content/docs/developers/contributing.mdx b/apps/docs/content/docs/developers/contributing.mdxindex b337b517de..f8452e29b0 100644--- a/apps/docs/content/docs/developers/contributing.mdx+++ b/apps/docs/content/docs/developers/contributing.mdx@@ -131,6 +131,8 @@ To run a CLI command from source:make cli ARGS="issue list"```+To renew an environment that is still registered, including one that has expired, run `make up ARGS="--ttl 48"` from its checkout. This preserves its data and sets a new 48-hour TTL.+## Changing frontend featuresPlace features needed by both Web and Desktop according to responsibility:diff --git a/apps/docs/content/docs/developers/contributing.zh-Hant.mdx b/apps/docs/content/docs/developers/contributing.zh-Hant.mdxindex ff832972dc..28bd255f7c 100644--- a/apps/docs/content/docs/developers/contributing.zh-Hant.mdx+++ b/apps/docs/content/docs/developers/contributing.zh-Hant.mdx@@ -123,6 +123,8 @@ make sqlcmake cli ARGS="issue list"```+如果環境仍在登錄表中,即使已經過期,也可以在對應的檢出目錄執行 `make up ARGS="--ttl 48"` 來續期。資料會保留,有效期限從命令執行時起重新計算 48 小時。+## 修改前端功能Web 與 Desktop 都需要的功能按職責放置:diff --git a/apps/docs/content/docs/developers/contributing.zh.mdx b/apps/docs/content/docs/developers/contributing.zh.mdxindex 25e26164ed..f25ef7d056 100644--- a/apps/docs/content/docs/developers/contributing.zh.mdx+++ b/apps/docs/content/docs/developers/contributing.zh.mdx@@ -123,6 +123,8 @@ make sqlcmake cli ARGS="issue list"```+如果环境仍在注册表中,即使已经过期,也可以在对应的检出目录中运行 `make up ARGS="--ttl 48"` 来续期。数据会保留,有效期从命令执行时起重新计算 48 小时。+## 修改前端功能Web 与 Desktop 都需要的功能按职责放置:diff --git a/scripts/dev-env.sh b/scripts/dev-env.shindex 94e5692833..49b315c9a8 100755--- a/scripts/dev-env.sh+++ b/scripts/dev-env.sh@@ -1787,7 +1787,13 @@ cmd_up() {# No resident cleanup service is required: every future environment start is# a safe opportunity to collect expired or directory-less environments.- cmd_gc --auto+ # An explicit lifecycle change applies to this checkout's existing+ # environment, including an expired one. Keep it for the renewal below.+ local gc_args=(--auto)+ if [ "$lifecycle_requested" = 1 ]; then+ gc_args+=(--keep-current-checkout)+ fi+ cmd_gc "${gc_args[@]}"step "Prerequisites"local missing=() tool needed="node go curl"@@ -2159,11 +2165,12 @@ EOF# in psql: an environment whose directory is gone, or whose TTL has passed, has# no owner left to stop it.cmd_gc() {- local dry_run=0 automatic=0 name age_hours created_epoch expiry_epoch reason+ local dry_run=0 automatic=0 keep_current_checkout=0 name age_hours created_epoch expiry_epoch reasonwhile [ $# -gt 0 ]; docase "$1" in--dry-run) dry_run=1 ;;--auto) automatic=1 ;;+ --keep-current-checkout) keep_current_checkout=1 ;;*) die "Unknown flag for gc: $1" ;;esacshift@@ -2173,6 +2180,9 @@ cmd_gc() {[ -n "$name" ] || continue(load_manifest "$name"+ if [ "$keep_current_checkout" = 1 ] && [ "$DIR" = "$REPO_ROOT" ]; then+ exit 0+ fireason=""[ -d "$DIR" ] || reason="its checkout directory is gone"if [ -z "$reason" ] && [ "${TTL_HOURS:-0}" != 0 ]; thendiff --git a/scripts/dev-env.test.sh b/scripts/dev-env.test.shindex 17eb9d9dea..8b43a87228 100644--- a/scripts/dev-env.test.sh+++ b/scripts/dev-env.test.sh@@ -1017,6 +1017,46 @@ oneline_up "$oneline_checkout" GO_ENV_LOG="$oneline_env_log" > "$out" 2>&1 || stgrep -Fq "DROP DATABASE IF EXISTS \"$DB_NAME\"" "$psql_log" || fail "destroy did not drop the slot database")+# An explicit TTL renewal must reuse this checkout even after its previous+# expiry. The automatic collection of another checkout still takes place.+renewal_checkout="$tmp_dir/renewal-checkout"+status=0+oneline_up "$renewal_checkout" > "$out" 2>&1 || status=$?+[ "$status" -ne 0 ] || fail "renewal fixture unexpectedly started a backend"+require_contains "$out" "Migrations failed"+(+ export MULTICA_DEV_HOME="$tmp_dir/dev-renewal-checkout"+ export PATH="$oneline_bin:$PATH"+ manifests=("$MULTICA_DEV_HOME"/envs/*/manifest.env)+ manifest="${manifests[0]}"+ # shellcheck disable=SC1090+ . "$manifest"+ expired=2000-01-01T00:00:00Z+ printf 'EXPIRES_AT=%s\n' "$expired" >> "$manifest"+ neighbor="expired-neighbor-$((OFFSET + 1))"+ neighbor_checkout="$tmp_dir/expired-neighbor"+ mkdir -p "$neighbor_checkout"+ write_manifest "$neighbor" "$neighbor_checkout" "$((OFFSET + 1))"+ printf 'TTL_HOURS=24\nEXPIRES_AT=%s\n' "$expired" >> "$MULTICA_DEV_HOME/envs/$neighbor/manifest.env"++ cd "$renewal_checkout"+ psql_log="$tmp_dir/psql-renewal.log"+ status=0+ PSQL_LOG="$psql_log" bash scripts/dev-env.sh up --components api --ttl 48 > "$out" 2>&1 || status=$?+ [ "$status" -ne 0 ] || fail "renewal fixture unexpectedly started a backend"+ require_contains "$out" "Migrations failed"+ require_contains "$out" "Reusing environment $NAME"+ if grep -Fq "DROP DATABASE IF EXISTS \"$DB_NAME\"" "$psql_log"; then+ fail "renewing an expired environment dropped its database"+ fi+ [ ! -f "$MULTICA_DEV_HOME/envs/$neighbor/manifest.env" ] \+ || fail "renewal prevented collecting another expired environment"+ # shellcheck disable=SC1090+ . "$manifest"+ [ "$TTL_HOURS" = 48 ] && [ "$EXPIRES_AT" != "$expired" ] \+ || fail "renewal did not update the recorded expiration"+)+# A setting the rewrite does not own can still win when the file is loaded# back; `up` must refuse rather than register the shared port.status=0