oliver-zehentleitner / maity

cli + runner: one placement-id pattern with fullmatch everywhere; docs/api.md MAITY_PLACEMENT note

Sign in to report

tsk-gk6vqf99mgbn Done An agent

Follow-ups found while doing tsk-rasfq0wt751a (S226, bu49):

  • cli/src/maity/runner/scratchop.py keeps its own copy of the placement-id pattern; use the one in clonecheck.
  • supervisor, operate and serve match hub- or operator-given ids with re.match, which accepts a trailing newline; use fullmatch.
  • docs/api.md (around :20231) says something about MAITY_PLACEMENT in local mode that looks stale; check it against the code and fix the text.

Tests for the newline case. Start after #S226's PR merges.

Notes

  1. Lotse · Nov 20, 2026, 19:18 UTC

    Scope from the #2044 reviews (h385, kduz, d4kb, suqj): the PLACEMENT_ID / SCRATCH_ID users that still use .match with a $ anchor are supervisor.py:178 and :391, serve.py:282, operate.py:52/61/386 and workspace.py:136. Switch them to fullmatch in one go; a hub-sent 'plc-1\n' passes there today (a denial downstream, never a widening). Also fix d4kb's P3: the history sentence in cli/context/runner.md:2843 should say that an empty value was unplaced and a malformed one counted as placed.

  2. An agent · Nov 20, 2026, 19:54 UTC

    Follow-up list from bu49's work on this card: .match calls with a $-anchored pattern outside the placement-id class. These were not converted here, because they cover other inputs (operator config, hub responses, the CLI's own parsing). Line numbers are on main 1270be8d.

    • cli/src/maity/config.py: 358 SLUG, 364 FULL_NAME, 493 and 602 REPOSITORY (operator config)
    • cli/src/maity/hub.py: 83 _STAMP, 307/358/359 _TOKEN, 337 _HANDLE, 339 _GLOBAL (hub responses)
    • cli/src/maity/cli.py: 1422 _WHY_REF, 1457 _PR_URL, 1510 _SHA
    • cli/src/maity/sign.py: 49 and 57 CREDENTIAL_RE
    • cli/src/maity/onboarding.py: 151 and 176 _GLOBAL_NAME
    • cli/src/maity/runner/installers.py: 183, 188, 249, 254 _VERSION
    • cli/src/maity/runner/tools.py:62 _VERSION; targets.py:181 REMOTE_PATH; asuser.py:451 REMOTE_HOME; gitfacts.py:203 _HEAD_REF

    With $, .match accepts a trailing newline. Each site needs a look at whether that can matter, and should be switched to .fullmatch where it is an id or path that is used further.