docs: checklist for adding or changing a .cabal file format field - #12056
docs: checklist for adding or changing a .cabal file format field#12056andreabedini wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new CONTRIBUTING guide section describing the required workflow for introducing or changing .cabal file format fields, with a focus on correctly gating syntax behind cabal-version (and ensuring cabal check enforces the introduction version) to prevent issues like #9331.
Changes:
- Documented a step-by-step checklist for adding/changing
.cabalfields, centered onCabalSpecVersionandcabalSpecLatest. - Documented the correct way to gate fields in
FieldGrammar.hs(and why not to usecabalSpecLatestby name). - Documented adding the corresponding
checkSpecVerenforcement inCabal/.../Check/Target.hs, plus changelog updates.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
18d998a to
9e897eb
Compare
|
@andreabedini: do you think the Copilot's comments are worth answering? Ideally, I'd not review while the PR is in the middle of other changes. |
9e897eb to
e09e04c
Compare
Add a 'Adding or changing a `.cabal` file format field' section explaining how to gate new fields behind `cabal-version` to avoid the haskell#9331 class of bug where ungated fields are silently accepted by older Cabal. The checklist covers the full mechanism around `CabalSpecVersion`: ensuring a constructor exists for the next unreleased spec version (a major API break), keeping `cabalSpecLatest` in sync, gating the field in `FieldGrammar.hs` with a literal `availableSince` constructor (not the name `cabalSpecLatest`), adding a matching `checkSpecVer` in `Check/Target.hs`, and documenting the change.
e09e04c to
e183fc0
Compare
|
@Mikolaj I believe the comments have been addressed. |
angerman
left a comment
There was a problem hiding this comment.
I hope that AIs (if they end up being used) find this helpful as well! Or hold their meat proxies to this checklist!
Summary
Adds a new section to
CONTRIBUTING.md, "Adding or changing a.cabalfile format field", documenting how to correctly gate new or changed.cabalfields behindcabal-version.This is the class of bug described in #9331: when a new field is not gated, an older
Cabal/cabal-installsilently accepts it and does the wrong thing, or a newer field leaks into a package that claims an oldcabal-version. Features that influence generated files (Paths_*.hs,cabal_macros.h, autogen sources, …) are especially dangerous when ungated.I tried to be as clear as possible, please review and suggest changes.
What it documents
A step-by-step checklist around the
CabalSpecVersionenum:CabalSpecVersionconstructor exists for the next unreleased (even) spec version — and that adding one is an API-breaking change requiring a major version bump, with the total functions that must be extended.cabalSpecLatestin the same change, so the constructor andcabalSpecLatestnever drift apart.FieldGrammar.hswithavailableSince <literal constructor> []— not the namecabalSpecLatest, which would retroactively move the field's introduction version forward on every spec bump.checkSpecVerinCabal/.../Check/Target.hssocabal checkreports the field used below its introduction version.doc/file-format-changelog.rstand add achangelog.d/entry.Type of change
Documentation only — no code changes, no changelog entry required.