Skip to content

Bootstrap: fresh-clone apply-patches.sh aborts (php-types magic-script-const / first-class-callable anchors vs yield-from) #3033

Description

@PurHur

Milestone

M0/M5 prerequisite — parent #1492. Breaks every fresh git clone + composer install + script/apply-patches.sh (and therefore north-star5-verify, ci-local, all selfhost probes) on master.

Problem

On a clean tree, script/apply-patches.sh aborts:

php-types-magic-script-const: TypeReconstructor anchor not found
apply-patches: 1 patch(es) failed

apply-patches.sh runs under set -euo pipefail, so the first failing overlay aborts the whole run — vendor patches after it never apply.

Root cause

php-types-yield-from.patch inserts a case 'Expr_YieldFrom': line into the resolveOp switch of vendor/ircmaxell/php-types/lib/PHPTypes/TypeReconstructor.php:

            case 'Expr_Yield':
            case 'Expr_YieldFrom':   // inserted by php-types-yield-from.patch
            case 'Expr_Include':
                // TODO: we may be able to determine these...
                return false;

It runs before the apply_php_types_magic_script_const_overlay and apply_php_types_first_class_callable_overlay overlays. Those overlays anchor on the pre-yield-from text (Expr_Yield immediately followed by Expr_Include), so after yield-from has run, neither anchor matches and both overlays fail.

Fix

Include the case 'Expr_YieldFrom': line in all 6 anchor strings of the two overlays so they match the post-yield-from file. Verified: after the change script/apply-patches.sh applies cleanly (exit 0) on a fresh clone and is idempotent on re-run.

Repro

git clone https://github.com/PurHur/php-compiler.git fresh && cd fresh
composer install --ignore-platform-reqs
./script/apply-patches.sh   # aborts at php-types-magic-script-const on master

Done when

  • script/apply-patches.sh exits 0 on a fresh composer install tree
  • Re-running is idempotent (all "Skip … already applied")
  • make north-star5-verify reaches its vendor-prelink steps without a patch abort

Activity

  1. PurHur commented on May 28, 2026

    @PurHur
    OwnerAuthor

    Repro confirmed 2026-05-28 on this workspace after backlog probe: apply-patches.sh fails at php-types-yield-from.patch (earlier patches already applied). Blocks fresh-clone hygiene before vendor work; keep on M0/M5 critical path ahead of #3035.

  2. PurHur commented on May 29, 2026

    @PurHur
    OwnerAuthor

    Fresh-clone anchor drift fixed on master via #3034 (merged). Remaining idempotent re-run failure tracked in #3042 (2026-05-29 host probe: yield-from patch re-apply abort).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions