Skip to content

Test: add Composer (composer.lock) edge-case fixture for vg build #265

Closed as not planned

Description

@vibgrate-team

Context

PHP / Composer lockfiles are a common local tree that vg build should handle deterministically. Adjacent lockfile fixtures already cover pnpm, Yarn Berry, Poetry, Bundler, Cargo, and Go workspaces; Composer is a natural next edge-case for graph stability.

What to do

  1. Add a small fixture under test/ with a realistic composer.lock edge (e.g. path repo, replaced package, or platform php constraint) — keep it tiny.
  2. Assert deterministic graph.json / build output (stable IDs, stable sort; no wall-clock or filesystem-order dependence).
  3. Follow CONTRIBUTING: pnpm test, DCO (git commit -s), prefer vg in any docs/examples touched.

Acceptance

  • Fixture committed and referenced from the test that builds it
  • Same input → same graph output across two runs
  • pnpm test green; DCO on commits

Mentoring notes

Mirror the size/scope of #252 (Poetry) / #259 (Bundler). One lockfile family only — do not expand into Packagist network calls.

Activity

  1. added
    enhancement
    good first issue
    on Sep 24, 2026
  2. vibgrate-team commented on Oct 6, 2026

    @vibgrate-team
    ContributorAuthor

    Some pointers from the current code so this stays small and lands on the right behaviour.

    • vg build reads composer.lock through lockfileVersion → composerLock in src/engine/lockfile.ts. It looks up a direct dependency in packages, then packages-dev, and strips a leading v (v1.2.3 becomes 1.2.3).
    • fullDependencyGraph in the same file has no Composer branch, so a Composer project gets direct-dependency pins only and no transitive component list. The fixture should assert that as current behaviour rather than expect transitive components.
    • Edges worth covering in one tiny lock:
      • a v-prefixed tag (expect the bare version)
      • a path repository entry ("dist": {"type": "path"}) with a dev-main version (expect dev-main unchanged, not coerced to semver)
      • the same name in both packages and packages-dev (expect the packages version)
      • a name that is only satisfied through another entry's replace map (expect undefined today; note it in the PR rather than fixing it here)
      • platform: { "php": ... } stays out of the dependency list
    • Put the unit cases next to the existing ones in src/engine/lockfile.test.ts (they write a lockfile into a temp dir and call lockfileVersion). Add one check that builds the fixture twice and compares graph.json bytes.

    Extra acceptance: every expectation above is asserted, and the test makes no network calls.

  3. vibgrate-team commented on Oct 29, 2026

    @vibgrate-team
    ContributorAuthor

    Folding this into #513, which covers this lockfile with the exact functions, fixtures and acceptance tests. Please pick it up there!

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

    enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions