Skip to content

[architecture] Shared-bash-primitive library unfinished; render codegen lacks composition (SARIF annotator + gh-bounded-read + render.cjs clones) #200

Closed

Description

@kyle-sexton

Finding (architecture:improve deepening scan, no human interview run — see below)

This repo has two sharing worlds with different mechanics:

  1. Composite actions (post-checkout) — can source a shared repo file. .github/actions/_shared/install-release.sh is the working example, consumed by 8 lanes.
  2. Reusable workflows — ship standalone, SHA-pinned, run with only the workflow file present on a caller's repo. Inline bash cannot source a repo-relative lib. The repo's answer is render-time codegen: canonical logic in .github/scripts/*.sh, inlined into workflow YAML via render-*.cjs between # BEGIN GENERATED markers, with a --check drift guard.

The gap: the render mechanism inlines exactly one source per block — no composition/include capability. Any primitive shared between bundled scripts structurally can't be extracted the way install-release.sh was, without either (a) giving render-*.cjs a compose step, or (b) accepting duplication as the price of standalone shippability.

Three symptoms of this one root, verified via nested byte-diff investigation:

1a. SARIF-to-annotation logic — osv-scan-guard.sh and zizmor-sarif-guard.sh's annotate_findings share ~95-100 of ~120 lines byte-identical (4 nested helpers incl. a 51-line URI decoder are identical save 1 line); only ~6-8 lines are tool-specific. govulncheck-sarif-guard.sh intentionally has no per-finding annotation stage — excluded, forcing it in would add behavior it deliberately omits. A sarif-to-annotations.sh (SARIF_PATH + TOOL_LABEL + level-mode + runs-selector) would absorb osv+zizmor cleanly, in install-release.sh's env-contract style — IF the render layer can compose it in.

1b. gh-bounded-read retry helper — hand-copied 5+ times, 2 variants (not the 3 originally suspected): byte-identical gh_read() command-substitution variant in queue-monitor-liveness.yml, tool-version-drift-check.yml, AND link-check.yml; temp-file variant in pulumi-version-drift.sh, tool-drift's bounded_read, and pulumi-deploy-guard/guard.sh. Fixed 1s retry (not exponential, despite network-timeout-policy.test.cjs's naming). install-release.sh can't absorb this — its retry is curl-native, wrapping curl not gh api; different seam. Governance smell: network-timeout-policy.test.cjs is an occurrence-count test that currently freezes the duplication rather than forbidding it.

1c. render-*.cjs clone family — all 5 render-*.cjs scripts are byte-identical after normalizing filenames/markers. A single data-driven render.cjs + a manifest of {source, workflow, markers} absorbs all five.

Why this needs a human decision, not an autonomous fix

1c is safe to do independently (pure JS tooling, no behavior change to generated output). 1a/1b are NOT safe to unilaterally resolve: extracting them requires deciding whether render codegen grows a composition capability (added complexity, new failure surface in a security-relevant SARIF-gating path) versus accepting the current duplication as the price of each reusable workflow shipping standalone — a real tradeoff that also collides with network-timeout-policy.test.cjs's occurrence-count assertions (which would need to change from "expect N copies" to "expect 1 shared source, N call sites").

Recommendation

  • 1c (render.cjs consolidation): straightforward, do independently.
  • 1a/1b: needs a decision on composition-vs-accept before implementation. Suggested next step: a short design conversation (or /architecture:improve re-run with a human available for the interview loop) to pick the shape, then implement.

Verification once implemented: /verification:measure for the line-count/duplication reduction claim.

Activity

  1. added
    needs-triage
    on Jul 21, 2026
  2. kyle-sexton commented on Jul 23, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Triage: premises have partly drifted since authoring — re-scope before implementing

    Verified the three claims against main (HEAD fd8439b). Two of the three have materially eroded since this issue was written; one survives.

    1a — shared SARIF annotator (osv + zizmor): now OBSOLETE. #203 (77d6c29, refactor(zizmor): replace hand-rolled SARIF guard with native --format=github) removed the hand-rolled zizmor-sarif-guard.sh and its render-zizmor-sarif-guard.cjs. There is no longer a zizmor-sarif-guard.sh in the tree. annotate_findings now lives in exactly one place — .github/scripts/osv-scan-guard.sh — with no second consumer to share with (govulncheck-sarif-guard.sh still deliberately omits per-finding annotation). The duplication that motivated extracting sarif-to-annotations.sh is gone.

    1c — render-*.cjs byte-identical clones: premise no longer holds. There are 4, not 5 (find-tracking-issue, osv-scan-guard, pulumi-version-drift, select-runner-workflow). They are not byte-identical after normalization — they've diverged into at least two distinct shapes: the osv/older shape (51 lines, scriptsDirectory, module.exports, process.exitCode) vs. the pulumi/newer shape (59 lines, root, indentation/beginMarker, exactly-one-ordered-block validation, throw). A consolidation opportunity may still exist conceptually, but it's now a reconcile-then-unify job, not a mechanical dedup of clones.

    1b — gh-bounded-read retry helper: still REAL. 6 definitions across 5 files: pulumi-version-drift.sh:21, link-check.yml:119, pulumi-version-drift-check.yml:74, queue-monitor-liveness.yml:62, tool-version-drift-check.yml:64 (bounded_read) + :424 (gh_read); pulumi-deploy-guard/guard.sh also present. network-timeout-policy.test.cjs is occurrence-count based (assert.equal(occurrences(...), 6)), so it freezes the duplication rather than forbidding it — any extraction must flip those assertions from "N copies" to "1 source + N call sites".

    Routing

    Keeping this open but routing to needs-human, not autonomous:

    1. The surviving core is a genuine architecture judgment call — whether reusable-workflow render codegen should grow a composition/include capability (new failure surface) vs. accept duplication as the price of standalone-shippable workflows. That was always human-in-the-loop.
    2. The concrete evidence has drifted (1a obsolete, 1c premise wrong), so the issue needs a human to re-scope to what actually remains (essentially: 1b gh-bounded-read dedup + the render-shape reconcile) before any implementation. An autonomous session acting on the body as written would chase removed files.

    Priority medium: real value, no deadline; ongoing refactors (#199, #203, #205, #206) are independently chipping at duplication, so nothing here blocks other open work.

  3. added
    needs-human
    and removed
    needs-triage
    on Jul 23, 2026
  4. kyle-sexton commented on Aug 12, 2026

    @kyle-sexton
    MemberAuthor

    Status (2026-08-12 drain): needs-human — leave open. Recommended default for ratification (re-scoped against current tree):

    Do now — 1c: unify the remaining render-*.cjs family into a single data-driven render.cjs + manifest {source, workflow, markers} (reconcile the older osv-shape vs newer pulumi-shape first; not a blind byte-dedup). Safe tooling-only change; no generated-output behavior change intended.

    Later — 1a: treat as obsolete / low priority (zizmor hand-rolled SARIF guard already removed in #203; no second annotator consumer).

    Later — 1b: gh-bounded-read dedup still real (~6 copies) — only after deciding whether render codegen grows composition/include vs accepting duplication for standalone shippability. Flip network-timeout-policy.test.cjs from occurrence-count freeze to single-source assertions when extracting.

    Please ratify “1c now; 1a/1b later” before autonomous implementation.

  5. kyle-sexton commented on Aug 12, 2026

    @kyle-sexton
    MemberAuthor

    Claiming for implementation: land 1c only (unify remaining render-*.cjs into shared compose + data-driven render). 1a obsolete; 1b deferred (composition-vs-duplication still open). No new issues.

  6. kyle-sexton commented on Aug 12, 2026

    @kyle-sexton
    MemberAuthor

    1c landed in #421 (cursor/issue-200-render-compose-9b36 @ 33890ae).

    • Shared render-compose.cjs + data-driven render.cjs manifest; thin render-*.cjs wrappers kept.
    • Generated workflow output byte-identical (--check green; SHA-256 unchanged after rewrite).
    • Reusable workflows still standalone-shippable (inline only; no runtime source).

    Still deferred (no new issues filed):

    Leaving #200 open for 1b; not closing on 1c alone.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-human

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions