Skip to content

Improve graph rendering and context efficiency - #153

Draft
Coding-Dev-Tools wants to merge 13 commits into
mainfrom
fix/galaxy-orbit-collapse
Draft

Improve graph rendering and context efficiency#153
Coding-Dev-Tools wants to merge 13 commits into
mainfrom
fix/galaxy-orbit-collapse

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Summary

  • Improve Galaxy graph spacing and hierarchical parent/planet/moon orbit layout.
  • Keep all-node graph rendering responsive and refresh dashboard asset versions.
  • Reduce duplicate context titles while preserving stable citation bridges.
  • Add context-efficiency guardrails and update graph, MCP, and integration tests.

Why

This consolidates the current local graph-rendering, context-packing, and MCP integration updates into the feature branch so they can be reviewed together.

Validation

  • ruff check passed for all changed Python files.
  • git diff --check passed.
  • python -m pytest tests/test_context_packing.py tests/test_graph_explorer_v2.py tests/test_mcp_server.py -q passed.
  • python -m pytest tests/test_graph_engine_asset.py -q passed.

The unrelated untracked _tmp_*.ps1 gaming/setup scripts remain intentionally excluded from this PR.

…to black hole

Root cause (8 parallel scouts):
- PRIMARY: applyGalaxyInwardConvergence forced 25%/minute radius contraction
  regardless of orbital velocity balance, overriding correct v=√(GM/r) mechanics.
  GALAXY_INWARD_CONVERGENCE_PER_MINUTE set to 0 (was 0.25).
- HIGH: Event horizon decay stripped 3.4% tangential velocity/tick at warp=3,
  draining angular momentum. GALAXY_EVENT_HORIZON_DECAY_RATE reduced from
  0.12 to 0.005 (24x reduction).

Orbital seeding physics (seedGalaxyOrbits, seedGalaxySystemOrbits) uses correct
softened Keplerian + logarithmic halo rotation curve — no changes needed.
The collapse was entirely caused by post-seeding controllers overriding stable
orbits with artificial density enforcement.
Three tests asserted the old buggy convergence behavior (25%/min inward
contraction). Updated to verify stable orbits:
- convergenceFactor = 1 at all gravity settings (no forced contraction)
- convergenceRate = 0 at all gravity settings
- Orbital radii oscillate naturally (no monotone-inward contract)
- denseApplied = 0 (early-return when factor=1)

The monotone assertion was removed because with convergence disabled,
carrier support injects tangential velocity creating real orbits that
oscillate rather than falling straight in.
- Add available budget tracking in DeterministicContextPacker for compact excerpts
- Type-annotate _components edges parameter as Mapping[str, Any]
- Add canonical_positions flag to graph scene metadata
- Enhance dashboard graph engine with improved layout and interaction handling
- Update ledger visualization with better performance characteristics
- Expand test coverage for graph engine assets and context packing
- All 375 unit tests passing
@Coding-Dev-Tools
Coding-Dev-Tools force-pushed the fix/galaxy-orbit-collapse branch from 14dc66b to 3a5438d Compare August 18, 2026 11:09
The galaxy graph visualization was pulling high-importance nodes into the
central singularity because the JS physics integrator continued applying
spacetime collapse forces (inward acceleration, event horizon decay, tidal)
even when the backend provided canonical_positions: true.

Added galaxySceneIsCanonical flag that:
- Declares module-scoped state for canonical scene detection
- Computes canonicality in render() based on authored positions and meta
- Gates includeSpacetime: !galaxySceneIsCanonical to disable collapse forces
- Reuses flag in existing canonicalGalaxy check for system packing

This ensures server-computed stable orbits are preserved in the visualization
instead of being overridden by the frontend physics engine.

Fixes: Black hole collapse bug where important files/memories were pulled
into the singularity in the galaxy graph view.
Reverse all orbital physics changes that introduced:
- Independent per-entity clock offsets (GALAXY_LOCAL_ORBIT_CLOCK_VARIANCE)
- Distinct planet/moon rotation rates
- Expanded orbital speed range (0.5-4.6x, default 200)
- Compactness changes (0.8 -> 0.384)
- All-node LOD renderer changes
- Service capacity field additions

Dashboard graph restored to v1.7 baseline behavior.
224 graph-engine tests, scene contracts, explorer, service, and dashboard tests verified.
Revert all graph-related changes since c120c16 (the screenshot reference):
- Restore GALACTIC_INITIAL_COMPACTNESS to 0.8 (was 0.384)
- Restore GALAXY_SYSTEM_MIN_GAP to 48 (was 23.04)
- Restore mass-ranked orbital rings (was edge-based parent hierarchy)
- Restore Galaxy quality engine path in ledger.js
- Restore node_limit/edge_limit to 1000/2000 (was 1500/3000)
- Restore linear black hole mass multiplier

Diagnosed via 4 parallel scouts: commits 0d0af95, b604850, a6eb891, and 45230bd
introduced aggressive compactness, rewrote orbit hierarchy, and removed the Galaxy
quality engine path, breaking the visualization.

203 graph tests passing.
Test assertions expected post-c120c16 UI text and constants that no longer
match the restored graph visualization state.
…2026-08-18 05:45)

Root cause: the revert chain (77d7367→e2ab691→e12e2e3→0cc32b5→be4fc68→e570a09)
did not cleanly cancel the intermediate commits. Net effect reintroduced:
- GALAXY_INWARD_CONVERGENCE_PER_MINUTE = 0.25 (black-hole collapse)
- Simplified orbital speed/radius (0.5-1.5x) vs advanced (0.25-4.6x)
- Lost authored-hierarchy system gravity routing
- Lost 3.25x stellar orbit clock (was reverted to 2.5x)

Tree is now byte-identical to 45230bd (960c847), which is the exact state
captured in the reference screenshot at 2026-08-18 05:45:14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant