Skip to content

feat(deploy): add local LAB runtime deployment - #3

Merged
fgirolami29 merged 6 commits into
mainfrom
feat/local-lab-deploy
Sep 19, 2026
Merged

fgirolami29 merged 6 commits into
mainfrom
feat/local-lab-deploy

Conversation

@fgirolami29

Copy link
Copy Markdown
Contributor

Obiettivo

Aggiunge un deploy locale corretto per il LAB Barbagia Musei senza copiare l'intero repository di sviluppo dentro WordPress.

Comandi

composer deploy:local:check
composer deploy:local

Contratto

deploy:local:check:

  • usa il packaging runtime esistente;
  • installa dipendenze bloccate;
  • esegue check/build/PHP lint;
  • verifica Compose + WordPress locale;
  • non modifica il LAB.

deploy:local:

  • crea backup timestamped del plugin LAB esistente;
  • estrae e copia solo il runtime package;
  • attiva cc-divi5-search-results;
  • confronta package/LAB byte per byte;
  • verifica SearchEngine;
  • verifica la versione installata.

Default:

  • LAB: $HOME/Documents/barbagiamusei-lab-wp
  • Compose: compose.yaml
  • service: wp_cron
  • plugin: /var/www/html/wp-content/plugins/cc-divi5-search-results

Aggiunti contract test e bash -n in CI.

@fgirolami29
fgirolami29 merged commit 2b42361 into main Sep 19, 2026
1 check passed
@fgirolami29
fgirolami29 deleted the feat/local-lab-deploy branch September 19, 2026 05:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fc4a8287e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/cc-deploy-local
Comment on lines +143 to +145
case "$plugin_path" in
"$wp_root"/wp-content/plugins/*)
return 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject path traversal before cleaning the plugin target

When CC_D5SR_LOCAL_PLUGIN_PATH contains traversal components, this lexical prefix check still accepts it; for example, /var/www/html/wp-content/plugins/../../ matches the pattern but resolves to /var/www/html. The identical container-side check then allows line 242 to delete every top-level entry in the WordPress root. Canonicalize both paths and require a non-empty direct child of the plugins directory before performing the cleanup.

Useful? React with 👍 / 👎.

Comment thread bin/cc-deploy-local
Comment on lines +290 to +292
installed_version="$(
docker compose -f "$compose_file" exec -T "$service" \
wp --allow-root plugin get cc-divi5-search-results --field=version \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass the configured WordPress root to WP-CLI

When CC_D5SR_LOCAL_WP_ROOT points anywhere other than the service's working directory, all of these WP-CLI calls ignore the validated root and may fail or inspect a different WordPress installation. The existing Docker deployment correctly supplies --path="$wp_root" in bin/cc-deploy-vm:435; the activation, active-state, eval, and version commands here need the same global parameter.

Useful? React with 👍 / 👎.

Comment thread bin/cc-deploy-local
Comment on lines +420 to +421
docker compose -f "$compose_file" exec -T "$service" \
wp --allow-root plugin activate cc-divi5-search-results || return 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Derive the plugin identifier from the overridden target

When CC_D5SR_LOCAL_PLUGIN_PATH uses a directory name other than cc-divi5-search-results, the package is copied to that overridden path but this command still activates the hard-coded default slug; the verification commands also query that default slug. The deploy therefore either fails after replacing the requested target or verifies an unrelated pre-existing installation instead of the deployed directory.

Useful? React with 👍 / 👎.

Comment thread bin/cc-deploy-local
Comment on lines +278 to +281
cc_d5sr_local_info "PUBLIC API"

docker compose -f "$compose_file" exec -T "$service" \
wp --allow-root eval '

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip the loaded API check when activation is disabled

When CC_D5SR_LOCAL_ACTIVATE=0 and the target plugin is inactive, wp eval does not load this plugin's entrypoint or register its autoloader, so SearchEngine cannot exist and the deployment always reports failure after modifying the LAB. Either gate this runtime API check on activation, as the active-state check already is, or explicitly load the deployed plugin for verification.

Useful? React with 👍 / 👎.

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