fix(test_dockerfile_pid1_reaping): align with current Dockerfile shape (partial close hermes-agent#9) #11
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/dockerfile-tui-test-drift-9"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Aligns two contract tests in
tests/tools/test_dockerfile_pid1_reaping.pywith the current Dockerfile contract. The tests had been pinned to a@hermes/inkmaterialization step that was retired ina49f4c6("fix: prevent tui rebuilding assets", 2026-05-01) in favour of a simplernpm_config_install_links=falseapproach.This is a stale-test fix, not a Dockerfile drift — the Dockerfile change in
a49f4c6was deliberate and is strictly better (no rebuild on container start), but the regression tests were never updated.Diagnosis (from
git log -p Dockerfile)5f215b13--prefix node_modules/@hermes/inkmaterialization RUN step + tightened tests to assert ita49f4c61ENV npm_config_install_links=false. Did NOT update tests.The two failing tests (
test_dockerfile_installs_tui_dependencies,test_dockerfile_materializes_local_tui_ink_package) have been asserting the retired contract for ~7 days.Changes
test_dockerfile_installs_tui_dependencies— replaces thepackage-lock.jsonsubstring check with the actual full-treeCOPYshape:"COPY ui-tui/packages/hermes-ink/ ui-tui/packages/hermes-ink/". Catches a regression that reverts to manifest-only copies.test_dockerfile_materializes_local_tui_ink_packageis removed, replaced withtest_dockerfile_forces_npm_install_links_false_for_workspace_resolution. The new test scans parsedENVinstructions (not the raw text), so a comment block mentioningnpm_config_install_links=falsedoes NOT satisfy it — only an actualENVdirective does. Negative-tested: removing theENVline while leaving the comment block correctly fails the assertion.The 4 PID-1 reaping / supporting tests (
test_dockerfile_installs_an_init_for_zombie_reaping,test_dockerfile_entrypoint_routes_through_the_init,test_dockerfile_builds_tui_assets,test_dockerignore_excludes_nested_dependency_dirs) are unmodified. The file's primary purpose (tini PID-1 reaping, #15012) remains fully covered.Why pin
npm_config_install_links=false?Debian's bundled npm 9.x defaults to
install-links=true(file:deps installed as copies). The host-sideui-tui/package-lock.jsonis generated by npm 10+ using symlinks, so install-as-copy in the image produces a hiddennode_modules/.package-lock.jsonthat permanently disagrees with the root lockfile on the@hermes/inkentry. That disagreement trips the TUI launcher's_tui_need_npm_install()check on every startup and triggers a runtimenpm installthat fails with EACCES. Pinning the env var ensures a futureapt updatethat swaps in npm 10+ doesn't silently change behaviour, and a future contributor doesn't accidentally remove the line.Test plan
pytest tests/tools/test_dockerfile_pid1_reaping.py -v— all 6 tests pass (was 4 passing, 2 failing on main HEAD).ENV npm_config_install_links=falsefrom Dockerfile → new test fails. Restore → passes.COPY ui-tui/packages/hermes-ink/package.json ui-tui/packages/hermes-ink/package-lock.json ...→test_dockerfile_installs_tui_dependenciesfails. Restore → passes.test_dockerfile_installs_an_init_for_zombie_reaping,test_dockerfile_entrypoint_routes_through_the_init) verified untouched + still passing.Scope
Partial close
hermes-agent#9— addresses 2 of the ~28 real failures in that batch issue. Does NOT touch the other ~19+ unrelated failures (signal handling, gateway service, credential pool, ACP commands, etc.).PR
#4(fix/snapshot-drift-batch) covers a broader batch of similar test-vs-implementation drift fixes including this one in commit74d5e5a8; this PR is a focused, single-concern alternative for review.Generated with Claude Code
LGTM. Tests aligned with current Dockerfile shape (post-a49f4c61 npm_config_install_links=false approach replaced the manifest materialization). New ENV-checker uses parsed Dockerfile instructions (not raw text) so a comment alone won't satisfy it. PID-1 reaping coverage preserved. 6/6 pass.