oliver-zehentleitner / maity
cli + runner: the placement id pattern and MAITY_PLACEMENT named once (clonecheck), not by four aliases and two literals
tsk-vcnrwhhthefp Proposed
Audit round 4 (tsk-hgnbapyw7hnh), read at 0a1b832e. Kind: design (naming).
What is wrong
- #2052 made one pattern,
clonecheck.PLACEMENT_ID(cli/src/maity/clonecheck.py:32), but kept three aliases that callers use interchangeably:supervisor.PLACEMENT_ID(runner/supervisor.py:184),scratchop.SCRATCH_ID(runner/scratchop.py:35re-export plus:62),workspace.SCRATCH_ID(runner/workspace.py:38). The same file uses two names for one check:supervisor.py:196and:409usePLACEMENT_ID,supervisor.py:586usesworkspace.SCRATCH_ID;operate.py:52/61usesupervisor.PLACEMENT_ID,operate.py:386usesworkspace.SCRATCH_ID;commands.py:110andserve.py:282go throughsupervisor. - The variable name is written as a literal where
clonecheck.PLACEMENT_ENVexists:runner/adapters.py:361("MAITY_PLACEMENT": ...) andrunner/pgenv.py:31, whose comment says it cannot import clonecheck because it runs with-I. That reason no longer holds: pgenv importsscratchop(pgenv.py:27), which importsmaity.clonechecksince #2052 (scratchop.py:35). pgenv's docstring still says 'Only the standard library' (pgenv.py:18). pgenv also reads the variable itself (pgenv.py:41) instead ofclonecheck.placement_id().
Proposal
- Callers import
clonecheck.PLACEMENT_ID(or one runner-side name) directly; dropsupervisor.PLACEMENT_ID,scratchop.SCRATCH_IDandworkspace.SCRATCH_ID. adapters.launchandpgenvuseclonecheck.PLACEMENT_ENV; pgenv takes its own id fromclonecheck.placement_id(); its docstring says what it imports.
Effort / risk: S. Low; renames only, covered by test_supervisor, test_scratchop, test_pgenv.