Skip to content

feat(workspace): scaffold-time Refs policy knob (DEVKIT_REFS_POLICY) - #1292

Merged
c-vigo merged 10 commits into
devfrom
feature/1282-refs-policy-knob
Jul 29, 2026
Merged

c-vigo merged 10 commits into
devfrom
feature/1282-refs-policy-knob

Conversation

@c-vigo

@c-vigo c-vigo commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

New .vig-os manifest key DEVKIT_REFS_POLICY steering the Refs: #N enforcement policy from ONE key into BOTH enforcement points — the validate-commit-msg hook args in the scaffolded .pre-commit-config.yaml and CI's validate-commit-range (which until now silently ran the tool default, the #1074 desync class):

  • chore-optional (default / empty key) — today's behavior, byte-identical scaffold
  • optional — Refs never required (type/format validation kept)
  • required — every type needs Refs:, chore included

Solo/private consumers get Refs-optional without editing the preserved .pre-commit-config.yaml (no permanent upgrade-diff nag, no hook/CI desync).

Design notes

  • required maps to a none sentinel, not "": both CLIs guard with if args.refs_optional_types: — an empty string is falsy and silently reverts to the {chore} default (the existing empty-set unit test bypasses the CLI). none is not a real commit type, so every real type requires Refs; no vig-utils change needed.
  • Scaffold surface: render_refs_policy in init-workspace.sh (anchored sed, no-op for the default, composes with the trunk render on the same file); manifest READ/validate/write-back per the .vig-os upgrade blanks DEVKIT_TAG_PREFIX / DEVKIT_FLOATING_TAGS (silent release-tag regression) #1116 round-trip idiom. In direnv/flake-hooks mode (no scaffolded pre-commit YAML) the render no-ops — hooks are flake domain; CI still enforces.
  • CI surface: resolve-toolchain parses the key and emits a refs-optional-types output (tolerant: unexpected/absent → chore); ci.yml commit-checks routes it via env: (zizmor/sync-issues template: mirror-bootstrap step interpolates target-branch input into run block (zizmor template-injection) #1279 pattern) into --refs-optional-types. The two policy→types mappings are cross-referenced in comments at both renderers.
  • docs/MIGRATION.md: manifest-table row + the manifest-vs-flake doctrine bullet.

Test evidence

  • TDD, two cycles (scaffold 588414c2→72cdd46e, CI d6527693→2ea2036d), failing-first confirmed each.
  • bats --filter 1282: 6/6 ok (default byte-identical, optional/required round-trip, invalid-value abort, trunk compose).
  • pytest tests/test_ci_runner.py tests/test_workflow_model.py: 41 passed (incl. the byte-identical .pre-commit-config.yaml render pin).
  • prek run --all-files: green.

Merge order

Part of the #1280–#1285 solo-adoption batch (semver:minor); recommended merge order #1281 → #1280 → #1283 → #1282 → #1284 → #1285.

Closes #1282

c-vigo added 10 commits July 29, 2026 12:47
The scaffolded justfile.project test/test-cov recipes gate on pyproject.toml
presence, so a consumer with a pyproject.toml but no test suite ran
uv run pytest and got exit 5 ("no tests collected"), turning just test and CI
red out of the box. Both recipes now swallow pytest's exit 5 while propagating
every other nonzero exit, so "nothing to test" no-ops green like non-Python
consumers already do.

Refs: #1281
The #1283 default-branch preflight refuses a repo where no main can be
resolved; the #886 dry-run fixture was a lone feature branch. Non-testable
via bats (pytest-owned fixture).

Refs: #1283
Resolve-toolchain maps the manifest key to a refs-optional-types output
(chore default, full types list for optional, none sentinel for required)
and the commit-checks step routes it to validate-commit-range via env.
Documents the knob in MIGRATION.md and the changelog.

Refs: #1282
needs.resolve-toolchain.outputs.* reads job outputs, not the composite
action outputs — without the mapping the commit-checks env resolved empty
and the policy silently reverted to chore (actionlint #995 caught it).
Shape test pins the job-output mapping.

Refs: #1282
@c-vigo
c-vigo force-pushed the feature/1282-refs-policy-knob branch from 2ea2036 to 67f32ac Compare July 29, 2026 12:56
@c-vigo
c-vigo merged commit 263a740 into dev Jul 29, 2026
13 checks passed
@c-vigo
c-vigo deleted the feature/1282-refs-policy-knob branch July 29, 2026 13:06
c-vigo added a commit that referenced this pull request Jul 29, 2026
## Summary

New `docs/SOLO_ADOPTION.md`: the one document a single-user, private
repo follows to adopt devkit without the team/traceability layer —
expressed purely as a combination of existing knobs, no new mode.
Distilled from the beancount-repo adoption evaluation that produced
#1280–#1284.

The recipe: `--mode devcontainer --workflow trunk` +
`DEVKIT_FEATURES_DISABLED=release,sync-issues,scanning,skills,worktree,gh-templates`
+ `DEVKIT_REFS_POLICY=optional`, with the accurate two-step apply flow
(both are manifest-only keys: scaffold, set keys, `--force` re-render,
`--preview` first). The guide states what is KEPT (hook stack, commit
type/format validation, agent-identity enforcement, managed upgrade
path, justfiles, dev env, `ci.yml`) as clearly as what is dropped, calls
out `renovate` as a kept-by-default judgment call (preserved-class
`renovate.json` never pruned), warns about forward drift (new feature
groups arrive enabled), and cross-links the three adoption notes that
trip solo adopters (#1283 `main` default branch, #1280 undotted
`typos.toml`, #1281 zero-test Python repos). A `--profile solo`
installer flag is explicitly out of scope (possible follow-up against
#1285).

Also: README pointer in the install section (edited via
`docs/templates/README.md.j2` — README is generated — and regenerated
with `just docs`), MIGRATION.md cross-link bullet in the manifest
section, changelog Added entry.

## ⚠️ Merge order — merge LAST

Depends on #1292 (`DEVKIT_REFS_POLICY`, #1282) and #1293
(`DEVKIT_FEATURES_DISABLED`, #1284): the guide documents those keys and
links MIGRATION.md anchors that land with #1291/#1293. Recommended batch
order: #1290 → #1291 → #1292 → #1293 → this.

## Verification

Docs-only (no TDD — no runtime surface). `prek run --all-files` green;
`just docs` confirms README regenerates identically from the template.

Closes #1285
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