fix(audit): align schema pattern detection#50
Conversation
|
@KimHyeongRae0 is attempting to deploy a commit to the Cytonic Team on Vercel. A member of the Team first needs to authorize it. |
fb7823c to
0663375
Compare
|
Strong fix @KimHyeongRae0 — the audit was using regex shortcuts to detect FAQ/HowTo while the schema generator used proper detection logic, so the audit could report "FAQPage schema eligible" while the schema generator would silently produce nothing. Extracting Three new tests covering the three cases (FAQ without answer, single-step "HowTo", real FAQ) make the regression boundary clear. Approving. Will merge once the open queue clears. |
|
Thanks. Marked this ready for review. |
Greptile SummaryThis PR consolidates duplicate FAQ and HowTo pattern-detection logic into a new shared
Confidence Score: 5/5Safe to merge — the change is a clean extraction of identical logic into a shared module with no observable behavioral regression on valid inputs. All four branches introduced by the new detection logic are covered by the new tests. The audit-side behavioral tightening (question-word requirement, per-page FAQ scan, ≥2-step HowTo guard) is intentional and matches what schema generation already enforced, so no downstream drift is introduced. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[audit.ts] -->|import| SP[schema-patterns.ts]
B[schema.ts] -->|import| SP
SP --> F{detectFaqPatterns}
F --> F1[Heading starts with question word?]
F1 -->|yes| F2[Collect answer lines]
F2 --> F3[Return items]
F1 -->|no| F4[Skip]
SP --> H{detectHowToSteps}
H --> H1[Heading matches Step N or N.?]
H1 -->|yes| H2[Collect body lines]
H2 --> H3{steps >= 2?}
H3 -->|yes| H4[Return steps]
H3 -->|no| H5[Return empty]
Reviews (3): Last reviewed commit: "test(audit): add positive HowTo test cas..." | Re-trigger Greptile |
Greptile flagged that the schema-presence test block covered three failure paths (non-question heading, single-step heading, FAQ that should pass) but no positive HowTo case. Without it, a regression in the `>= 2 steps` guard or the step regex would silently go undetected. Added a test asserting that content with two ## Step N: headings passes the 'FAQPage or HowTo schema' check. 12 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Added the missing positive HowTo test case ( @greptileai re-review please. |
Fixes audit/schema FAQ and HowTo detection drift. Validation:
npm run lint,npm run test -- --run,npm run build.