Repository navigation
Description
Description
DEVKIT_REFS_POLICY (#1282) decides which commit types may omit the Refs: line, but it is a three-value enum whose "some types exempt" case is hardcoded to the literal type name chore. A consumer that adds a custom commit type via DEVKIT_COMMIT_TYPES (#1431) cannot exempt that type without exempting every type.
Make the exempt set a list, mirroring the full-replacement-list pattern DEVKIT_COMMIT_TYPES and DEVKIT_BRANCH_TYPES already establish.
Problem Statement
The underlying tool already supports this — validate-commit-msg takes --refs-optional-types <comma-separated list> and would happily accept chore,record. The Nix/scaffold layer is what clamps it, in nix/hooks.nix:
refsOptionalTypesFor = refsPolicy: commitTypes:
if refsPolicy == "optional" then lib.concatStringsSep "," commitTypes
else if refsPolicy == "required" then "none"
else "chore";plus the matching assertion in mkProjectShell:
assert pkgs.lib.assertMsg (builtins.elem refsPolicy [ null "chore-optional" "optional" "required" ]) ...DEVKIT_COMMIT_TYPES exists precisely so a consumer can add a domain-specific type. A concrete case: a repo that keeps an append-only data record (a CSV registry or similar) adds a record type so those commits are greppable in history and distinct from chore. Routine record updates are made deliberately without an issue — the record is the change, and there is nothing for an issue to add. But record is not the literal string chore, so it inherits the Refs requirement.
The two knobs therefore compose badly: you can add the type, but you cannot give it the Refs treatment the type was added for.
Note this is not locally patchable. The value feeds three renderers in lockstep — the flake-generated hook, the scaffolded .pre-commit-config.yaml, and CI's resolve-toolchain refs-optional-types output. A consumer hand-editing its own flake would pass locally and still fail commit-checks, because CI re-derives the list from the same key.
Proposed Solution
Add DEVKIT_REFS_OPTIONAL_TYPES — a comma-separated, whitespace-tolerant FULL REPLACEMENT list of types that may omit Refs:, defaulting to chore.
- Absent/empty resolves to
chore, i.e. exactly today'schore-optionalbehaviour. No change for devkit or existing consumers. - Entries must be a subset of the resolved
DEVKIT_COMMIT_TYPES; guard loudly at scaffold time, the way the existing charset guards do. - Flows through the same three renderers, so local and CI stay in lockstep.
This also subsumes the existing enum, which becomes expressible rather than special:
DEVKIT_REFS_POLICY |
equivalent list |
|---|---|
chore-optional (default) |
chore |
optional |
the resolved DEVKIT_COMMIT_TYPES |
required |
empty (none) |
Either keep DEVKIT_REFS_POLICY as sugar over the new key, or deprecate it once consumers migrate. Keeping both is fine as long as precedence is documented — the narrower key should win.
Alternatives Considered
DEVKIT_REFS_POLICY=optional. Available today and a one-line change, but it drops Refs enforcement for feat, fix, docs and everything else to fix one type. For a consumer that wants a reviewable audit trail this trades away the thing the policy exists to protect.
Use chore for record-type commits. Works, and is the current workaround. But it erases the distinction DEVKIT_COMMIT_TYPES was added to create: the type is what makes those commits greppable and what a changelog or audit tool keys on. Adding a type and then not being able to use it is the smell.
Open a placeholder issue per record change. Satisfies the gate and defeats its purpose — issues that exist only to be referenced are noise, and they make the traceability signal worse, not better.
Let refsPolicy accept a raw list in mkProjectShell only. Half a fix: the flake surface would accept it while the scaffold and CI renderers still map from the enum, so local and CI would disagree. The key has to change at the manifest level for all three to follow.
Additional Context
Builds directly on #1282 (DEVKIT_REFS_POLICY) and #1431 (DEVKIT_COMMIT_TYPES), and follows the same realize-at-scaffold-time pattern both use. Related: #1434, which made the flake-generated consumer hooks read these keys at eval time.
Impact
Backward compatible: an absent key resolves to chore, byte-identical to today's default render. Benefits any consumer that has added a custom commit type whose commits are legitimately issue-less. Scope is small — one manifest key, the refsOptionalTypesFor mapping, the scaffold render, and the resolve-toolchain output.
Activity
test: cover a named refs-optional commit-type set
feat(workspace): exempt a named set of commit types from Refs
test: pin the refs-exemption fail-safe and re-render on narrowing
fix(workspace): never let a bad refs exemption relax the gate
feat(workspace): exempt a named set of commit types from Refs (#1639)
c-vigo commentedon Sep 16, 2026
Shipped to
devin #1639 (merge commit 7ce8030), all 14 checks green.DEVKIT_REFS_OPTIONAL_TYPESlanded as proposed: a comma-separated,whitespace-tolerant FULL REPLACEMENT list, defaulting to
chorewhenabsent or blank, so devkit and every existing consumer render
byte-identically. It flows through all three renderers from the one key —
render_refs_policyinassets/init-workspace.sh,mkProjectShell's newrefsOptionalTypesargument (nix/hooks.nix→flake.nix→ the.vig-osreader in the scaffold template), and
resolve-toolchain'srefs-optional-typesoutput — so local and CI cannot disagree.Entries must be lowercase alphanumerics and a subset of the resolved
DEVKIT_COMMIT_TYPES; the scaffold aborts loudly andmkProjectShellfailseval, while CI warns rather than failing the job.
hooksModule.defaultCommitTypesis now exported so the flake's subset assert validates against the same list
the hook argv is built from, rather than a fourth copy of the stock 11.
Precedence, as the issue left open:
DEVKIT_REFS_POLICYis kept as sugarand the narrower key wins, with a notice printed when both are set. The enum
was not deprecated — it remains the only way to express "exempt nothing",
because an empty
--refs-optional-typesreads as falsy tovalidate-commit-msgand reverts to its own{chore}default, which is whyrequiredstill travels as thenonesentinel.Two defects were caught in review and fixed before merge, each with a
regression test committed first:
.pre-commit-config.yamlis preserved across upgrades, nevertemplate-overwritten, so its current arg is whatever the previous render
left. Skipping the
sedbecause the resolved value happened to equal thechoredefault stranded a consumer narrowing its exempt set with theprevious, wider arg locally while CI resolved the narrow one — precisely
the divergence this issue exists to prevent.
mapping. CI's fallback on an invalid value went to the
DEVKIT_REFS_POLICYmapping, so underDEVKIT_REFS_POLICY=optionala typoin the new key switched the Refs gate off for every type behind a warning.
It now clamps to
choreunless the policy is already narrower (none).This is the one place the [FEATURE] feat(workspace): scaffold-time commit-types knob (DEVKIT_COMMIT_TYPES) for validate-commit-msg + validate-commit-range #1431 commit-types analogy inverts: there the
stock list is a subset of any sane custom one, here it is not.
Also fixed:
docs/COMMIT_MESSAGE_STANDARD.mdis shipped to consumers andstill said only
choreis exempt — it now carries the same consumer-knobpointer the commit-types table has.
Deliberately out of scope, noted in the PR: the pre-existing staleness when a
consumer clears a render key.
render_commit_typesandrender_branch_typesgate on "key absent", so clearing the key leaves theprevious render in the preserved
.pre-commit-config.yaml. This changematches that behaviour rather than diverging from it; fixing it properly
means an unconditional
sedguarded against the flake-hooks store symlinkacross all three renders, which wants its own issue.
Closing as done. It reaches consumers with the next release train.
fix(workspace): render knobs unconditionally and refuse symlinks (#1641)
fix(workspace): render the branch guard from the workflow model both …
chore: release 1.15.0 (#1644)
feat(workspace): reconcile a preserved pre-commit config on upgrade (#…