Skip to content

Add a repeatable generated-shim stress matrix #149

Description

@junior-ricon

Problem

Generated shims are executable artifacts assembled from install-time paths, package names, embedded shell, and runtime environment. Ordinary unit and integration coverage catches known regressions, but it does not systematically pressure the boundary between generation-time state and runtime state.

The investigation and self-review for #146 / #148 used useful ad hoc stresses:

  • cache paths containing spaces, apostrophes, and literal shell metacharacters;
  • populated and missing install-local task maps with a conflicting runtime/global map;
  • two same-named package versions with separate generated shims and maps;
  • bash -n over the generated artifact;
  • generation under one XDG cache and execution under another.

These are repeatable generated-artifact contracts rather than one-off debugging tricks.

Proposed shape

Add a deterministic generated-shim stress matrix, preferably using the existing mise run test [suite] interface rather than creating a parallel test runner.

A likely shape is test/shim-stress.bats, included in the default suite if its runtime stays modest and targetable with:

mise run test shim-stress

Cover a bounded matrix such as:

  1. Hostile but valid paths
    • spaces;
    • apostrophes;
    • dollar signs and backticks treated literally;
    • nested install/cache roots.
  2. Cache lifecycle
    • populated map;
    • missing map regenerated on first execution;
    • conflicting runtime XDG/global map;
    • same package name under two install roots.
  3. Artifact validity
    • bash -n on each generated shim;
    • execute a real nested mise task through the generated shim;
    • assert writes stay inside the owning install/cache root.
  4. Environment drift
    • generation and execution with different XDG_CACHE_HOME values;
    • inherited mise overrides do not contaminate package task discovery.

Run it on Ubuntu and macOS. If the matrix becomes too slow for every default test run, give it a dedicated CI job on lib/shim.sh, cache, resolver, install/update, and stress-test changes, plus the existing scheduled workflow. Keep cases deterministic; if seeded fuzzing is added later, print and preserve the seed for reproduction.

Boundaries

  • Do not duplicate every normal shim test in a second suite.
  • Prefer a compact cross-product chosen around generated-shell and ownership boundaries.
  • Keep vfox-shiv end-to-end install isolation in vfox-shiv; shiv should own generator behavior.
  • A failure should preserve the generated shim, paths, environment, and exact invocation as CI artifacts or diagnostic output.

Acceptance criteria

  • A repeatable command runs the generated-shim stress matrix locally.
  • The matrix runs on Linux and macOS CI.
  • It covers hostile valid paths, cache hit/miss/conflict, and same-name version isolation.
  • Generated artifacts receive syntax and real execution checks.
  • Failures identify the exact case and enough state to reproduce it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions