Skip to content

spago publish accepts a manifest whose description exceeds the registry 300-char limit, producing an index entry spago build can't decode #773

Closed

Description

@afcondon

Summary

spago publish accepts a package whose description exceeds the registry
Manifest schema's 300-character LimitedString limit. The publish succeeds and
the version appears in the metadata, but the manifest written to the registry
index
violates the schema, so consumer-side spago build cannot decode it.
Because the whole package entry fails to read, the package becomes uninstallable.

Publish-side validation and consume-side decoding disagree about what is a valid
manifest.

Reproduction

harmonia@0.1.0 (afcondon/purescript-harmonia) is a live, minimal reproducer.

  1. A package whose spago.yaml description is 432 characters.
  2. spago publish → succeeds; the version appears in metadata.
  3. From a consumer depending on it (extraPackages: { harmonia: 0.1.0 }),
    spago build --refresh:
‼ Could not read package manifests for 'harmonia' from index. Error: $.description: Could not decode Manifest:
  LimitedString: Exceeds limit of 300 characters.

✘ The following packages do not exist in the package index:
  - harmonia

Evidence

Expected

spago publish (or the registry pipeline it submits to) should reject a
manifest whose description exceeds the 300-char limit, with a clear error,
before writing it to the index — so that anything which publishes is always
decodable by consumers.

Impact

  • The published version is uninstallable from the registry.
  • The invalid line appears to poison the entire package index entry: a later
    corrected version (e.g. 0.1.1) would still leave the bad 0.1.0 line in
    ha/rm/harmonia, so the entry stays unreadable until 0.1.0 is unpublished.
  • Recovery is awkward: spago exposes registry transfer but no unpublish
    (only spago auth mentions "transfer and unpublish operations"), so removing
    the bad version needs the registry's own process.

Environment

  • spago 1.0.3
  • purs 0.15.x
  • macOS (darwin 24.6.0)

Note

The root cause may live in the registry's publish validation
(purescript/registry / the registry-lib Manifest codec) rather than in spago
itself — feel free to transfer. Filing here because spago publish is the
user-facing entry point that accepted the invalid manifest.

Activity

  1. thomashoneyman commented on Jun 30, 2026

    @thomashoneyman
    Member

    This is probably a registry-dev bug. The manifest type indeed restricts to the specified 300 character limit:

    $ CJ.recordPropOptional @"description" (Internal.Codec.limitedString 300)

    However, when coming from SpagoYaml we never validate the string length:

    spagoYamlToManifest :: String -> SpagoYaml -> Either String Manifest
    spagoYamlToManifest ref config = do
    package@{ name, description, dependencies: spagoDependencies } <- note "No 'package' key found in config." config.package
    publish@{ version, license, owners } <- note "No 'publish' key found under the 'package' key in config." package.publish
    location <- note "No 'location' key found under the 'publish' key in config." publish.location
    let includeFiles = NonEmptyArray.fromArray =<< (Array.mapMaybe NonEmptyString.fromString <$> publish.include)
    let excludeFiles = NonEmptyArray.fromArray =<< (Array.mapMaybe NonEmptyString.fromString <$> publish.exclude)
    let printRangeError packages = "The following packages did not have their ranges specified: " <> String.joinWith ", " (map PackageName.print (Set.toUnfoldable packages))
    dependencies <- lmap printRangeError $ convertSpagoDependencies spagoDependencies
    pure $ Manifest
    { name
    , version
    , description

    We should have either validated the string length (easy to forget), or defined a LimitedString type in the manifest type so that you have to parse to that string. The first would be an immediate solution, something like this:

    spagoYamlToManifest ref config = do
      -- ... existing checks ...
      -- Add description length validation:
      case package.description of
        Just desc | String.length desc > 300 -> 
          Left "Description exceeds 300 character limit"
        _ -> pure unit
      
      pure $ Manifest { ... }

    but the second would be the long-term fix, just a little more far-reaching. And alas we'd need to unpublish this package version.

  2. thomashoneyman commented on Jun 30, 2026

    @thomashoneyman
    Member

    There should be a spago unpublish command? You can certainly unpublish registry packages within a window, something like 24hrs.

  3. afcondon commented on Jul 6, 2026

    @afcondon
    Author

    ooops, i didn't check back in on this...so the 24 hour window would have passed by now, but i'm back in that Harmonia library now and will try unpublishing it and resubmitting when i have a new version

    thanks for the follow-up!

  4. f-f commented on Jul 18, 2026

    @f-f
    Member

    I think we are ok with having that description be 432 char long. The bug is indeed in the registry-dev code, so I will transfer this ticket there.

    I would propose that we extend the description tolerance to 500 chars so that harmonia fits there, and add the LimitedString type to the manifest so we don't stumble on this again.

  5. transferred this issue frompurescript/spagoon Jul 18, 2026
  6. added
    bug
    on Jul 18, 2026
  7. thomashoneyman commented on Jul 18, 2026

    @thomashoneyman
    Member

    That’s fine with me, it was an arbitrary limit anyway.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions