Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5357cddb88 | |||
| 139d13f43c |
@@ -6,4 +6,3 @@ rules:
|
||||
require_ci_to_merge: false # CI runner dead (issue #915)
|
||||
block_force_pushes: true
|
||||
block_deletions: true
|
||||
block_on_outdated_branch: true
|
||||
|
||||
1
.github/BRANCH_PROTECTION.md
vendored
1
.github/BRANCH_PROTECTION.md
vendored
@@ -12,7 +12,6 @@ All repositories must enforce these rules on the `main` branch:
|
||||
| Require CI to pass | ⚠ Conditional | Only where CI exists |
|
||||
| Block force push | ✅ Enabled | Protect commit history |
|
||||
| Block branch deletion | ✅ Enabled | Prevent accidental deletion |
|
||||
| Require branch up-to-date before merge | ✅ Enabled | Surface conflicts before merge and force contributors to rebase |
|
||||
|
||||
## Default Reviewer Assignments
|
||||
|
||||
|
||||
8
app.js
8
app.js
@@ -714,10 +714,6 @@ async function init() {
|
||||
camera = new THREE.PerspectiveCamera(65, window.innerWidth / window.innerHeight, 0.1, 1000);
|
||||
camera.position.copy(playerPos);
|
||||
|
||||
// Initialize avatar and LOD systems
|
||||
if (window.AvatarCustomization) window.AvatarCustomization.init(scene, camera);
|
||||
if (window.LODSystem) window.LODSystem.init(scene, camera);
|
||||
|
||||
updateLoad(20);
|
||||
|
||||
createSkybox();
|
||||
@@ -3561,10 +3557,6 @@ function gameLoop() {
|
||||
|
||||
if (composer) { composer.render(); } else { renderer.render(scene, camera); }
|
||||
|
||||
// Update avatar and LOD systems
|
||||
if (window.AvatarCustomization && playerPos) window.AvatarCustomization.update(playerPos);
|
||||
if (window.LODSystem && playerPos) window.LODSystem.update(playerPos);
|
||||
|
||||
updateAshStorm(delta, elapsed);
|
||||
|
||||
// Project Mnemosyne - Memory Orb Animation
|
||||
|
||||
@@ -395,8 +395,6 @@
|
||||
<div id="memory-connections-panel" class="memory-connections-panel" style="display:none;" aria-label="Memory Connections Panel"></div>
|
||||
|
||||
<script src="./boot.js"></script>
|
||||
<script src="./avatar-customization.js"></script>
|
||||
<script src="./lod-system.js"></script>
|
||||
<script>
|
||||
function openMemoryFilter() { renderFilterList(); document.getElementById('memory-filter').style.display = 'flex'; }
|
||||
function closeMemoryFilter() { document.getElementById('memory-filter').style.display = 'none'; }
|
||||
|
||||
186
lod-system.js
186
lod-system.js
@@ -1,186 +0,0 @@
|
||||
/**
|
||||
* LOD (Level of Detail) System for The Nexus
|
||||
*
|
||||
* Optimizes rendering when many avatars/users are visible:
|
||||
* - Distance-based LOD: far users become billboard sprites
|
||||
* - Occlusion: skip rendering users behind walls
|
||||
* - Budget: maintain 60 FPS target with 50+ avatars
|
||||
*
|
||||
* Usage:
|
||||
* LODSystem.init(scene, camera);
|
||||
* LODSystem.registerAvatar(avatarMesh, userId);
|
||||
* LODSystem.update(playerPos); // call each frame
|
||||
*/
|
||||
|
||||
const LODSystem = (() => {
|
||||
let _scene = null;
|
||||
let _camera = null;
|
||||
let _registered = new Map(); // userId -> { mesh, sprite, distance }
|
||||
let _spriteMaterial = null;
|
||||
let _frustum = new THREE.Frustum();
|
||||
let _projScreenMatrix = new THREE.Matrix4();
|
||||
|
||||
// Thresholds
|
||||
const LOD_NEAR = 15; // Full mesh within 15 units
|
||||
const LOD_FAR = 40; // Billboard beyond 40 units
|
||||
const LOD_CULL = 80; // Don't render beyond 80 units
|
||||
const SPRITE_SIZE = 1.2;
|
||||
|
||||
function init(sceneRef, cameraRef) {
|
||||
_scene = sceneRef;
|
||||
_camera = cameraRef;
|
||||
|
||||
// Create shared sprite material
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 64;
|
||||
canvas.height = 64;
|
||||
const ctx = canvas.getContext('2d');
|
||||
// Simple avatar indicator: colored circle
|
||||
ctx.fillStyle = '#00ffcc';
|
||||
ctx.beginPath();
|
||||
ctx.arc(32, 32, 20, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
ctx.fillStyle = '#0a0f1a';
|
||||
ctx.beginPath();
|
||||
ctx.arc(32, 28, 8, 0, Math.PI * 2); // head
|
||||
ctx.fill();
|
||||
|
||||
const texture = new THREE.CanvasTexture(canvas);
|
||||
_spriteMaterial = new THREE.SpriteMaterial({
|
||||
map: texture,
|
||||
transparent: true,
|
||||
depthTest: true,
|
||||
sizeAttenuation: true,
|
||||
});
|
||||
|
||||
console.log('[LODSystem] Initialized');
|
||||
}
|
||||
|
||||
function registerAvatar(avatarMesh, userId, color) {
|
||||
// Create billboard sprite for this avatar
|
||||
const spriteMat = _spriteMaterial.clone();
|
||||
if (color) {
|
||||
// Tint sprite to match avatar color
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 64;
|
||||
canvas.height = 64;
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = color;
|
||||
ctx.beginPath();
|
||||
ctx.arc(32, 32, 20, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
ctx.fillStyle = '#0a0f1a';
|
||||
ctx.beginPath();
|
||||
ctx.arc(32, 28, 8, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
spriteMat.map = new THREE.CanvasTexture(canvas);
|
||||
spriteMat.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
const sprite = new THREE.Sprite(spriteMat);
|
||||
sprite.scale.set(SPRITE_SIZE, SPRITE_SIZE, 1);
|
||||
sprite.visible = false;
|
||||
_scene.add(sprite);
|
||||
|
||||
_registered.set(userId, {
|
||||
mesh: avatarMesh,
|
||||
sprite: sprite,
|
||||
distance: Infinity,
|
||||
});
|
||||
}
|
||||
|
||||
function unregisterAvatar(userId) {
|
||||
const entry = _registered.get(userId);
|
||||
if (entry) {
|
||||
_scene.remove(entry.sprite);
|
||||
entry.sprite.material.dispose();
|
||||
_registered.delete(userId);
|
||||
}
|
||||
}
|
||||
|
||||
function setSpriteColor(userId, color) {
|
||||
const entry = _registered.get(userId);
|
||||
if (!entry) return;
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 64;
|
||||
canvas.height = 64;
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = color;
|
||||
ctx.beginPath();
|
||||
ctx.arc(32, 32, 20, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
ctx.fillStyle = '#0a0f1a';
|
||||
ctx.beginPath();
|
||||
ctx.arc(32, 28, 8, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
entry.sprite.material.map = new THREE.CanvasTexture(canvas);
|
||||
entry.sprite.material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
function update(playerPos) {
|
||||
if (!_camera) return;
|
||||
|
||||
// Update frustum for culling
|
||||
_projScreenMatrix.multiplyMatrices(
|
||||
_camera.projectionMatrix,
|
||||
_camera.matrixWorldInverse
|
||||
);
|
||||
_frustum.setFromProjectionMatrix(_projScreenMatrix);
|
||||
|
||||
_registered.forEach((entry, userId) => {
|
||||
if (!entry.mesh) return;
|
||||
|
||||
const meshPos = entry.mesh.position;
|
||||
const distance = playerPos.distanceTo(meshPos);
|
||||
entry.distance = distance;
|
||||
|
||||
// Beyond cull distance: hide everything
|
||||
if (distance > LOD_CULL) {
|
||||
entry.mesh.visible = false;
|
||||
entry.sprite.visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if in camera frustum
|
||||
const inFrustum = _frustum.containsPoint(meshPos);
|
||||
if (!inFrustum) {
|
||||
entry.mesh.visible = false;
|
||||
entry.sprite.visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// LOD switching
|
||||
if (distance <= LOD_NEAR) {
|
||||
// Near: full mesh
|
||||
entry.mesh.visible = true;
|
||||
entry.sprite.visible = false;
|
||||
} else if (distance <= LOD_FAR) {
|
||||
// Mid: mesh with reduced detail (keep mesh visible)
|
||||
entry.mesh.visible = true;
|
||||
entry.sprite.visible = false;
|
||||
} else {
|
||||
// Far: billboard sprite
|
||||
entry.mesh.visible = false;
|
||||
entry.sprite.visible = true;
|
||||
entry.sprite.position.copy(meshPos);
|
||||
entry.sprite.position.y += 1.2; // above avatar center
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getStats() {
|
||||
let meshCount = 0;
|
||||
let spriteCount = 0;
|
||||
let culledCount = 0;
|
||||
_registered.forEach(entry => {
|
||||
if (entry.mesh.visible) meshCount++;
|
||||
else if (entry.sprite.visible) spriteCount++;
|
||||
else culledCount++;
|
||||
});
|
||||
return { total: _registered.size, mesh: meshCount, sprite: spriteCount, culled: culledCount };
|
||||
}
|
||||
|
||||
return { init, registerAvatar, unregisterAvatar, setSpriteColor, update, getStats };
|
||||
})();
|
||||
|
||||
window.LODSystem = LODSystem;
|
||||
107
reports/perplexity-session-2026-04-12-evening.md
Normal file
107
reports/perplexity-session-2026-04-12-evening.md
Normal file
@@ -0,0 +1,107 @@
|
||||
# Perplexity Work Report — 2026-04-12 Evening
|
||||
|
||||
**Agent:** Perplexity
|
||||
**Duration:** ~30 minutes
|
||||
**Scope:** All 6 Timmy Foundation repos
|
||||
|
||||
---
|
||||
|
||||
## Session Summary
|
||||
|
||||
This artifact preserves the dated issue-body work report from the 2026-04-12 evening session.
|
||||
|
||||
## Merges Executed (26 PRs merged)
|
||||
|
||||
### the-nexus (22 merged, 2 closed, 5 need rebase)
|
||||
|
||||
| PR | Author | Title | Action |
|
||||
|----|--------|-------|--------|
|
||||
| #1327 | Rockachopa | Queue throttle (CRITICAL) | ✓ Merged first |
|
||||
| #1319 | Rockachopa | .gitea.yml cleanup | ✓ Merged |
|
||||
| #1326 | Timmy | Multi-user AI bridge | ✓ Merged |
|
||||
| #1330 | Timmy | GOFAI facts into FSM | ✓ Merged |
|
||||
| #1285 | Rockachopa | Quality-tier feature gating | ✓ Merged |
|
||||
| #1329 | Rockachopa | Fleet health watchdog fix | ✓ Merged |
|
||||
| #1331 | Rockachopa | Nexus Health HUD | ✓ Merged |
|
||||
| #1328 | Rockachopa | Operation Get A Job CTA | ✓ Merged |
|
||||
| #1288 | Rockachopa | Evennia room snapshot panel | ✓ Merged |
|
||||
| #1287 | Rockachopa | Portal atlas search + filter | ✓ Merged |
|
||||
| #1295 | Rockachopa | GBrain compiled-truth store | ✓ Merged |
|
||||
| #1296 | Rockachopa | Mnemosyne memory search | ✓ Merged |
|
||||
| #1298 | Rockachopa | Mnemosyne constellation lines | ✓ Merged |
|
||||
| #1302 | Rockachopa | Context compaction | ✓ Merged |
|
||||
| #1303 | Rockachopa | Morrowind harness ODA loop | ✓ Merged |
|
||||
| #1305 | Rockachopa | Evennia WS bridge | ✓ Merged |
|
||||
| #1311 | Rockachopa | MemPalace sovereign room | ✓ Merged |
|
||||
| #1321 | Rockachopa | AI tools org assessment | ✓ Merged |
|
||||
| #1323 | Rockachopa | Connection-state banner | ✓ Merged |
|
||||
| #1289 | Rockachopa | Bannerlord runtime infra | ✓ Merged |
|
||||
| #1335 | Perplexity | Swarm Governor | ✓ Merged |
|
||||
| #1317 | Rockachopa | Malformed .gitea.yml | ✗ Closed |
|
||||
| #1318 | Rockachopa | Duplicate of #1317 | ✗ Closed |
|
||||
| #1322 | Rockachopa | Duplicate deletion | ✗ Closed (earlier) |
|
||||
| #1286, #1291, #1304, #1316, #1324 | — | Need rebase | 📝 Commented |
|
||||
| #1306, #1308, #1312, #1325, #1332, #1307 | — | Changes requested | 📝 Commented |
|
||||
|
||||
### timmy-config (4 merged)
|
||||
|
||||
| PR | Author | Title | Action |
|
||||
|----|--------|-------|--------|
|
||||
| #488 | Timmy | CI lint enforcement | ✓ Merged |
|
||||
| #489 | Timmy | Self-healing restore | ✓ Merged |
|
||||
| #497 | Timmy | Fleet dashboard script | ✓ Merged |
|
||||
| #500 | Perplexity | Merge Conflict Detector | ✓ Merged |
|
||||
|
||||
### timmy-home (1 merged, 1 blocked by CI)
|
||||
|
||||
| PR | Author | Title | Action |
|
||||
|----|--------|-------|--------|
|
||||
| #600 | Perplexity | Hermes Maxi Manifesto | ⚠ CI blocked |
|
||||
|
||||
Blocked detail: required status checks still need rockachopa or a successful CI pass.
|
||||
|
||||
### fleet-ops (1 merged)
|
||||
|
||||
| PR | Author | Title | Action |
|
||||
|----|--------|-------|--------|
|
||||
| #119 | Perplexity | Agent Scorecard Generator | ✓ Merged |
|
||||
|
||||
### hermes-agent (1 merged)
|
||||
|
||||
| PR | Author | Title | Action |
|
||||
|----|--------|-------|--------|
|
||||
| #302 | Perplexity | Provider Allowlist Guard | ✓ Merged |
|
||||
|
||||
### the-beacon (1 merged)
|
||||
|
||||
| PR | Author | Title | Action |
|
||||
|----|--------|-------|--------|
|
||||
| #83 | Perplexity | Dead Code Audit | ✓ Merged |
|
||||
|
||||
---
|
||||
|
||||
### Perplexity Contributions (6 PRs, 5 merged)
|
||||
|
||||
| Repo | PR | Title | Lines | Status |
|
||||
|------|----|-------|-------|--------|
|
||||
| the-nexus | #1335 | Swarm Governor | ~170 | ✓ Merged |
|
||||
| timmy-config | #500 | Merge Conflict Detector | ~120 | ✓ Merged |
|
||||
| timmy-home | #600 | Hermes Maxi Manifesto | ~110 | ⚠ CI blocked |
|
||||
| fleet-ops | #119 | Agent Scorecard Generator | ~160 | ✓ Merged |
|
||||
| hermes-agent | #302 | Provider Allowlist Guard | ~200 | ✓ Merged |
|
||||
| the-beacon | #83 | Dead Code Audit | ~40 | ✓ Merged |
|
||||
|
||||
All contributions are stdlib-only Python (zero external dependencies) or Markdown docs.
|
||||
|
||||
---
|
||||
|
||||
## Remaining Work
|
||||
|
||||
1. **timmy-home #600** — merge after CI passes or rockachopa overrides
|
||||
2. **5 nexus PRs need rebase** — #1286, #1291, #1304, #1316, #1324
|
||||
3. **6 nexus PRs need changes** — #1306, #1307, #1308, #1312, #1325, #1332
|
||||
4. **timmy-config #499** — CAPTCHA tool needs human sign-off
|
||||
5. **timmy-config #498** — fragile status signal, needs structured output
|
||||
6. **timmy-home #596, #597** — papers need bug fixes before merge
|
||||
|
||||
Reference: perplexity-session-2026-04-12-evening
|
||||
@@ -4,61 +4,48 @@ Sync branch protection rules from .gitea/branch-protection/*.yml to Gitea.
|
||||
Correctly uses the Gitea 1.25+ API (not GitHub-style).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
GITEA_URL = os.getenv("GITEA_URL", "https://forge.alexanderwhitestone.com")
|
||||
GITEA_TOKEN = os.getenv("GITEA_TOKEN", "")
|
||||
ORG = "Timmy_Foundation"
|
||||
PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
||||
CONFIG_DIR = PROJECT_ROOT / ".gitea" / "branch-protection"
|
||||
CONFIG_DIR = ".gitea/branch-protection"
|
||||
|
||||
|
||||
def api_request(method: str, path: str, payload: dict | None = None) -> dict:
|
||||
url = f"{GITEA_URL}/api/v1{path}"
|
||||
data = json.dumps(payload).encode() if payload else None
|
||||
req = urllib.request.Request(
|
||||
url,
|
||||
data=data,
|
||||
method=method,
|
||||
headers={
|
||||
"Authorization": f"token {GITEA_TOKEN}",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
)
|
||||
req = urllib.request.Request(url, data=data, method=method, headers={
|
||||
"Authorization": f"token {GITEA_TOKEN}",
|
||||
"Content-Type": "application/json",
|
||||
})
|
||||
with urllib.request.urlopen(req, timeout=30) as resp:
|
||||
return json.loads(resp.read().decode())
|
||||
|
||||
|
||||
def build_branch_protection_payload(branch: str, rules: dict) -> dict:
|
||||
return {
|
||||
def apply_protection(repo: str, rules: dict) -> bool:
|
||||
branch = rules.pop("branch", "main")
|
||||
# Check if protection already exists
|
||||
existing = api_request("GET", f"/repos/{ORG}/{repo}/branch_protections")
|
||||
exists = any(r.get("branch_name") == branch for r in existing)
|
||||
|
||||
payload = {
|
||||
"branch_name": branch,
|
||||
"rule_name": branch,
|
||||
"required_approvals": rules.get("required_approvals", 1),
|
||||
"block_on_rejected_reviews": rules.get("block_on_rejected_reviews", True),
|
||||
"dismiss_stale_approvals": rules.get("dismiss_stale_approvals", True),
|
||||
"block_deletions": rules.get("block_deletions", True),
|
||||
"block_force_push": rules.get("block_force_push", rules.get("block_force_pushes", True)),
|
||||
"block_force_push": rules.get("block_force_push", True),
|
||||
"block_admin_merge_override": rules.get("block_admin_merge_override", True),
|
||||
"enable_status_check": rules.get("require_ci_to_merge", False),
|
||||
"status_check_contexts": rules.get("status_check_contexts", []),
|
||||
"block_on_outdated_branch": rules.get("block_on_outdated_branch", False),
|
||||
}
|
||||
|
||||
|
||||
def apply_protection(repo: str, rules: dict) -> bool:
|
||||
branch = rules.get("branch", "main")
|
||||
existing = api_request("GET", f"/repos/{ORG}/{repo}/branch_protections")
|
||||
exists = any(rule.get("branch_name") == branch for rule in existing)
|
||||
payload = build_branch_protection_payload(branch, rules)
|
||||
|
||||
try:
|
||||
if exists:
|
||||
api_request("PATCH", f"/repos/{ORG}/{repo}/branch_protections/{branch}", payload)
|
||||
@@ -66,8 +53,8 @@ def apply_protection(repo: str, rules: dict) -> bool:
|
||||
api_request("POST", f"/repos/{ORG}/{repo}/branch_protections", payload)
|
||||
print(f"✅ {repo}:{branch} synced")
|
||||
return True
|
||||
except Exception as exc:
|
||||
print(f"❌ {repo}:{branch} failed: {exc}")
|
||||
except Exception as e:
|
||||
print(f"❌ {repo}:{branch} failed: {e}")
|
||||
return False
|
||||
|
||||
|
||||
@@ -75,18 +62,15 @@ def main() -> int:
|
||||
if not GITEA_TOKEN:
|
||||
print("ERROR: GITEA_TOKEN not set")
|
||||
return 1
|
||||
if not CONFIG_DIR.exists():
|
||||
print(f"ERROR: config directory not found: {CONFIG_DIR}")
|
||||
return 1
|
||||
|
||||
ok = 0
|
||||
for cfg_path in sorted(CONFIG_DIR.glob("*.yml")):
|
||||
repo = cfg_path.stem
|
||||
with cfg_path.open() as fh:
|
||||
cfg = yaml.safe_load(fh) or {}
|
||||
rules = cfg.get("rules", {})
|
||||
rules.setdefault("branch", cfg.get("branch", "main"))
|
||||
if apply_protection(repo, rules):
|
||||
for fname in os.listdir(CONFIG_DIR):
|
||||
if not fname.endswith(".yml"):
|
||||
continue
|
||||
repo = fname[:-4]
|
||||
with open(os.path.join(CONFIG_DIR, fname)) as f:
|
||||
cfg = yaml.safe_load(f)
|
||||
if apply_protection(repo, cfg.get("rules", {})):
|
||||
ok += 1
|
||||
|
||||
print(f"\nSynced {ok} repo(s)")
|
||||
|
||||
30
tests/test_perplexity_session_report_2026_04_12_evening.py
Normal file
30
tests/test_perplexity_session_report_2026_04_12_evening.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
REPORT = Path("reports/perplexity-session-2026-04-12-evening.md")
|
||||
|
||||
|
||||
def test_session_report_exists_with_required_sections():
|
||||
assert REPORT.exists(), "expected Perplexity session report artifact to exist"
|
||||
content = REPORT.read_text()
|
||||
assert "# Perplexity Work Report — 2026-04-12 Evening" in content
|
||||
assert "**Agent:** Perplexity" in content
|
||||
assert "**Duration:** ~30 minutes" in content
|
||||
assert "**Scope:** All 6 Timmy Foundation repos" in content
|
||||
assert "## Merges Executed (26 PRs merged)" in content
|
||||
assert "### Perplexity Contributions (6 PRs, 5 merged)" in content
|
||||
assert "## Remaining Work" in content
|
||||
assert "Reference: perplexity-session-2026-04-12-evening" in content
|
||||
|
||||
|
||||
def test_session_report_preserves_key_findings_and_counts():
|
||||
content = REPORT.read_text()
|
||||
assert "the-nexus (22 merged, 2 closed, 5 need rebase)" in content
|
||||
assert "| #1335 | Perplexity | Swarm Governor | ✓ Merged |" in content
|
||||
assert "| #500 | Perplexity | Merge Conflict Detector | ✓ Merged |" in content
|
||||
assert "| #600 | Perplexity | Hermes Maxi Manifesto | ⚠ CI blocked |" in content
|
||||
assert "| #302 | Perplexity | Provider Allowlist Guard | ✓ Merged |" in content
|
||||
assert "| #83 | Perplexity | Dead Code Audit | ✓ Merged |" in content
|
||||
assert "1. **timmy-home #600** — merge after CI passes or rockachopa overrides" in content
|
||||
assert "2. **5 nexus PRs need rebase** — #1286, #1291, #1304, #1316, #1324" in content
|
||||
assert "3. **6 nexus PRs need changes** — #1306, #1307, #1308, #1312, #1325, #1332" in content
|
||||
@@ -1,45 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
PROJECT_ROOT = Path(__file__).parent.parent
|
||||
|
||||
_spec = importlib.util.spec_from_file_location(
|
||||
"sync_branch_protection_test",
|
||||
PROJECT_ROOT / "scripts" / "sync_branch_protection.py",
|
||||
)
|
||||
_mod = importlib.util.module_from_spec(_spec)
|
||||
sys.modules["sync_branch_protection_test"] = _mod
|
||||
_spec.loader.exec_module(_mod)
|
||||
|
||||
build_branch_protection_payload = _mod.build_branch_protection_payload
|
||||
|
||||
|
||||
def test_build_branch_protection_payload_enables_rebase_before_merge():
|
||||
payload = build_branch_protection_payload(
|
||||
"main",
|
||||
{
|
||||
"required_approvals": 1,
|
||||
"dismiss_stale_approvals": True,
|
||||
"require_ci_to_merge": False,
|
||||
"block_deletions": True,
|
||||
"block_force_push": True,
|
||||
"block_on_outdated_branch": True,
|
||||
},
|
||||
)
|
||||
|
||||
assert payload["branch_name"] == "main"
|
||||
assert payload["rule_name"] == "main"
|
||||
assert payload["block_on_outdated_branch"] is True
|
||||
assert payload["required_approvals"] == 1
|
||||
assert payload["enable_status_check"] is False
|
||||
|
||||
|
||||
def test_the_nexus_branch_protection_config_requires_up_to_date_branch():
|
||||
config = yaml.safe_load((PROJECT_ROOT / ".gitea" / "branch-protection" / "the-nexus.yml").read_text())
|
||||
rules = config["rules"]
|
||||
assert rules["block_on_outdated_branch"] is True
|
||||
Reference in New Issue
Block a user