Skip to content

Commit 34bb44a

Browse files
Merge branch 'main' into fix/java-interface-duplicate-function-1234
2 parents fd322f5 + e9ce367 commit 34bb44a

14 files changed

Lines changed: 386 additions & 280 deletions

‎graph-ui/package-lock.json‎

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎install.ps1‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,28 @@ if ($LASTEXITCODE -ne 0) {
300300
exit 1
301301
}
302302

303+
# Place the installer beside the binary so `update` points at a local file
304+
# rather than a URL, and so the next update runs THIS release's installer.
305+
#
306+
# Sourced from the archive we just checksum-verified, and published by rename
307+
# rather than written over the live path. PowerShell parses a script fully
308+
# before executing it, so self-overwrite is less hazardous here than it is for
309+
# bash -- but rename costs nothing and keeps both platforms on one rule.
310+
# Best effort: a failure here still leaves a working install.
311+
$DownloadedInstaller = Join-Path $TmpDir "install.ps1"
312+
if (Test-Path -LiteralPath $DownloadedInstaller -PathType Leaf) {
313+
$InstallerDest = Join-Path $InstallDir "install.ps1"
314+
$InstallerTmp = "$InstallerDest.new"
315+
try {
316+
Copy-Item -LiteralPath $DownloadedInstaller -Destination $InstallerTmp -Force -ErrorAction Stop
317+
Move-Item -LiteralPath $InstallerTmp -Destination $InstallerDest -Force -ErrorAction Stop
318+
Write-Host "Installed updater -> $InstallerDest"
319+
} catch {
320+
Remove-Item -LiteralPath $InstallerTmp -Force -ErrorAction SilentlyContinue
321+
Write-Host "note: could not place install.ps1 in $InstallDir (update will explain where to find it)"
322+
}
323+
}
324+
303325
# Verify
304326
try {
305327
$ver = & $Dest --version 2>&1

‎install.sh‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,32 @@ if [ "$SKIP_CONFIG" = true ]; then
268268
fi
269269
"$DLBIN" install "${INSTALL_ARGS[@]}"
270270

271+
# Place the installer beside the binary so `update` can point at a local file
272+
# instead of a URL, and so the next update uses THIS release's installer.
273+
#
274+
# Two things make this safe. The source is the copy from the archive we just
275+
# checksum-verified -- never "$0", which does not exist under `curl | bash` and
276+
# would pin us to the OLD installer forever. And it is published by atomic
277+
# rename, never by writing over the live path: bash reads a script incrementally
278+
# by byte offset, so overwriting the file it is executing continues reading the
279+
# NEW bytes at the OLD offset. That fails silently and bizarrely, which is worse
280+
# than failing loudly.
281+
#
282+
# Best effort by design: a user who cannot write to INSTALL_DIR still gets a
283+
# working install, and `update` falls back to explaining where to find it.
284+
DL_INSTALLER="$DLDIR/install.sh"
285+
if [ -f "$DL_INSTALLER" ]; then
286+
INSTALLER_TMP="$INSTALL_DIR/.install.sh.$$"
287+
if cp "$DL_INSTALLER" "$INSTALLER_TMP" 2>/dev/null &&
288+
chmod 755 "$INSTALLER_TMP" 2>/dev/null &&
289+
mv -f "$INSTALLER_TMP" "$INSTALL_DIR/install.sh" 2>/dev/null; then
290+
echo "Installed updater -> $INSTALL_DIR/install.sh"
291+
else
292+
rm -f "$INSTALLER_TMP" 2>/dev/null || true
293+
echo "note: could not place install.sh in $INSTALL_DIR (update will explain where to find it)"
294+
fi
295+
fi
296+
271297
# Verify
272298
VERSION=$("$DEST" --version 2>&1) || {
273299
echo "error: installed binary failed to run" >&2

‎scripts/package-release.sh‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,30 @@ NAME="codebase-memory-mcp${SUFFIX}-${GOOS}-${GOARCH}"
113113
strip_release_binary() {
114114
local binary="$1"
115115
[ -f "$binary" ] || return 0
116+
# The right flags differ per format, and the WRONG ones fail silently in
117+
# the dangerous direction. Measured on the flagged darwin-arm64 artifact:
118+
#
119+
# llvm-strip --strip-all 373 symbols scanned CLEAN
120+
# strip (no flags) 378 symbols equivalent
121+
# strip -x -S 4058 symbols the state VirusTotal FLAGGED
122+
# strip -X / -u -r 4058 symbols likewise
123+
#
124+
# Apple's strip returns success for `-x -S`, so a helper that just tries
125+
# candidates until one exits 0 would quietly reship the flagged binary.
126+
# GNU/LLVM `--strip-all` is not even accepted by Apple's strip, which is why
127+
# generalising it to every platform broke the macOS build -- loudly, which
128+
# was the lucky outcome.
129+
#
130+
# So: --strip-all where it is understood, plain `strip` for Mach-O, and a
131+
# hard error when no candidate can do the job. Never a weaker fallback.
116132
local stripped=""
117133
for tool in "${STRIP:-}" llvm-strip strip; do
118134
[ -n "$tool" ] || continue
119135
command -v "$tool" >/dev/null 2>&1 || continue
120-
if [ "$GOOS" = "darwin" ]; then
121-
# -x keeps external symbols: a full strip of a Mach-O can leave an
122-
# image dyld will not load.
123-
"$tool" -x "$binary" 2>/dev/null && stripped="$tool"
124-
else
125-
"$tool" --strip-all "$binary" 2>/dev/null && stripped="$tool"
136+
if "$tool" --strip-all "$binary" 2>/dev/null; then
137+
stripped="$tool --strip-all"
138+
elif [ "$GOOS" = "darwin" ] && "$tool" "$binary" 2>/dev/null; then
139+
stripped="$tool"
126140
fi
127141
[ -n "$stripped" ] && break
128142
done

‎scripts/run-test-wave.py‎

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,55 @@ def start_suite(
123123
)
124124

125125

126+
def windows_descendants(pid: int, timeout: int) -> bool:
127+
"""True if any live process still claims `pid` as its parent.
128+
129+
Used only when the suite leader has already exited: `taskkill /T` cannot
130+
walk a tree from a dead PID, so cleanup is proven by asking whether anything
131+
is still parented to it. One level deep on purpose -- Windows does not
132+
reparent orphans, so a grandchild keeps pointing at its own (dead) parent
133+
and would not be found here. That is a weaker proof than taskkill /T, which
134+
is why it is reserved for the case where the strong proof is impossible.
135+
"""
136+
try:
137+
completed = subprocess.run(
138+
[
139+
"powershell.exe",
140+
"-NoProfile",
141+
"-NonInteractive",
142+
"-Command",
143+
"@(Get-CimInstance Win32_Process -Filter "
144+
f"'ParentProcessId={pid}').Count",
145+
],
146+
check=False,
147+
stdin=subprocess.DEVNULL,
148+
capture_output=True,
149+
text=True,
150+
timeout=timeout,
151+
)
152+
except (OSError, subprocess.TimeoutExpired):
153+
return True # cannot prove absence -> assume the worst
154+
if completed.returncode != 0:
155+
return True
156+
return (completed.stdout or "").strip() not in ("0", "")
157+
158+
126159
def terminate_process_tree(active: ActiveSuite, kill_grace: int) -> None:
127160
process = active.process
128161
leader_exited = process.poll() is not None
129162
if os.name == "nt":
130163
if leader_exited:
131-
raise RuntimeError(
132-
f"suite {active.name!r} leader exited before Windows tree cleanup "
133-
"could be proven"
134-
)
164+
# The leader can exit on its own between the timeout decision and
165+
# this call. Refusing outright made the harness itself lose a race:
166+
# a natural exit at the wrong moment failed the whole wave, which is
167+
# how a deliberately-hanging fixture suite reddened a release run.
168+
# taskkill /T cannot walk a tree from a dead PID, so prove cleanup
169+
# the only way still available -- nothing is parented to it.
170+
if windows_descendants(process.pid, kill_grace):
171+
raise RuntimeError(
172+
f"suite {active.name!r} leader exited leaving live descendants"
173+
)
174+
return
135175
try:
136176
completed = subprocess.run(
137177
[

0 commit comments

Comments
 (0)