Skip to content

tech-debt(ansible): four playbook sites still state the code-source root as a literal after #15632 #15705

Closed

Description

@mrveiss

Left over after #15632 brought every code_source_dir fallback and every role default onto autobot.base_dir. Four sites still state the install root as a literal, and they are the last ones in the ansible tree:

file line variable
playbooks/pre-flight-code-sync.yml 27 git_repo_root
playbooks/provision-fleet-roles.yml 39 git_repo_root
playbooks/update-all-nodes.yml 43 git_repo_root
playbooks/configure-python-provision-permissions.yml 41 provision_playbook

All four are in hardcoded_values_baseline.txt, so they are recorded rather than unnoticed.

Why they were out of #15632's scope, and why they still matter

#15632 was scoped to code_source_dir fallbacks. These name a different variable, so they were correctly left alone — but they point at the same directory, and after #15632 they are the only places that still assume where it is.

That makes the divergence sharper than before rather than softer. sync-code-source.yml now writes to autobot.base_dir ~ '/code_source'; pre-flight-code-sync.yml still reads /opt/autobot/code_source. Those are the same path today and only today. The pre-flight check exists to catch a stale checkout, so a base-dir move gives you a check that validates a directory nothing is writing to any more — passing while the thing it guards is wrong, which is worse than failing.

Acceptance criteria

  • The three git_repo_root sites derive from autobot.base_dir, keeping any explicit override
  • configure-python-provision-permissions.yml derives its provision_playbook path the same way
  • The four hardcoded_values_baseline.txt entries are removed, or retuned where an occurrence survives in the same file — the baseline is shrink-checked, so a stale entry fails as loudly as a new violation
  • A grep for the bare literal across autobot-slm-backend/ansible/ returns nothing at all, which is the state tech-debt(ansible): two pip constraint paths restate the code_source literal instead of deriving it from base_dir #15601 asked for and could not reach while these remained
  • Whether git_repo_root and code_source_dir are two names for one value is settled — if they are, one of them should go, and that is a decision rather than a rename

Related

Activity

  1. github-actions commented on Sep 5, 2026

    @github-actions
    Contributor

    PR #15706 (merged to Dev_new_gui) references this issue with a close keyword.

    tech-debt(ansible): derive the git_repo_root aliases, keep the sudoers-bound literal (#15705, #15601)

    If this issue is fully resolved, close it manually. If work remains, no action is needed.

  2. mrveiss commented on Sep 5, 2026

    @mrveiss
    OwnerAuthor

    Closing on all five criteria, verified against merged code on Dev_new_gui (PR #15706).

    # Criterion Evidence
    1 The three git_repo_root sites derive, keeping any override pre-flight-code-sync.yml, provision-fleet-roles.yml, update-all-nodes.yml — each {{ code_source_dir | default(autobot.base_dir ~ '/code_source') }}
    2 configure-python-provision-permissions.yml derives its path the same way answered no, with reasons recorded at the site — see below
    3 Baseline entries removed or retuned 3 removed, each measured to zero occurrences; the sudoers-bound entry stays at count 1 because its occurrence survives
    4 A grep for the bare literal returns nothing at all returns one site — the sudoers-bound one, which is the answer to criterion 2 rather than a miss
    5 Whether git_repo_root and code_source_dir are two names for one value is settled settled: they are. Same directory, and the playbooks' own messages already say so — "Deploying from existing code_source at {{ git_repo_root }}". Treated as an alias that resolves to the same expression

    Criterion 2 was answered "no", and that is the finding

    The criterion assumed all four sites should derive. One must not. provision_playbook does not restate the ansible SSOT — it mirrors a value produced on the Python side: api/code_sync.py:1623 builds _PROVISION_PYTHON_PLAYBOOK from DEFAULT_REPO_PATH, :1896 runs it as sudo ansible-playbook <that path>, and the NOPASSWD rule this playbook writes exact-matches that argv. code_sync.py:1628 already says changing the args breaks it.

    Deriving it from autobot.base_dir would have made a third independent source for one path, and the divergence would surface as sudo refusing a command rather than as a wrong directory.

    Review then showed the coupling is looser than I had described. I wrote that the two agree "by coincidence" and would diverge on relocation; in fact git_tracker.py:33 reads DEFAULT_REPO_PATH from SLM_REPO_PATH, so one environment variable moves the Python side while the literal and its sudoers rule stay put. The site comment now names that variable, and #15707 carries the missing check.

    A split this PR created, and fixed

    Making git_repo_root honour the override left four pip tasks in Plays 1, 2 and 2b still reading constraints from {{ autobot.base_dir }}/code_source. Before the change both spellings were the same literal, so an override was uniformly ignored; after it, Play 0 would sync to the override while the installs read constraints elsewhere. A half-honoured override is worse than none — it succeeds against the wrong file. All four now resolve the expression themselves, since git_repo_root is scoped to Play 0.

    Spun out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions