Skip to content

test(fetch): no heterogeneous workspace descriptor reaches the public walk, the self branch, or the cache key #123

Description

@justin13888

Came out of reviewing #102, which paired each workspace-root candidate name with the kind that reads it (root_names: &[(&'static str, ManifestKind)], replacing a single root_kind over the whole list) and made workspace_declarations take the root's kind rather than the member's.

That change exists to make a heterogeneous descriptor safe — one where a candidate's paired kind is not the kind that went looking, e.g. a JavaScript member rooting at either pnpm-workspace.yaml or the workspace root's own package.json. No such descriptor reaches the code paths that would actually exercise it.

What is covered

a_candidate_is_read_with_the_kind_it_is_paired_with and an_unrecognised_candidate_does_not_hide_a_later_one (crates/dependable-fetch/src/discover.rs) do test heterogeneity, but they call the private root_in_dir directly and stage a fake pairing (("package.json", ManifestKind::CargoToml)).

What is not covered

Nothing exercises a descriptor where root_kind != kind through:

The debug_assert! in workspace_root_of guarding the self_governing invariant ("a self-governing kind must appear among its own root_names kinds") has no test that trips it.

The traps #102 exists to close therefore reopen at exactly the layer with no coverage, the day a second ecosystem's descriptor lands — and #84 (pom.xml) and #85 (Swift) are both open.

Why it could not be fixed in #102

WorkspaceRoots is #[non_exhaustive] with no constructor, so a synthetic descriptor cannot be built from dependable-fetch. ManifestKind::workspace_roots returns Some only for CargoToml, so no real descriptor is heterogeneous yet.

Suggested fix

A #[doc(hidden)] or cfg(test)-gated test descriptor in dependable-core — either a constructor for WorkspaceRoots or a hidden ManifestKind whose workspace_roots() is deliberately heterogeneous — so dependable-fetch can drive the public walk, the self branch, and the cache key with root_kind != kind, and can trip the debug_assert!.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions