apme/v5-readability-bundle #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "apme/v5-readability-bundle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Three top-level discover task files were each a 250-550-line wall of YAML+Jinja+shell where the reader had to scroll past nine implicit phases to know what the file did. Splitting each into a short orchestrator plus per-phase sub-files matches the v5 pattern set by roles/discover/tasks/main.yml — read main, see the phases; read a phase, see its logic. java_common.yml 533 → 48-line orchestrator + 10 phases in java/ 1. jvm — heap, GC, agents, classpath, sysprops 2. java_version — version + vendor from /proc/<pid>/exe 3. keystores — find + default-password sweep 4. jdbc — config-file URL scrape + driver lookup 5. system_packages — Satellite-sourced (stub, kept for compat) 6. environment — /proc environ + setenv.sh + systemd unit 7. cron — system + user crontab search 8. log_config — log4j/logback/JUL classify + paths 9. network — live ss -tnp peers 10. secrets — pattern markers only, never values gather.yml 301 → 31-line orchestrator + 6 phases in gather/ 1. host_facts — setup + package_facts + service_facts 2. processes — ps + ss/netstat parsing 3. filesystem — shallow dir scan + marker-file find 4. java_envs — enumerate JDK installs + versions 5. host_probes — env vars, init system, pkg manager 6. assemble — consolidate into discovered_facts + debug war_introspection.yml 261 → 32-line orchestrator + 3 in war/ 1. locate — resolve deploy dir + list + pick tool 2. introspect — emit ===DEPLOYMENT=== protocol (shell) 3. parse — parse the protocol into _di_deployments (with cross-reference comments to keep shell + parser in lock-step) Every new file opens with `# Input` and `# Output` lines naming the upstream loop vars and downstream facts. Task names use the "<subfile> | Verb ..." convention from AGENTS.md so PLAY RECAP lines remain searchable. No task semantics change — every shell, every set_fact, every register is preserved verbatim; only the file boundaries move. Verified: yaml.safe_load passes on all 21 files; `ansible-playbook playbooks/discover.yml --syntax-check` succeeds. Module-op count is identical to main except for the 10 new include_tasks the orchestrators add. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>| string80ddf05c73Both files are already structured around phase comments; this commit promotes them to numbered "Phase N — Title" dividers in line with the discover + mta_publish refactors so the whole collection has one consistent way to read multi-phase task files. playbooks/utils/apply-v5-to-aap.yml (load-bearing — touches AAP JT 97/98/107/108): - Six phase headers (resolve → JT-perapp-analyze → Survey → JT-E fan_out → re-point legacy JTs → workflow rewire), each with a one-paragraph "what this phase does and why" note. - Play name typo fixed: "Bootstrap v4" → "Bootstrap v5". - No logic changes. Task names, set_facts, uri calls, when guards are all untouched. Diff is comments only. roles/deploy/tasks/git_pr.yml: - Expanded the header docstring: phase map, required inputs (with types), optional inputs, required defaults (with sourcing), the external side-effects this file performs, and what set_stats it emits. Reader can answer "what does this do, what does it touch, what does it produce" without scrolling. - Six phase headers with one-paragraph notes — Phase 5's note points at the inline force-with-lease comment so a reader knows where the gnarliest logic lives. Verified: yaml.safe_load passes; ansible-playbook --syntax-check on apply-v5-to-aap.yml succeeds. Diff is entirely additive comments; behaviour is byte-identical. Safe to merge ahead of staging --check since no AAP API calls changed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>Three load-bearing files in mta_analyze had brief one-line headers. Replaced with the v5-pattern header block: phase map naming each step, required inputs (with shape), outputs, and reasoning comments where the logic isn't obvious. main.yml — 23 L: phase map, mode contract, required vs optional inputs pair.yml — 147 L: 7-phase map, full input/output contract, the eventual-consistency rationale for the defensive re-GET in pair_one.yml is now signposted from here pair_one.yml — 183 L: per-app flow described step by step, the loop variable's shape is documented, the cumulative fact (_pair_analyzer_queued) is called out Other mta_analyze files (analyze, ensure_identity, ensure_tags, poll_one, process_one, queue_one, resolve_tags, tag_one) already have serviceable headers — left as-is, no per-file restructure needed. No task semantics change; headers and comments only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>Same pattern as PRs 3/4 and the llm_generate_app split: one short orchestrator + per-phase sub-files under phases/, each with a header docstring naming its inputs and outputs. fleet_report/main.yml 345 → 35-line orchestrator + 5 phases in phases/ 1_collect — per-host data collection (apps + deep + configs; raw config content stripped to prevent secret leakage) 2_score — Green/Yellow/Red/Gray verdict from 9 flag dimensions (secrets, complex runtime, non-standard path, keystores, JDBC, external deps, heap unset, Java EOL, low-confidence) 3_stats — fleet-wide totals + runtime breakdown + risk roll-up 4_render — output dir + HTML + catalog data + JSON dump 5_finalize — operator summary debug + AAP set_stats artifact Score phase stays as one big set_fact intentionally: each flag pushes into the same accumulating `flags[]` list inside a per-host for-loop, and Jinja for-loop scope makes splitting the dimensions across tasks impractical. The 164-line file now opens with a docstring naming all 9 dimensions and the verdict scoring rule, so a reader can skim without having to trace. No task semantics change. Every set_fact, every template render is preserved verbatim; only file boundaries move and docstrings clarify the per-phase contract. Verified: yaml.safe_load passes on all 6 files; addons/fleet-report.yml syntax-check succeeds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>Pull request closed