Repository navigation
feat(lua): resolve system runtime tiers so distro packages work - #407
Merged
Merged
Conversation
AUR (#375) installs to /usr/bin + /usr/share, but runtimepath only knew $TTYMAP_RUNTIME, the baked manifest dir and the two XDG dirs — a packaged ttymap would fail at startup with "runtime not found" for every user. - add /usr/local/share/ttymap then /usr/share/ttymap as the lowest- priority tiers, so a per-user `make install` always shadows a packaged copy and machines without a package see no change - split candidate enumeration out of resolve_runtime_path so the ordering is unit-testable without staging directories - Makefile: `install-system` stages $DESTDIR$PREFIX/{bin,share/ttymap} for packagers. `make install` keeps its exact per-user behaviour and still never needs sudo; the Makefile itself never calls it - packaging/PKGBUILD as the in-tree reference for the AUR copy Refs #375 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GFGFsYeFLqRaWUAzXonwd3
There was a problem hiding this comment.
Summary
This PR successfully implements system runtime tier support for distro packages. The implementation is well-designed, properly tested, and ready to merge.
Key Achievements
Core Implementation:
- Adds
/usr/local/share/ttymapand/usr/share/ttymapas lowest-priority runtime tiers - Ensures per-user
make installalways shadows packaged copies through correct priority ordering - Refactors
resolve_runtime_pathto extractcandidate_layers, improving testability - Handles the no-XDG-dirs case gracefully (important for minimal environments)
Build & Packaging:
- New
make install-systemtarget stages$DESTDIR$PREFIX/{bin,share/ttymap}for packagers - Reference PKGBUILD demonstrates the complete AUR packaging workflow
- Uses proper install flags (
-Dm755for binary,-Dm644for data files) - Builds with
--lockedfor reproducibility
Testing:
- Two new tests verify tier ordering and the no-XDG-dirs case
- Existing tests remain green
- Manual verification confirmed packaged layout boots correctly
Documentation:
- README, Makefile, CLAUDE.md, and lua-architecture.md all updated consistently
- Clear distinction between per-user (
make install) and packager (make install-system) workflows
No Issues Found
All code functions correctly with no defects blocking merge. The verification included testing a packaged layout with proper isolation, confirming runtime resolution works as expected.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #375 — the groundwork for an AUR package. Does not publish anything to the AUR.
Why
runtimepath.rsonly knew$TTYMAP_RUNTIME, the bakedCARGO_MANIFEST_DIRand the two XDG dirs. A distro package installs to/usr/bin+/usr/share, so a packagedttymapwould have failed at startup withruntime not found ... Did you make install?for every user. That — not the PKGBUILD — was the real blocker.What
/usr/local/share/ttymap, then/usr/share/ttymap. Ranked below$XDG_DATA_HOME/ttymapso a per-usermake installalways shadows a packaged copy, and non-existent on a machine that has never installed a package, whereis_validfilters them out exactly as before.candidate_layerssplit out ofresolve_runtime_path, so the priority order is unit-testable without staging real directories.make install-systemstages$DESTDIR$PREFIX/{bin/ttymap,share/ttymap/}for packagers.make installis untouched — same command, same output, still no sudo anywhere in the Makefile. The old "system-wide installs are intentionally unsupported" comment becomes "don't do it by hand; go through a packager".packaging/PKGBUILDas the in-tree reference. Marked not-yet-publishable:install-systemlanded after v0.3.0, so it needs a newer tag (bumppkgver+updpkgsums) before it can go toaur.archlinux.org/ttymap.git.docs/lua-architecture.mdlayer list,CLAUDE.mdtree + resolution summary.Verification
cargo clippy --all-targets -- -D warningsclean,cargo fmt --checkclean,cargo testgreen (2 new runtimepath tests covering tier ordering and the no-XDG case).~/.local/share/ttymapbefore and after re-runningmake install-runtimeon this branch — samesha256.make install-system DESTDIR=… PREFIX=/usr, then in a user namespace overlaid that tree at the real/usr/shareand bind-mounted an empty dir over the repo'sruntime/so the dev tier was gone, withHOMEpointed at an empty dir so neither XDG tier existed. Ran the staged binary on a 160×50 pty for 20 s: 6481 Braille cells painted, 6226 non-blank./usr/share/ttymapwas the only runtime layer in play.Follow-up (not in this PR)
Publishing to the AUR needs a tagged release containing
install-system, and the actualgit pushtoaur.archlinux.orgneeds your SSH key.🤖 Generated with Claude Code
https://claude.ai/code/session_01GFGFsYeFLqRaWUAzXonwd3