Skip to content

Commit 6548a52

Browse files
committed
docs(envlite): record macOS realpath() follow-up in plan
Plan v1 omitted the /var/folders -> /private/var/folders symlink quirk that surfaces when comparing sys_get_temp_dir() output against PHP's __DIR__. Update the Task 1 code block to match what shipped (realpath wrap + assertion) and add a Post-implementation notes section so the deviation from plan v1 is visible to future readers.
1 parent fc873b3 commit 6548a52

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

docs/superpowers/plans/2026-05-13-fix-envlite-router-docroot.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ function envlite_test_router_wait_for_bind(int $port, float $timeout_seconds = 3
6666

6767
function test_router_serves_from_document_root_not_router_directory() {
6868
// Build a fixture "site" that does NOT share a parent with router.php.
69-
$site = envlite_test_tmpdir('router-docroot');
69+
// realpath() normalizes /tmp -> /private/tmp on macOS so the assert
70+
// below matches __DIR__ from the fixture's index.php (which resolves
71+
// symlinks). On Linux this is a no-op.
72+
$site = realpath(envlite_test_tmpdir('router-docroot'));
73+
envlite_assert($site !== false, 'tmp fixture directory must resolve via realpath');
7074
file_put_contents("$site/index.php", "<?php echo 'FIXTURE_OK ' . __DIR__;");
7175

7276
// Use the real shipped router so we exercise its path resolution.
@@ -237,3 +241,11 @@ repo's src/."
237241
- `envlite_test_tmpdir` is defined in `tests/test_manifest.php:2` and reused here (matching the pattern in `test_smoke.php:3` and `test_atomic.php`).
238242
- `envlite_assert` is defined in `tests/harness.php:2`.
239243
- `proc_open` with `$descriptors` array form, then `proc_terminate`/`proc_close` — standard PHP API.
244+
245+
---
246+
247+
## Post-implementation notes
248+
249+
These deviated from the plan as originally written and are recorded here so future readers don't think the plan and the committed code drifted by accident.
250+
251+
- **macOS tmpdir symlink (commit `271d7f651d`).** Plan v1 wrote `$site = envlite_test_tmpdir('router-docroot')` directly. On macOS `sys_get_temp_dir()` returns `/var/folders/...` while PHP's `__DIR__` in the fixture's `index.php` resolves symlinks to `/private/var/folders/...`, so the `'FIXTURE_OK ' . $site` assertion fails even when the router is serving the fixture correctly. Fix: wrap the tmpdir in `realpath()` and assert it resolved, before the fixture write. The Task 1 code block above has been updated in-place to match what shipped; on Linux the change is a no-op. A more durable fix would be to push the `realpath()` into `envlite_test_tmpdir` itself so every test that compares tmp paths against `__DIR__`-resolved values is portable by default — deferred until a second caller needs it.

0 commit comments

Comments
 (0)