N1 — rename backend to engine, codebase-wide - #56
Merged
Merged
Conversation
The term is decided in the nnsight-engine plan (§0 decision 6): what protocol/backend.py already called "one execution engine" in its own docstring is now named that everywhere, before a second engine exists and while no artifacts are canon — the only time the stamp-key half of this is cheap. - protocol/backend.py → protocol/engine.py: Backend → Engine, choose_backend → choose_engine; ExecutionRequest/RunResult unchanged. - neural/pytorch_hooks/ → neural/engines/pytorch_hooks/ (backend.py → engine.py, PytorchHooksBackend → PytorchHooksEngine); a shim keeps the old import path alive for one deprecation beat. - The artifact stamp key 'backend' → 'engine' (resolve.py ARTIFACT_IDENTITY_KEYS, both stamping sites in workflow/runner.py and engines/pytorch_hooks/engine.py). The corpus fixture in tests/protocol/ _env.py deliberately keeps the old key: it models a previously fitted artifact, which keeps 09's content_digest byte-stable (zero corpus-digest diff) and keeps loader tolerance of pre-rename bundles under test. - tests/neural/pytorch_hooks/ → tests/neural/engines/pytorch_hooks/ (parents[] depths adjusted), test_backend_routing.py → test_engine_routing.py. - Living docs renamed; historical docs (REBASE_CAUSALAB_ON_NNTERP, test_migration, NNsight_overview), pinned goldens, and third-party senses (matplotlib Agg, LAPACK, uv build-backend, torch.backends) untouched. Rename-only: no behavior change. Gates: 1963 passed (-m 'not golden'), corpus digests regenerated with zero diff, pre-commit clean, grep gate clean outside the exemptions above. Plan: cockpit notes/causalab-nnsight-engine-plan.md §6-N1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Test Results1 962 tests ±0 1 954 ✅ ±0 58s ⏱️ -10s Results for commit 514a70b. ± Comparison against base commit 58be68e. This pull request removes 365 and adds 365 tests. Note that renamed tests count towards both. |
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.
The nnsight-engine plan (cockpit
notes/causalab-nnsight-engine-plan.md, §0 decision 6 / §6-N1) fixes the term engine for whatprotocol/backend.pyalready described as "one execution engine". This PR is the codebase-wide rename, landed first in the N-stack because it is only cheap pre-merge: the artifact stamp key rides along, and no artifacts are canon yet.What renames
protocol/backend.py→protocol/engine.py;Backend→Engine,choose_backend→choose_engine.ExecutionRequest/RunResultkeep their names.neural/pytorch_hooks/→neural/engines/pytorch_hooks/;backend.py→engine.py;PytorchHooksBackend→PytorchHooksEngine. A shim at the old package path re-exports for one deprecation beat.identity_base["backend"]→"engine"(ARTIFACT_IDENTITY_KEYS, both stamping sites:workflow/runner.py,engines/pytorch_hooks/engine.py).tests/neural/pytorch_hooks/→tests/neural/engines/pytorch_hooks/;test_backend_routing.py→test_engine_routing.py.intervention_protocol.md§8 + capability table,workflow_protocol.md,CODEBASE.md,TESTS.md, READMEs), CLI refusal messages.What deliberately does not
tests/protocol/_env.pygenerates 09's "previously fitted" artifact at test time; pre-rename artifacts factually carry"backend", and keeping it keeps 09'scontent_digest— hence the pinned canonical form — byte-stable, and keeps the loader's tolerance of pre-rename bundles under test. This is the one place the plan's "stamp is metadata, not canonical form" reasoning meets a fixture whose bytes embed the stamp.REBASE_CAUSALAB_ON_NNTERP.md,test_migration.md,NNsight_overview.md), pinned goldens JSON, and third-party senses (matplotlibAgg, LAPACK, uvbuild-backend,torch.backends).Gates
pytest -m "not golden": 1963 passed.update_corpus_digests.py: zero diff.pre-commit run --all-files: clean.[Bb]ackendoutside the exemptions above.Note for #54 (
can/backend-forward-interning): it targets this base and touches the renamed executor; it will need a rebase over this (its CI is currently red anyway).🤖 Generated with Claude Code