Skip to content

fix: make the Swift Package Index author line a full sentence - #67

Merged
futamura merged 1 commit into
mainfrom
develop
Aug 21, 2026
Merged

futamura merged 1 commit into
mainfrom
develop

Conversation

@futamura

Copy link
Copy Markdown
Owner

Summary

#65 set metadata.authors to Kojiro Futamura and contributors, on the assumption that SPI would render it the same way it renders the line it derives from the commit history. It does not. The value becomes the whole line, so it would have appeared as a bare fragment among the sentences around it. The value now carries the prefix and the full stop itself:

metadata:
  authors: Written by Kojiro Futamura and contributors.

A comment above the key records why, so a future edit does not strip them again. The change has not reached the package page yet, so the first version anyone sees will be the correct one.

Why this is the rendering

From SwiftPackageIndex-Server on main:

Sources/App/Views/PackageController/GetRoute.Model+ext.swift, authorsListItem() — the manifest value goes out as plain text, while the git-derived path wraps its nodes:

case .fromSPIManifest(var spiymlAuthors) :
    if spiymlAuthors.count > 200 { spiymlAuthors = String(spiymlAuthors.prefix(200)) + "…" }
    return .li(.class("authors"), .text(spiymlAuthors))

case .fromGitRepository(let repositoryAuthors) :
    ...
    .group(listPhrase(opening: "Written by ", nodes: nodes, closing: "."))

Packages in the index use the field as a free-form line, which matches: vapor/vapor carries a full sentence ending in a full stop, while firebase/firebase-ios-sdk and swiftlang/swift-testing carry bare names (Google, Apple Inc.) that read fine on their own. A phrase like ours needs the verb.

No release needed

Sources/App/Controllers/API/API+PackageController+PackageResult.swift, authors(), reads defaultBranchVersion.spiManifest — the author line comes from the default branch only, never from a release:

if let spiManifest = defaultBranchVersion.spiManifest,
   let metadata = spiManifest.metadata,
   let authors = metadata.authors {
    return .fromSPIManifest(authors)

So merging to main is what puts this in front of SPI; tagging 4.0.3 would not make it land any sooner. That also corrects the expectation in #66: cutting 4.0.2 updated the Latest Release on the page, but it could never have advanced the author line. The changelog entry sits under Unreleased and will ship with whatever the next release turns out to be.

Coordination

Matched with futamura/PunycodeSwift#91, which lands the identical value and comment.

Verification

  • .spi.yml parses as YAML; metadata.authors is 44 characters, well under the 200 SPI truncates at, and the file is 496 bytes against SPIManifest's 1500 byte limit.
  • No source or manifest changes, so CI coverage is unchanged.

SPI renders metadata.authors verbatim. The "Written by" prefix and the
closing full stop are added only to the line it derives from the commit
history, so the previous value would have shown up as a bare fragment
next to the other sentences on the package page. Carry them in the value
itself, and record why in a comment so the next edit keeps them.

Verified against the server source: PackageResult.authors() reads
defaultBranchVersion.spiManifest, and GetRoute.Model+ext
authorsListItem() emits the manifest value as plain text while the git
path wraps its nodes with listPhrase(opening: "Written by ",
closing: ".").
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@futamura
futamura merged commit 4f6beea into main Aug 21, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant