Files
gravitiny/gravitiny/ISSUES.md
T

2.1 KiB

Gravitiny Engineering Issues & Resolution Log

This document records architectural hurdles, bugs, investigations, and verified solutions encountered during the engineering of Gravitiny Core and its applets ecosystem.


Issue #001: Nested Directory Unwrapping during Git Clone and Zip Extraction

  • Component: gravitiny.src.installer.AppletInstaller
  • Severity: High (Broken Shim Execution)
  • Status: Resolved

Symptom

When running gravitiny <applet> through the manager, the applet executed successfully because local discovery scanned both workspace and user dotfiles. However, executing direct global shims (e.g. lex books) failed with:

C:\Users\al3ph\AppData\Local\Programs\Python\Python313\python.exe: can't open file 'C:\Users\al3ph\.gravitiny\applets\lex\main.py': [Errno 2] No such file or directory

Root Cause

When Gitea generates repository archive zips (e.g. https://git.luxhebros.com/beerslayer/lex/archive/main.zip), the zip payload contains a top-level directory matching the repository name (lex/). When extracted into ~/.gravitiny/applets/lex, this caused a nested directory structure: ~/.gravitiny/applets/lex/lex/main.py instead of ~/.gravitiny/applets/lex/main.py.

Additionally, Python's shutil.move(src, dst) moves the source folder inside the destination folder if the destination folder already exists.

Solution

  1. Added AppletInstaller._flatten_if_nested(target_dir: Path) static helper method.
  2. The method inspects the extracted destination folder. If main.py or manifest.json is missing from the root and a single nested subfolder exists, it elevates all children files/folders to the root of target_dir and removes the redundant nested folder.
  3. Updated both _clone_git_repo and _download_and_extract_zip pipelines to invoke _flatten_if_nested.

Verification

Re-ran python main.py install lex and python main.py install sec. Confirmed that main.py is extracted directly to C:\Users\al3ph\.gravitiny\applets\lex\main.py. Verified that direct shim execution lex books runs cleanly and instantly.