Compare commits
1 Commits
fix/1427
...
burn/1453-
| Author | SHA1 | Date | |
|---|---|---|---|
| b5e4210e6e |
@@ -44,13 +44,9 @@ class MemPalaceResult:
|
||||
|
||||
|
||||
def _get_client(palace_path: Path):
|
||||
"""Return a ChromaDB persistent client, or raise MemPalaceUnavailable.
|
||||
|
||||
Telemetry is disabled for sovereignty — no data leaks to Chroma Inc.
|
||||
"""
|
||||
"""Return a ChromaDB persistent client, or raise MemPalaceUnavailable."""
|
||||
try:
|
||||
import chromadb # type: ignore
|
||||
from chromadb.config import Settings
|
||||
except ImportError as exc:
|
||||
raise MemPalaceUnavailable(
|
||||
"ChromaDB is not installed. "
|
||||
@@ -63,10 +59,7 @@ def _get_client(palace_path: Path):
|
||||
"Run 'mempalace mine' to initialise the palace."
|
||||
)
|
||||
|
||||
return chromadb.PersistentClient(
|
||||
path=str(palace_path),
|
||||
settings=Settings(anonymized_telemetry=False),
|
||||
)
|
||||
return chromadb.PersistentClient(path=str(palace_path))
|
||||
|
||||
|
||||
def search_memories(
|
||||
|
||||
@@ -26,7 +26,7 @@ HERMES_CONTEXT = [
|
||||
|
||||
class RelevanceEngine:
|
||||
def __init__(self, collection_name: str = "deep_dive"):
|
||||
self.client = chromadb.PersistentClient(path="./chroma_db", settings=chromadb.config.Settings(anonymized_telemetry=False))
|
||||
self.client = chromadb.PersistentClient(path="./chroma_db")
|
||||
self.embedding_fn = embedding_functions.SentenceTransformerEmbeddingFunction(
|
||||
model_name="all-MiniLM-L6-v2"
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ VIOLATION_KEYWORDS = [
|
||||
|
||||
def audit(palace_path: Path):
|
||||
violations = []
|
||||
client = chromadb.PersistentClient(path=str(palace_path), settings=chromadb.config.Settings(anonymized_telemetry=False))
|
||||
client = chromadb.PersistentClient(path=str(palace_path))
|
||||
try:
|
||||
col = client.get_collection("mempalace_drawers")
|
||||
except Exception as e:
|
||||
|
||||
@@ -35,7 +35,7 @@ for arg in "$@"; do
|
||||
done
|
||||
|
||||
API="$GITEA_URL/api/v1"
|
||||
AUTH="token $GITEA_TOKEN"
|
||||
AUTH="Authorization: token $GITEA_TOKEN"
|
||||
|
||||
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*"; }
|
||||
|
||||
@@ -148,6 +148,51 @@ if [ "$DUPLICATES_FOUND" -eq 0 ]; then
|
||||
log "No duplicate PRs found"
|
||||
fi
|
||||
|
||||
# ─── Additional cleanup: Stale branches from closed/merged PRs ───
|
||||
log "Checking for stale branches from closed/merged PRs..."
|
||||
|
||||
ALL_PRS=$(curl -s -H "$AUTH" "$API/repos/$REPO/pulls?state=closed&limit=100")
|
||||
STALE_BRANCHES_DELETED=0
|
||||
|
||||
if [ -n "$ALL_PRS" ] && [ "$ALL_PRS" != "null" ]; then
|
||||
echo "$ALL_PRS" | jq -r '.[] | select(.merged == false) | "\(.number)\t(.head.ref)\t\(.state)"' | while IFS=$'\t' read -r pr_num pr_branch pr_state; do
|
||||
[ -z "$pr_branch" ] && continue
|
||||
# Skip if branch doesn't exist
|
||||
branch_check=$(curl -s -o /dev/null -w "%{http_code}" -H "$AUTH" "$API/repos/$REPO/branches/$pr_branch")
|
||||
if [ "$branch_check" != "200" ]; then
|
||||
continue
|
||||
fi
|
||||
log "Stale branch from closed PR #$pr_num: $pr_branch"
|
||||
if [ "$DRY_RUN" = "true" ]; then
|
||||
log "DRY RUN: Would delete branch $pr_branch"
|
||||
else
|
||||
curl -s -X DELETE -H "$AUTH" "$API/repos/$REPO/branches/$pr_branch" > /dev/null
|
||||
log "Deleted branch $pr_branch"
|
||||
STALE_BRANCHES_DELETED=$((STALE_BRANCHES_DELETED + 1))
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# ─── Additional cleanup: Stale branches from merged PRs ───
|
||||
log "Checking for stale branches from merged PRs..."
|
||||
|
||||
if [ -n "$ALL_PRS" ] && [ "$ALL_PRS" != "null" ]; then
|
||||
echo "$ALL_PRS" | jq -r '.[] | select(.merged == true) | "\(.number)\t\(.head.ref)"' | while IFS=$'\t' read -r pr_num pr_branch; do
|
||||
[ -z "$pr_branch" ] && continue
|
||||
branch_check=$(curl -s -o /dev/null -w "%{http_code}" -H "$AUTH" "$API/repos/$REPO/branches/$pr_branch")
|
||||
if [ "$branch_check" != "200" ]; then
|
||||
continue
|
||||
fi
|
||||
log "Stale branch from merged PR #$pr_num: $pr_branch"
|
||||
if [ "$DRY_RUN" = "true" ]; then
|
||||
log "DRY RUN: Would delete branch $pr_branch"
|
||||
else
|
||||
curl -s -X DELETE -H "$AUTH" "$API/repos/$REPO/branches/$pr_branch" > /dev/null
|
||||
log "Deleted branch $pr_branch"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# ─── Additional cleanup: Stale PRs ────────────────────────
|
||||
# Check for PRs older than 30 days with no activity
|
||||
log "Checking for stale PRs (older than 30 days)..."
|
||||
|
||||
@@ -18,7 +18,7 @@ DOCS_PER_ROOM = 5
|
||||
|
||||
|
||||
def main():
|
||||
client = chromadb.PersistentClient(path=PALACE_PATH, settings=chromadb.config.Settings(anonymized_telemetry=False))
|
||||
client = chromadb.PersistentClient(path=PALACE_PATH)
|
||||
col = client.get_collection("mempalace_drawers")
|
||||
|
||||
# Discover rooms in this wing
|
||||
|
||||
Reference in New Issue
Block a user