[PR #1941] [MERGED] fix(design-grammar): rewrite-rules.yml was never validated at all #32205

Closed
opened 2026-07-12 08:51:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1941
Author: @Shashank-Tripathi-07
Created: 7/7/2026
Status: Merged
Merged: 7/10/2026
Merged by: @profvjreddi

Base: devHead: fix/design-grammar-rewrite-rules-validation


📝 Commits (1)

  • e8cfc83 fix(design-grammar): rewrite-rules.yml was never validated at all

📊 Changes

2 files changed (+24 additions, -2 deletions)

View changed files

📝 design-grammar/rewrite-rules.yml (+2 -2)
📝 design-grammar/scripts/validate.mjs (+22 -0)

📄 Description

Summary

  • Confirmed via grep: validate.mjs and build-html.mjs only ever read grammar.yml -- neither script mentions rewrite-rules.yml anywhere. Any drift in that file stays silent and permanent.
  • Two of its rules already used relieves values outside the file's own declared constraint vocabulary: prefetching listed "bandwidth stalls" (the file declares "bandwidth", not that phrase) and sparsification listed "compute" (not declared at all).

Fix

  • Added a check to validate.mjs that loads rewrite-rules.yml and verifies every rule's relieves entries are drawn from the file's own declared constraints: list.
  • Corrected the two anomalies: "bandwidth stalls" -> "bandwidth", and "compute" -> "utilization" (sparsification reduces the values processed, i.e. relieves compute-utilization pressure -- the closest existing term in the declared vocabulary).

Test plan

  • node scripts/validate.mjs failed with both issues before the data fix:
    rewrite-rules.yml rule 'prefetching': relieves 'bandwidth stalls' is not in the declared constraint vocabulary
    rewrite-rules.yml rule 'sparsification': relieves 'compute' is not in the declared constraint vocabulary
    
  • Passes cleanly after the fix (✓ grammar.yml is valid, 90 primitives, 51 assemblies, 0 issues).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1941 **Author:** [@Shashank-Tripathi-07](https://github.com/Shashank-Tripathi-07) **Created:** 7/7/2026 **Status:** ✅ Merged **Merged:** 7/10/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `fix/design-grammar-rewrite-rules-validation` --- ### 📝 Commits (1) - [`e8cfc83`](https://github.com/harvard-edge/cs249r_book/commit/e8cfc8384a772b633cdf794238f51781b1579918) fix(design-grammar): rewrite-rules.yml was never validated at all ### 📊 Changes **2 files changed** (+24 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `design-grammar/rewrite-rules.yml` (+2 -2) 📝 `design-grammar/scripts/validate.mjs` (+22 -0) </details> ### 📄 Description ## Summary - Confirmed via grep: `validate.mjs` and `build-html.mjs` only ever read `grammar.yml` -- neither script mentions `rewrite-rules.yml` anywhere. Any drift in that file stays silent and permanent. - Two of its rules already used `relieves` values outside the file's own declared constraint vocabulary: `prefetching` listed `"bandwidth stalls"` (the file declares `"bandwidth"`, not that phrase) and `sparsification` listed `"compute"` (not declared at all). ## Fix - Added a check to `validate.mjs` that loads `rewrite-rules.yml` and verifies every rule's `relieves` entries are drawn from the file's own declared `constraints:` list. - Corrected the two anomalies: `"bandwidth stalls"` -> `"bandwidth"`, and `"compute"` -> `"utilization"` (sparsification reduces the values processed, i.e. relieves compute-utilization pressure -- the closest existing term in the declared vocabulary). ## Test plan - [x] `node scripts/validate.mjs` failed with both issues before the data fix: ``` rewrite-rules.yml rule 'prefetching': relieves 'bandwidth stalls' is not in the declared constraint vocabulary rewrite-rules.yml rule 'sparsification': relieves 'compute' is not in the declared constraint vocabulary ``` - [x] Passes cleanly after the fix (`✓ grammar.yml is valid`, 90 primitives, 51 assemblies, 0 issues). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-07-12 08:51:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#32205