8 Commits

Author SHA1 Message Date
alt-glitch
97dbdb3890 fix(install-root-lint): count a climb once, not once per shorter climb inside it
A fixed three-level climb in a moved file also matched as its inner two-level climb, which the
moved-file check read as a stale root climb (hermes_agent/hermes_cli/linux_desktop_entry.py:523 on
chunk 11).
2026-11-13 20:47:04 +00:00
alt-glitch
54c146024f fix(install-root-lint): judge a climb by where the file is, and block a moved file's stale climb
Judging by the original depth flagged a new file in a moved package that climbs to the package,
and passed a moved file whose old root climb now stops inside hermes_agent/. A climb now reaches
the root by the file's current depth. A moved file that the baseline knew as a root climber and
that still climbs only its old depth fails outright, since a baseline cannot hold it. Reports name
the file by its real path.
2026-11-13 20:47:04 +00:00
alt-glitch
8ace916abd fix: make path-keyed guards follow MOVES so a chunk need not edit them
Scan roots and lists go through current_path (footguns --all roots, config reader/writer trees,
detached-spawn trees and root files, subprocess-stdin dirs, the gateway parity scan root, the
plugin validator's core-handle source globs). Keys written in old paths (install-root baseline
and its depth test, detached-spawn helper and baseline, stdin KNOWN_SAFE, config-reader foreign
files, boundary-lint baseline, code-health rule globs, CI lane tables, public-surface source
dirs, plugin public-API names) are looked up by original_path/original_module of the file or
import under inspection, so they stay valid and a moved file is not judged new.
Root-name sets gain hermes_agent and the old names in MOVES; the plugin audit's registry-call
table follows MOVES; update_downgrade_guard drops the stale src/ path (its test and the
code-health CLI fixture follow). With MOVES empty every guard is unchanged.
2026-11-13 20:47:04 +00:00
alt-glitch
661b29f51f fix(move): skip the files generate_shims.py writes by its .gitattributes list in install_root_lint
A header on the first line does not identify a byte copy, and the shim header no longer starts
the file. The generated-shims block in .gitattributes lists every file the generator writes.
2026-11-13 18:45:32 +00:00
alt-glitch
da72db50e4 feat(compat): generate shims at old module paths for releases that update across a move
Release-channel updaters (v0.21.6 on) keep old code loaded across the checkout swap. After it
they run some files by path and lazily import modules under packages they loaded before the swap,
which Python looks up on the old package's __path__ without asking the compat finder. Each such
name needs a file at its old path once its module moves.

- hermes_agent/compat/required_names.py: the 120 old names supported releases reach, with kind
  (package, module, by-path, exists), built once from the per-release shim audit.
- scripts/move/generate_shims.py: for each name whose module is moved in MOVES, writes a shim
  that installs the finder and becomes the moved module (or runs it as __main__ when run by path
  or with -m). Lists the shims as linguist-generated in .gitattributes. --check fails on drift and
  on stray files in a moved folder.
- The check runs in scripts/check (just check), lint.yml and the lefthook pre-commit hook.
  install_root_lint skips the shims: they are entry points for runs by path.

With MOVES empty the generator writes nothing.
2026-11-13 18:45:32 +00:00
alt-glitch
360f48814c refactor: callers find the install folder through project_root_str()
61 call sites counted directories up from their own __file__ to find the
install folder. They now call hermes_cli._startup_fast.project_root_str(),
so the layout move changes one line instead of 61.

Kept with a reason in the lint baseline: files that cannot import Hermes
code (bootstrap, update path, pm/) and the sys.path bootstraps left for
part 2b. The baseline drops from 89 to 28 root_from_file sites.

Six existing tests that patched a module __file__ now patch the owner.
2026-11-13 18:45:31 +00:00
alt-glitch
658f942e3d fix(paths): the lint counts import-time sys.path edits in classes, match cases and inverted guards
Class bodies and match cases run at import, and the import branch of
an 'if __name__ != "__main__"' guard is the body, not the else. Removals
(remove, pop, clear, del) change the search path too.
2026-11-07 01:17:21 -05:00
alt-glitch
0e17aedc6d ci(paths): ratchet new __file__ install-root climbs and import-time sys.path edits
scripts/install_root_lint.py scans the shipped packages and root modules. It
counts __file__ path expressions that climb as many directories as the file
is deep (.parent, .parents[n], os.path.dirname, os.path.join with pardir),
and sys.path edits that run at import. Today's 106 climbs and 13 import-time
edits are the baseline; a file whose count rises fails, and the message names
hermes_cli._startup_fast.project_root_str() as the call to make instead.
Wired into scripts/check (install-root) and the lint workflow.
2026-11-07 01:17:21 -05:00