chore: adopt make pre-commit workflow with full pre-commit hook suite - #80
Conversation
lucarlig
left a comment
There was a problem hiding this comment.
Requesting changes based on a full review of the PR:
-
Docker image mismatch:
make docker-prodbuilds andtesting-upvalidatesdataplane:latest, butdocker/docker-compose.ymlstill resolves all three data-plane services tocontextforge-data-plane:latest. This can launch a stale image or fail to pull. Please keep the Makefile and Compose image contract aligned. -
Secret scanning is fail-open: the baseline contains 42 findings with no
is_secretaudit decisions, while the detect-secrets hook omits--fail-on-unaudited. The merge driver also regenerates the baseline and exits successfully without rejecting unaudited/live findings. Please audit the baseline, enable the unaudited gate, and make the merge path fail closed. -
Merge-driver setup is missing:
.gitattributesinstructs contributors to runmake configure-git, but that target does not exist. Please add the configuration target or remove the unusable merge-driver integration. -
Makefile default regression: removing
helpmakesdocker-prodthe default target, so plainmakenow starts a Docker build andmake helpfails. Please restore a safe help/default target. -
Hermeticity claim is incomplete: only
PRE_COMMIT_HOMEandTMPDIRare redirected; Cargo-based hooks can still write underCARGO_HOME(~/.cargo) on an uncached machine. Please redirect the relevant caches or adjust the stated acceptance criteria.
I reproduced the Compose image resolution and Makefile behavior. The complete pre-commit suite and current GitHub CI pass, but they do not catch the behavioral and fail-open issues above.
d057052 to
d2e26a7
Compare
|
Thanks for the review @lucarlig
|
ee86520 to
6bd835e
Compare
Signed-off-by: Lang-Akshay <akshay.shinde26@ibm.com>
Signed-off-by: Lang-Akshay <akshay.shinde26@ibm.com>
Signed-off-by: Lang-Akshay <akshay.shinde26@ibm.com>
Signed-off-by: Lang-Akshay <akshay.shinde26@ibm.com>
Signed-off-by: Lang-Akshay <akshay.shinde26@ibm.com>
- Remove cargo bench --no-run hook (no benchmarks exist; was compiling full release profile for nothing) - Remove jobs=4 cap in .cargo/config.toml (let Cargo use all cores) - Add --fail-on-unaudited to detect-secrets hook - Audit all 45 baseline findings (is_secret: false) - Add IMAGE_NAME variable, help target, configure-git, secrets-update targets to Makefile; redirect CARGO_HOME for hermeticity - Fail-close the secrets-baseline merge driver on unaudited findings Signed-off-by: Lang-Akshay <akshay.shinde26@ibm.com>
Signed-off-by: Lang-Akshay <akshay.shinde26@ibm.com>
6d6eeff to
8b7de59
Compare
Signed-off-by: Lang-Akshay <akshay.shinde26@ibm.com>
lucarlig
left a comment
There was a problem hiding this comment.
Re-review of cd391e1: the Docker image contract, audited baseline, normal detect-secrets hook, configure-git, safe default Make target, and cache redirection are fixed. The direct detect-secrets hook now passes and leaves the baseline unchanged. One blocker remains in the secrets-baseline merge driver (inline). I reproduced it independently; the current green checks do not exercise this path. Please fix the regex, exclude .secrets.baseline, and verify the merge driver can regenerate a baseline successfully while still rejecting genuinely unaudited findings. Please also update the PR description: it still says the pre-commit suite includes cargo bench, but that hook has been removed.
Signed-off-by: Lang-Akshay <akshay.shinde26@ibm.com>
Closes IBM/mcp-context-forge#5960
Summary
Adopts the
make pre-commitworkflow for the data-plane repo, mirroring the ContextForge control-plane pre-commit setup.Changes
.pre-commit-config.yaml— full hook suite: private key detection, large-file guard, merge-conflict check, end-of-file / trailing-whitespace / encoding fixers, BiDi control forbid, AI-slop guards, IBM detect-secrets, and Rust hooks (cargo fmt, clippy, deny, nextest, build). Allrevs pinned to commit SHAs. End-of-file fixer excludes.gitignore(intentionally no trailing newline).Makefile—make pre-committarget: runs the full suite hermetically withPRE_COMMIT_HOMEandTMPDIRredirected under.cache/(nothing written to~)..secrets.baseline— generated baseline for IBM detect-secrets covering dev TLS/JWT keys inassets/, test fixture secrets, and scanner test-vector strings insidecpex-secrets-detection.scripts/git/resolve-secrets-baseline-conflict.sh— merge driver that regenerates the baseline on conflict, excludes the baseline from its own scan, preserves audit decisions, and rejects unaudited findings.scripts/git/test-resolve-secrets-baseline-conflict.sh— focused regression test covering successful regeneration, audit preservation, baseline exclusion, and fail-closed rejection..gitignore— adds.cache/(pre-commit home, venvs, tmp)..gitattributes— marks generated/binary files for diff hygiene.Acceptance
make pre-commitruns the full suite against all files and passes on a clean tree..cache/— nothing written to~.