mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-12 16:08:59 +02:00
fix: adversarial round — the P0 finalize fail-safe and 12 hardened findings
Three adversarial passes (Claude fresh-context, Codex chaos, Codex structured with P1 gate) on the full wave diff. Multi-source findings, all fixed: - P0: finalize_queue is now explicit-delete-only — a record is unlinked ONLY when classification proves it staged or dropped; a classifier crash, a missing class file, or a malformed pulled .brain-privacy-map.json (which previously nuked the whole snapshotted queue, remotely triggerable) now retains everything, warns, and re-drains next run. load_privacy_map treats corrupt maps as retain-all, never as empty. - next-version cannot silently drop a live claim: unreadable advertised refs get a targeted --depth=1 fetch + retry; still-unreadable claims surface as UNKNOWN warnings instead of duplicate-version silence. - session-update lock: ownership-checked EXIT trap (a TTL-reclaimed holder can no longer delete the new holder's lock) + a 5-min background heartbeat so a legitimately-slow pull/setup is never reclaimed while alive. - ensure-event collapses ALL same-(event,source) duplicates to one canonical entry; unique per-process tmp path; setup call sites surface (not swallow) the hardened refusals. - memory-ingest: --limit counts only policy-permitted pages (denied records no longer starve permitted ones); --probe applies the same policy filter as --bulk (skipped_policy_* fields on the report). - version-bump repair accepts a genuine literal 0.0.0.0 VERSION file. - slug heal restricted to the stray-.git shape — package.json-anchored wrapper roots keep their legit sticky identity (#2212 preserved). - brain-sync: idle fast path sees leftover .migrating records; unparseable spool records quarantine instead of warning forever; migration comment stops overclaiming the transition-window race. - CDP throttling justifications document override persistence (callers own restoration), pinned in the allowlist test. Deferred with record: deny retroactivity for already-ingested pages (P2 TODO, same semantics as the code-import gate); legacy-migration tail race (transition-window, requires pre-spool writers). 288 pass / 0 fail across the 10 touched suites. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
b7d44c45b4
commit
fd0dbdeea2
+13
-8
@@ -188,12 +188,16 @@ _resolve_remote() {
|
||||
# - Old-bug shape (#1125): the pre-walk-up resolver cached basename(pwd)
|
||||
# for a SUBDIRECTORY of the real project — cached == pwd basename while
|
||||
# the walk-up says pwd is NOT the project root.
|
||||
# - Degraded-ancestor shape (2026-08-17): the pre-remote-first resolver
|
||||
# cached basename(PROJECT_ROOT) for a marker-only ancestor (stray
|
||||
# ~/.git) that is NOT the remote-bearing repo — cached == the marker
|
||||
# root's basename while a remote-bearing repo BELOW it exists. Legit
|
||||
# #2212 stickiness is safe: there the repo that adopted the remote IS
|
||||
# the marker root (REMOTE_ROOT == PROJECT_ROOT), so the heal never fires.
|
||||
# - Degraded-ancestor shape (2026-08-17), STRAY-REPO shape ONLY: the
|
||||
# pre-remote-first resolver cached basename(PROJECT_ROOT) for an
|
||||
# ancestor anchored by a .git entry whose origin does NOT resolve (the
|
||||
# stray empty ~/.git live bug) while a remote-bearing repo BELOW it
|
||||
# exists. A marker root anchored by package.json / pyproject etc. with
|
||||
# NO .git is legit #2212 sticky identity (a monorepo wrapper that used
|
||||
# gstack before its inner dir grew a remote) and must NOT be healed.
|
||||
# Legit remote-adopting stickiness is safe too: there the repo that
|
||||
# adopted the remote IS the marker root (REMOTE_ROOT == PROJECT_ROOT),
|
||||
# so the heal never fires.
|
||||
if [[ -z "$SLUG" && -f "$CACHE_FILE" ]]; then
|
||||
_CACHED=$(cat "$CACHE_FILE" 2>/dev/null | tr -cd 'a-zA-Z0-9._-')
|
||||
if [[ -n "$_CACHED" ]]; then
|
||||
@@ -204,9 +208,10 @@ if [[ -z "$SLUG" && -f "$CACHE_FILE" ]]; then
|
||||
fi
|
||||
if [[ "$_CACHED" == "$_PWD_BASE" && -n "$PROJECT_ROOT" && "$PROJECT_ROOT" != "$PROJECT_DIR" ]]; then
|
||||
: # old-bug shape — recompute below and self-heal the cache
|
||||
elif [[ -n "$PROJECT_ROOT" && "$_CACHED" == "$_ROOT_BASE" ]] \
|
||||
elif [[ -n "$PROJECT_ROOT" && "$_CACHED" == "$_ROOT_BASE" && -e "$PROJECT_ROOT/.git" ]] \
|
||||
&& ! git -C "$PROJECT_ROOT" remote get-url origin >/dev/null 2>&1 \
|
||||
&& { _resolve_remote; [[ -n "$REMOTE_URL" && "$REMOTE_ROOT" != "$PROJECT_ROOT" ]]; }; then
|
||||
: # degraded-ancestor shape — recompute below and self-heal the cache
|
||||
: # degraded-ancestor (stray-repo) shape — recompute below and self-heal the cache
|
||||
else
|
||||
SLUG="$_CACHED"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user