Repository navigation
Description
Problem
Conformance.Options.only and Options.skip (added in #366, for #302) match a rule id by plain string prefix: id.startsWith(prefix). A prefix that is a complete rule id therefore also matches any rule whose id merely continues it, with no / in between. Today that happens once among the rule ids:
spec/status/create-locationis a prefix ofspec/status/create-location-matches-self.
So skip: ["spec/status/create-location"] (meant to leave out the SHOULD-level Location check) also leaves out create-location-matches-self, and only: ["spec/status/create-location"] runs both. A caller cannot name the first rule alone. Each future rule whose id extends an existing one adds another such collision silently.
The owner decided on #366 to keep plain prefixes there, matching only as it shipped, and to make both segment-aware in a follow-up (decision).
Proposal
Match a prefix by path segment, for both only and skip: a prefix matches a rule id when it equals the id, or when the id continues it with /. A prefix that already ends in / ("spec/links/") keeps matching every rule beneath it.
"spec/status/create-location"matches that rule alone."spec/content-negotiation"and"spec/content-negotiation/"both match the whole section."spec/content-neg"matches nothing.
This narrows what some existing prefixes select, so it is a behaviour change for a caller relying on a partial segment; the changeset should say so.
Done when
- One shared matcher serves
onlyandskipinsrc/Conformance.ts(selected), segment-aware as above, with the JSDoc on both options, the README anddocs/conformance.md§1.5 updated. - A test pins that
skip: ["spec/status/create-location"]leaves out that rule and keepsspec/status/create-location-matches-self(and the same foronly). - The tests that rely on a partial-segment prefix are updated: in
src/Conformance.test.ts, "leaves out the skipped rules from whatonlyandtiersselect" skipsspec/content-negotiation/accept-weight, which today matchesaccept-weight-is-not-a-parameterandaccept-weight-zero-refusesonly as a partial segment, and "leaves out the skipped rule ids" usesspec/content-neg. - A changeset describes the narrower matching.
Generated by Claude Code
Activity
feat(Conformance): `skip` and `requestTimeout` options (#302)
feat(Conformance): match `only` and `skip` prefixes by path segment (#…