skip to content

One resource-limits rule runs in a pre-commit hook, CI and admission — why do the three copies drift?

level: juniorimportance: should knowfreq 48%

answer

  1. three installs, not one rule
  2. each upgrades on its own clock
  3. publishing is not installing
  4. same manifest, different rule version
  5. bound the window, measure the lag

basics

~20 s

Each decision point installs its own copy of the rule library and updates on its own schedule. Publishing a new version does not change what is already installed, so the three run different rule versions until each one is upgraded.

solid answer

~40 s

There is no single shared rule — there are three installations of one versioned rule library. The pre-commit hook is installed on each laptop and refreshes when a developer reinstalls it, the CI check resolves whatever version the pipeline file names when the job starts, and the admission-time ruleset changes only when the platform team deploys a new one. Publishing v2.3 to the library changes none of them by itself. So even when all three evaluate the identical manifest, they can return different verdicts purely because they hold different versions of the same rule. The practical questions are therefore which version each consumer is actually on, how far behind it is allowed to fall, and which copy is never allowed to lag.

go deeper

for a junior

Be ready to say that each enforcer installs its own copy of the rule library and updates on its own schedule, so publishing a new rule changes nothing that is already running until each copy is upgraded.

for a middle

Explain how each copy actually gets its version — a pinned entry in a pipeline file, a hook installed on a laptop, a ruleset the platform deploys — and why identical input can still produce different verdicts.

for a senior

Show how you would measure the spread: have every decision record the library version it used, collect it, and report which consumers are behind and by how much before deciding what to change.

for a principal

Own the position that some drift is permanent and the goal is a bounded, published window. Say how long an advisory copy may lag, which copy is never allowed to lag, and who is accountable when it does.

## One rule, three installations A policy rule sounds like a single object — "every container must declare CPU and memory requests and limits" — but nothing enforces a sentence. What enforces it is a copy of the rule, loaded into some process, at some version. If the same rule runs as a pre-commit hook, as a pipeline check, and again on the cluster's admission path, you are operating **three installations of one versioned artifact**, not one rule in three places. ## How each copy gets its version The mechanisms are genuinely different, which is why they drift: - **The pre-commit hook** lives on a developer's machine. Its version is whatever was fetched the last time that developer installed or refreshed hooks — which may have been at onboarding, a year ago. - **The CI check** resolves the library when the job starts, from a version named in a file in the repository. If that file pins `2.1.0`, the job uses `2.1.0` until someone edits the file. If it names a floating range, the job silently changes behaviour whenever the library is published to. - **The admission-time ruleset** is loaded by a component the platform team deploys or refreshes. It changes when that deployment or refresh happens, not when the library is published. Publishing is not installing. That single fact is the whole answer at this level. ## What drift looks like concretely Suppose the container-resources rule at v1.9 required only that `requests` be set, and v2.0 extended it to require `limits` as well. A manifest with requests and no limits is *correct* under v1.9 and *rejected* under v2.3. A developer whose hook is pinned at v1.9 gets a green local run and a red CI job on the same file, with no change to the file in between. Nothing is broken; two different versions of one rule disagreed, exactly as they were written to. A related but separate concern is that the three enforcers may not even be handed the same document — a hook sees source, a later gate may see rendered output. That belongs to a different discussion. Here, assume all three see the identical manifest: version drift alone is enough to make them disagree. ## The direction of the lag is what matters Drift is not symmetric, and this is the point a candidate should reach even at a junior level: - A **local, advisory copy that lags** costs developer time. Work that the current rules reject gets caught later than it could have — annoying, never dangerous. - A **local copy that runs ahead** of the gate blocks work the gate would have allowed. Also annoying, also never dangerous. - An **enforcing gate that lags** is the one that matters. It admits changes that the current published ruleset would reject, so the organisation believes a control is in force at a strictness it is not actually applying. So the copies are not equal, and "keep everything in lockstep" is not the design goal. ## Making the drift visible You cannot manage a spread you cannot see. The cheap mechanism is to have every decision point record the rule library version alongside its verdict — in the CI job log, in the hook's output, in whatever the admission path emits — and collect those. That turns "our hooks are probably old" into a number: which consumers are behind, and by how many releases. A second, static source is the repositories themselves: the pinned version sits in a checked-in file, so an inventory across repositories tells you the CI side without waiting for a run. ## Bounding rather than eliminating With copies installed independently, some divergence window is permanent — you can shrink it, not close it. The workable target is a **bounded and measured** window: a stated maximum lag for advisory copies, automatic version bumps raised as pull requests so upgrades are routine rather than projects, and a hard rule that the authoritative gate is never the laggard. Teams that instead chase perfect lockstep end up either freezing the library or floating every consumer, and floating every consumer means one publish can turn every pipeline in the estate red at once, with no way to reproduce yesterday's verdict. ## The common wrong answer The weak answer is "one of the engines must be buggy". Two correct evaluators, given the same input and different rule versions, are supposed to disagree. The first diagnostic move is always to compare versions, not to suspect the tooling.

  • Which of the three copies is worst to leave stale, and why?
    The authoritative gate. An advisory copy that lags only makes a developer find out later than they could have. A gate that lags actually admits changes the current ruleset rejects, so the organisation reports a control at a strictness it is not applying.
  • How would you find out today which versions are actually running?
    Two sources. Statically, the pinned version sits in a checked-in file per repository, so an inventory gives you the CI side immediately. Dynamically, have each decision point emit the library version next to its verdict and collect that, which is the only way to see what laptops and the cluster are really loading.

It is three photocopies of a checklist pinned in three rooms. Rewriting the master in the office changes nothing on the walls until someone walks round with new copies.

saying these in an interview costs you the question

  • Blames a buggy engine instead of comparing rule versions
  • Assumes publishing a new rule updates every enforcer immediately
  • Believes all three enforcers read one live shared rule file
  • Treats any divergence as unacceptable rather than bounded

context