Repository navigation
docs: document per-endpoint noise in keploy.yml - #1007
prabaltripathiofficial wants to merge 6 commits into
Conversation
test.globalNoise gets an endpoints list (keploy/keploy#5409): noise for one endpoint, at an exact field path from the top of the response body. The configuration page now describes the rule's shape, which tests it applies to, how body paths, arrays, id keys, patterns and overlaps are read, and how keploy cloud replay combines keploy.yml's rules with the ones saved in the dashboard. Signed-off-by: Prabal Tripathi <prabaltripathiofficial@gmail.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Review fixes: a top-level array starts from its elements' keys
(`version` or `[].version`); endpoint noise does not apply to streamed
or gRPC responses; `{id}` in a body path is defined (which keys count as
IDs, and that a new ID is still a difference); body paths match without
case and may start with `$.`; `path` is required and case-sensitive;
header names match exactly; how rules on different fields and global
field names combine. The example sits under `test:` and uses a date
pattern that does not expire. Keploy terms and serial commas follow
STYLE.md.
Signed-off-by: Prabal Tripathi <prabaltripathiofficial@gmail.com>
Review round 2: say plainly that streamed and gRPC responses get no endpoint rules, and that a global or test-set field name ignores the field in the responses it applies to. Signed-off-by: Prabal Tripathi <prabaltripathiofficial@gmail.com>
d00a056 to
933d991
Compare
Review roundsAn independent reviewer checked every statement in the new section against keploy/keploy#5409's code (and keploy/enterprise#3515 for cloud replay), round after round until a round found nothing new.
In brief
|
There was a problem hiding this comment.
Review: #1007 at 933d991, approve with follow-ups
Scope: I read the whole diff and the surrounding configuration-file.md (version 4.0.0, the latest in versions.json). I checked every statement in the new section against keploy/keploy#5409 at 7155a37 and keploy/enterprise#3515 at de7fbc4, and drove the overlap rules through keploy's real matcher with a throwaway test (deleted afterwards). I reviewed this together with keploy/keploy#5409, keploy/enterprise#3515, keploy/k8s-proxy#1409 and keploy/enterprise-ui#2169. I didn't run yarn build; the PR pipeline covers it. Not run live.
Verified fine:
- Request matching.
pathis case-sensitive; host, query and a trailing/are ignored;{name}matches one non-empty segment;methodis case-insensitive (pathMatches/endpointMatches, keploypkg/matcher/http/endpoint_noise.go:64-99). - Body paths are exact apart from case, cover their subtree, and take an optional
$..items.atis the same field asitems[].at, anditems[0].atmatches nothing (ExactPath,exactCovers,pkg/matcher/noise_exact.go). {id}keys: a UUID, a ULID, 16+ hex characters with a digit, or 10+ digits (IsIDKey,minIDHexLen = 16,IDKeyMinDigits = 10). IDs added only by the replay are not excused (lookupskips id-key entries for added keys).- Headers are matched exactly, case-insensitively, so
X-Builddoes not matchX-Build-Id(headerKeyCovers). - Overlaps. The first rule naming a field decides (
takenBodyinAddEndpointNoise). A test case's own noise wins. A global field name cannot be narrowed, because dot-free global keys are checked before the path index (pkg/matcher/utils.go:747). "A rule ondatacoversdata.versionwherever it is in the list" also holds: I probed rules[data: [], data.version: [^v1\.]]in both orders against av2.0value, and both pass. - SSE, gRPC and mock matching are untouched: the streaming path and
compareGRPCRespbuild noise without the rules (pkg/service/replay/replay.go:5763,:9406), and mock matching is unchanged.
Gates: Markdown only. The site build and Vale are left to the PR pipeline.
Earlier reviews
| Reviewer | Point | Status |
|---|---|---|
| Copilot | Unable to review | No points |
| @prabaltripathiofficial (review rounds) round 1 | Top-level array example wrong; "applies to HTTP test responses" overclaimed; {id} undefined; nits (case, required path, headers, overlaps, example under test:) |
✅ Fixed (C): array line now version or [].version; the streamed/gRPC sentence is added; {id} is defined with the exact thresholds |
| same, round 2 | Two wording nits | ✅ Fixed (C) |
Minor
M1. The cloud replay sentence is wrong for keploy cloud replay --trigger, where keploy.yml's endpoint rules are not applied at all. (inline)
Claims ledger
| Claim | Status | Evidence |
|---|---|---|
| The section matches keploy#5409's behaviour | ✅ Verified | See "Verified fine" |
"keploy cloud replay adds the dashboard's rules after keploy.yml's, so your rule decides" |
True for a local cloud replay (enterprise#3515 unionEndpointNoise). False under --trigger (M1). Also, a dashboard rule on an enclosing field (data) still ignores your data.version whatever your pattern, as the overlaps bullet says |
|
"Every {name}/{id} is inside inline code or a fenced block, so MDX does not parse it" |
✅ Verified | Every brace in the added lines sits inside backticks or the yml fence |
| The YAML example loads as the rules shown | ✅ Verified (C) | Keys and list shapes match config.EndpointNoise (method, path, body, header) |
| Merge gate: after keploy#5409 and enterprise#3515 are released and enterprise-ui#2169 is deployed | ✅ Agree | The cloud-replay sentence and the dashboard mention depend on them |
Cross-repo / linked PRs
Field names, defaults and behaviour match keploy#5409's config.EndpointNoise and enterprise#3515. Merge last, as the PR says.
What I'd want before merge
- M1: one sentence on
--trigger.
…ules Signed-off-by: Prabal Tripathi <prabaltripathiofficial@gmail.com>
|
Re-review at M1 is fixed. The section now ends with "With |
charankamarapu
left a comment
There was a problem hiding this comment.
The section is clear and matches keploy#5409 on paths, arrays, {id}, values, the first rule deciding, and the cloud replay / --trigger behaviour. One sentence is wrong against the code today:
an endpoint rule can't narrow a field name in
globalortest-sets
That holds for body fields. It is false for headers: with global x-build: [] and a rule X-Build: ['^b-'], a live c-2 fails, because the rule's exact entry outranks the global one (repro on keploy#5409). I've asked for the code to be fixed to match this sentence, not the other way round, so keep the sentence and merge only after that fix ships. If the decision goes the other way, the sentence has to say headers differ.
Merge order in the description is right (after keploy#5409 + enterprise#3515 are released and enterprise-ui#2169 is deployed).
|
Thanks @charankamarapu. The code now matches the sentence: keploy/keploy#5409 d78444aa8 resolves a rule apart from global and test-set noise, for headers and for dotted body keys, which had the same bug. I kept the sentence and made it say the rest (2bd9f4d):
It also notes that |
A rule cannot narrow a body field or a header that global or test-set noise covers, and where both give patterns, a value either one matches is ignored. keploy test warns about a rule that can never match. Signed-off-by: Prabal Tripathi <prabaltripathiofficial@gmail.com>
e319df7 to
2bd9f4d
Compare
charankamarapu
left a comment
There was a problem hiding this comment.
Re-review at 2bd9f4d: approve. The overlap bullet now matches keploy#5409 at 2e71e30: a rule only adds to global/test-sets, for headers and body alike, and when both sides give patterns, a value either one's patterns match is ignored. The new "Rules that match nothing" bullet matches WarnEndpointNoiseProblems. Merge last, as the description says.
What has changed?
Documents per-endpoint noise (
test.globalNoise.endpoints), added in keploy/keploy#5409: ignore a response field for one endpoint (method + path) at its exact place in the body, instead of a global entry that ignores the field name in every response.versioned_docs/version-4.0.0/running-keploy/configuration-file.md:keploy.ymlexample (undertest:), which Test-Cases a rule applies to (required, case-sensitivepath; optionalmethod;{name}segments; host, query and trailing/ignored), exact body paths (any case, optional$.), arrays (items.at==items[].at, no positions, top-level arrays),{id}keys and which keys count as IDs, exact header names, value patterns, overlaps (first rule decides for the same field; rules on different fields all apply; a Test-Case's own noise wins; global field names cannot be narrowed), that streamed and gRPC responses and mock matching are not affected, and thatkeploy cloud replayadds the dashboard's rules afterkeploy.yml's;globalNoisebullet and the closing note mention the new field.Related: keploy/keploy#5409 (feature), keploy/enterprise#3515, keploy/k8s-proxy#1409, keploy/enterprise-ui#2169. Merge when keploy#5409 and keploy/enterprise#3515 are released and keploy/enterprise-ui#2169 is deployed (the cloud-replay sentence and the dashboard depend on them).
Type of change
How Has This Been Tested?
A Markdown-only change to one existing page; no new page, sidebar entry or component. Every
{name}/{id}is inside inline code or a fenced block, so MDX does not parse it. I did not runyarn build/yarn servelocally (the machine could not hold the site's dependencies); the PR's build and Vale checks cover it.Checklist: