oliver-zehentleitner / maity

cli + runner: the placement id pattern and MAITY_PLACEMENT named once (clonecheck), not by four aliases and two literals

Sign in to report

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:35 re-export plus :62), workspace.SCRATCH_ID (runner/workspace.py:38). The same file uses two names for one check: supervisor.py:196 and :409 use PLACEMENT_ID, supervisor.py:586 uses workspace.SCRATCH_ID; operate.py:52/61 use supervisor.PLACEMENT_ID, operate.py:386 uses workspace.SCRATCH_ID; commands.py:110 and serve.py:282 go through supervisor.
  • The variable name is written as a literal where clonecheck.PLACEMENT_ENV exists: runner/adapters.py:361 ("MAITY_PLACEMENT": ...) and runner/pgenv.py:31, whose comment says it cannot import clonecheck because it runs with -I. That reason no longer holds: pgenv imports scratchop (pgenv.py:27), which imports maity.clonecheck since #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 of clonecheck.placement_id().

Proposal

  • Callers import clonecheck.PLACEMENT_ID (or one runner-side name) directly; drop supervisor.PLACEMENT_ID, scratchop.SCRATCH_ID and workspace.SCRATCH_ID.
  • adapters.launch and pgenv use clonecheck.PLACEMENT_ENV; pgenv takes its own id from clonecheck.placement_id(); its docstring says what it imports.

Effort / risk: S. Low; renames only, covered by test_supervisor, test_scratchop, test_pgenv.