Skip to content

feat: export packages.<system>.guardrails - #1799

Merged
c-vigo merged 3 commits into
devfrom
feature/1572-export-guardrails-package
Oct 1, 2026
Merged

c-vigo merged 3 commits into
devfrom
feature/1572-export-guardrails-package

Conversation

@c-vigo

@c-vigo c-vigo commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Description

Surfaces the vendored guardrails gates derivation directly as
packages.<system>.guardrails, for a consumer that already owns its own dev
shell and a committed pre-commit/prek config and only wants the hermetic
gate binaries — without migrating to mkProjectShell.

Type of Change

  • feat -- New feature
  • docs -- Documentation only
  • test -- Adding or updating tests

Modifiers

  • Breaking change (!)

Changes Made

  • tests/test_flake_checks.py: new test_guardrails_package_is_exposed
    (builds packages.<system>.guardrails and asserts
    share/guardrails/gates/test-gates.sh is present in the output) — committed
    failing first (TDD RED).
  • flake.nix: added guardrails = guardrailsPkg; to the cross-platform
    packages set (the existing guardrailsPkg derivation used by the
    guardrails capability module and the guardrails-canary/-shellcheck
    checks), alongside the existing services package (TDD GREEN).
  • docs/NIX.md: new subsection in Capability modules documenting
    packages.<system>.guardrails as the supported API for a consumer that
    owns its dev shell/hook config, and
    $out/share/guardrails/gates/test-gates.sh as the supported way to assert
    gate execution in a consumer flake. Docs-only change, no new consumer-facing
    check added (YAGNI, per the issue's "optional" ask Issue and PR templating #2).
  • CHANGELOG.md ## Unreleased → Added (mechanically synced to
    assets/workspace/.devcontainer/CHANGELOG.md by the sync-manifest hook).

Changelog Entry

Added

  • packages.<system>.guardrails: the vendored gates without a mkProjectShell migration (#1572)
    • The guardrails gates derivation (previously reachable only through
      mkProjectShell's modules = [ "guardrails" ]) is now exposed directly
      as packages.<system>.guardrails, for a consumer that owns its own dev
      shell and pre-commit/prek config and only wants the hermetic gate
      binaries. Composes with Decision: which layer owns module-contributed pre-commit hooks? #1492: the consumer's hook config stays
      consumer-owned
    • Documented in docs/NIX.md: $out/share/guardrails/gates/test-gates.sh
      is the supported way for a consumer to assert gate execution in its own
      flake

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

  • uv run pytest tests/test_flake_checks.py::test_guardrails_package_is_exposed
    — RED before the flake.nix change (attribute missing), GREEN after
    (builds and finds the gate script).
  • Full tests/test_flake_checks.py + tests/test_flake_services.py (minus
    the services-boot integration test, excluded per repo convention) — 33
    passed, including test_flake_check_succeeds and
    test_services_package_exposed_without_clobbering_linux_packages
    (regression guard that the Linux-only image packages weren't clobbered by
    the packages restructure — this PR follows the same cross-platform-set
    pattern services already established).
  • just precommit (prek run --all-files) — green, no modified files.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Scope note: the issue's ask #2 was optional ("either expose the canary as a
consumer-usable check, or document the execution-proof entry point"). Took
the docs-only path per the plan, to avoid adding a new consumer-facing check
that nobody has asked for yet (YAGNI) — checks.guardrails-canary stays
devkit-internal.

Refs: #1572

c-vigo added 3 commits October 1, 2026 15:56
Surface the vendored guardrails gates derivation directly in the
cross-platform packages set, for consumers that own their dev shell
and pre-commit config and only want the hermetic gate binaries
without migrating to mkProjectShell.

Refs: #1572
Document the new packages.<system>.guardrails export in docs/NIX.md's
capability-modules section as the supported API for a consumer that
owns its dev shell and pre-commit config, and
$out/share/guardrails/gates/test-gates.sh as the supported way to
assert gate execution in a consumer flake. Add the CHANGELOG entry
(mechanically synced to assets/workspace/.devcontainer/CHANGELOG.md
by the sync-manifest pre-commit hook).

Refs: #1572
@c-vigo
c-vigo merged commit bdfe3d3 into dev Oct 1, 2026
17 checks passed
@c-vigo
c-vigo deleted the feature/1572-export-guardrails-package branch October 1, 2026 16:34
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