Commit Graph

2 Commits

Author SHA1 Message Date
Garry Tan f5c2fee3a9 test: wave coverage for sanitizer, link_or_copy, build script, doc drift
Four new test files (29 cases total):

browse/test/server-sanitize-surrogates.test.ts:
  - 11 unit cases for sanitizeLoneSurrogates (passthrough, valid pair,
    lone high/low mid-string, trailing/leading lone, adjacent doubles,
    pair-then-lone, lone-then-pair, empty)
  - 2 bug-repro tests pinning the regression intent (UTF-8 round-trip,
    JSON.parse round-trip with codepoint assertion)
  - 4 wiring invariants asserting the architectural choke points stay
    intact (handleCommandInternalImpl rename, central sanitization
    line, sanitizeReplacer function exists, SSE producers stringify
    with replacer)
  Function extracted from server.ts via regex + eval'd in test scope
  so no production-code export is needed.

test/setup-windows-fallback.test.ts:
  - Static invariant (D7): zero raw `ln` calls outside the
    _link_or_copy helper body and comments
  - Helper-existence assertions
  - 4-cell behavior matrix (file/dir × Windows/Unix) via awk-style
    helper extraction + bash -c sourcing
  - Windows-note printer registration check
  Mirrors test/setup-conductor-worktree.test.ts patterns.

test/build-script-shell-compat.test.ts:
  - Regex assertion that package.json scripts.* contain no bash brace
    groups (Bun-Windows-hostile)
  - Subshell-precedence check for `.version` redirects
  Strips single-quoted strings before regexing so embedded JS code
  inside echo '...' doesn't false-positive.

test/docs-config-keys.test.ts:
  - DEPRECATED_KEYS denylist scanned across docs/**/*.md
  - Round-trip test for `gstack-config get artifacts_sync_mode`
  Defends the v1.27.0.0 rename from doc drift.

Updates to two existing tests:
  - test/setup-conductor-worktree.test.ts: expect `_link_or_copy`
    instead of `ln -snf` at the Conductor-worktree guard call site
  - test/gen-skill-docs.test.ts: same swap at three assertion sites
    (Codex section, Claude link_claude_skill_dirs body, Codex
    link_codex_skill_dirs body)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 14:02:10 -07:00
Garry Tan dc6252d1df v1.33.2.0 fix: setup guards against Conductor worktree pollution of global install (#1446)
* fix(setup): skip Claude skill registration when run from a worktree of the global install

Add a guard before `ln -snf "$SOURCE_GSTACK_DIR" "$HOME/.claude/skills/gstack"`
that detects whether the target already exists as a separate real directory.
On macOS/BSD, `ln -snf SRC DST` does not replace a real DST — it creates
DST/$(basename SRC) → SRC inside it. Running ./setup from each Conductor
worktree of the gstack repo was leaking per-worktree child symlinks into the
global install, which Claude Code then picked up as separate top-level skills.

The guard uses `cd ... && pwd -P` to resolve the existing real dir and compare
against the source (mirroring setup's own `SOURCE_GSTACK_DIR` resolution).
When they differ, prints a four-line remediation hint naming both paths and
exits the Claude registration branch cleanly. Binaries still build locally.

The four other code paths through this branch are unchanged: fresh install,
retarget an existing symlink, self-rerun where the existing dir resolves to
the same source, and --local installs.

Includes 8 tests covering static guard placement, `pwd -P` resolution, the
remediation message, a behavioral reproduction of the BSD `ln -snf` child-
symlink bug, and every branch of the guard (skip on real-dir-elsewhere, allow
on fresh, allow on existing symlink, allow on self-rerun).

* chore: bump version and changelog (v1.33.2.0)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 20:35:58 -07:00