Skip to content

Unit test: overlay inject writes live-proven config.toml PreToolUse (not hooks/ symlink) #827

Closed

Description

@currentbits

Goal

Default (fake grok, always-on) unit test that materializeGrokHome writes the live 1.0.13 config.toml [[hooks.PreToolUse]] shape, copies grok-guardrail-hook.js next to guardrails.js on the overlay, and does not put the gate on the GROK_HOME_LINKS hooks/ symlink.

Why

#826 proved live grok 1.0.13 loads overlay config.toml as source.type=configToml and honors {decision:deny} / exit 2. This worktree is missing the #812 inject. The live canary stays skip-unless-GROK_LIVE. CI must not set GROK_LIVE.

Must

  • Overlay config.toml has the proven shape:
    [[hooks.PreToolUse]]
    matcher = ""
    hooks = [
      { type = "command", command = "<hook>", timeout = N },
    ]
  • Overlay dest contains regular files grok-guardrail-hook.js and guardrails.js (not symlinks).
  • User ~/.grok/hooks (the GROK_HOME_LINKS target) is untouched.
  • No control_request path. No GROK_LIVE in CI.

Related: #812 #826

Activity

  1. currentbits commented on Sep 2, 2026

    @currentbits
    OwnerAuthor

    Always-on unit tests are in electron/test/grok-home.test.js (materializeGrokHome PreToolUse inject (#812)).

    This worktree had no inject. Re-implemented from #812 comments, with matcher = "" so the overlay matches the live 1.0.13 / #826 shape.

    • Overlay config.toml has [[hooks.PreToolUse]] + matcher = "" + inline { type = "command", ... }.
    • Copies grok-guardrail-hook.js next to guardrails.js as regular files on the overlay.
    • Does not write the gate through the GROK_HOME_LINKS hooks/ symlink.
    • CODER_GUARDRAILS=off skips the inject.
    • Live canary electron/test/grok-live-hook.test.js stays skip-unless-GROK_LIVE=1 (and never when CI=true). CI does not set GROK_LIVE. No control_request path.

    Verified: node --test on grok-home / grok-guardrail-hook / guardrails / grok-home-reclaim / grok / guardrails-runner — all pass; live canary SKIP.

  2. added
    plan:done
    and removed
    plan:doing
    on Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions