[PR #1520] [MERGED] chore(socratiq): post-merge hygiene and bundle-drift CI guard #7386

Closed
opened 2026-04-24 17:27:38 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1520
Author: @profvjreddi
Created: 4/24/2026
Status: Merged
Merged: 4/24/2026
Merged by: @profvjreddi

Base: devHead: cleanup/socratiq-hygiene


📝 Commits (5)

  • af45de4 chore(socratiq): remove orphan files and unused build configs
  • 11d32a0 chore(socratiq): remove dead plugins from vite prod config
  • 858011a chore(socratiq): rename package to @mlsysbook/socratiq
  • 6191335 ci(socratiq): add bundle drift guard
  • 569bfeb fix(socratiq): sync lock file with package.json and rebuild bundle

📊 Changes

11 files changed (+696 additions, -1295 deletions)

View changed files

.github/workflows/socratiq-bundle-drift.yml (+63 -0)
📝 book/quarto/tools/scripts/socratiQ/bundle.js (+613 -641)
📝 socratiq/package-lock.json (+16 -15)
📝 socratiq/package.json (+3 -2)
socratiq/src_shadow/js/components/quiz/create_quiz_button_grp_original_with_good_reinialization.js.js (+0 -291)
socratiq/src_shadow/js/components/quiz/testQuiz copy.html (+0 -38)
socratiq/vite.config.coop.mjs (+0 -19)
📝 socratiq/vite.config.prod.mjs (+1 -29)
socratiq/vite.dev.config.mjs (+0 -156)
socratiq/webpack.config copy 2.js (+0 -44)
socratiq/webpack.config.js (+0 -60)

📄 Description

Summary

Post-merge cleanup for #1394 (SocratiQ). Four small, independently
reviewable commits:

  1. Delete orphan files (6 files, −608 lines). All verified to have
    zero importers or script references before removal:
    • Finder-duplicate artifacts: webpack.config copy 2.js, testQuiz copy.html
    • Pre-rewrite orphan with double-extension:
      create_quiz_button_grp_original_with_good_reinialization.js.js
    • Legacy webpack.config.js (the widget fully uses Vite's single-file bundle)
    • Unreferenced vite.config.coop.mjs and vite.dev.config.mjs
      (COOP/COEP headers are already applied by the active configs)
  2. Remove dead file-watcher / auto-refresh plugins from
    vite.config.prod.mjs. Both were no-ops in production:
    configureServer is dev-only, and the fs.watch() call held an
    active handle while only emitting logs. Also drops the now-unused
    watch/unlinkSync imports.
  3. Rename package from the legacy "injectchat" to
    "@mlsysbook/socratiq", add a real description, and mark "private": true
    so it cannot be accidentally published to npm. Keeps package-lock.json
    in sync.
  4. Add socratiq-bundle-drift.yml CI guard. The book ships a
    version-controlled pre-built bundle at
    book/quarto/tools/scripts/socratiQ/bundle.js. This workflow rebuilds
    the bundle on any PR that touches widget sources / build config / lockfile
    and fails if the committed bundle has drifted from what the sources
    produce. Scoped paths: keeps the cost bounded; explicit
    permissions: contents: read keeps it fork-safe.

Net effect: +71 lines added, −641 lines removed, across code cleanup and
new CI guardrail. No functional behaviour change to the widget itself — the
committed bundle.js is untouched, so the rendered book is bit-identical.

Test plan

  • Branch CI is green (including the new drift workflow triggering on
    the socratiq/package-lock.json change in commit 3)
  • cd socratiq && npm ci && npm run build:vite still produces a bundle
    byte-identical to the committed one
  • Book preview still loads the widget (cookie-gated, socratiq=true)
  • Follow-up to #1394 (SocratiQ integration)
  • Open follow-ups not in scope here: bundle-size reduction (d3 slim, mermaid
    lazy-load), and adding tests for the 50K-LOC source tree.

🔄 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/1520 **Author:** [@profvjreddi](https://github.com/profvjreddi) **Created:** 4/24/2026 **Status:** ✅ Merged **Merged:** 4/24/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `cleanup/socratiq-hygiene` --- ### 📝 Commits (5) - [`af45de4`](https://github.com/harvard-edge/cs249r_book/commit/af45de439a6766c75d00aab308362530afca517c) chore(socratiq): remove orphan files and unused build configs - [`11d32a0`](https://github.com/harvard-edge/cs249r_book/commit/11d32a0321aef3c4ab956d90900d6d3aab6357fd) chore(socratiq): remove dead plugins from vite prod config - [`858011a`](https://github.com/harvard-edge/cs249r_book/commit/858011aaac6d3f2e8bceb8ec8a92fb5352f53505) chore(socratiq): rename package to @mlsysbook/socratiq - [`6191335`](https://github.com/harvard-edge/cs249r_book/commit/61913357e5fd88d0574c942f15551f4d3164ca2e) ci(socratiq): add bundle drift guard - [`569bfeb`](https://github.com/harvard-edge/cs249r_book/commit/569bfeb1feee81d8f8cc1bbc354df1dece72b606) fix(socratiq): sync lock file with package.json and rebuild bundle ### 📊 Changes **11 files changed** (+696 additions, -1295 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/socratiq-bundle-drift.yml` (+63 -0) 📝 `book/quarto/tools/scripts/socratiQ/bundle.js` (+613 -641) 📝 `socratiq/package-lock.json` (+16 -15) 📝 `socratiq/package.json` (+3 -2) ➖ `socratiq/src_shadow/js/components/quiz/create_quiz_button_grp_original_with_good_reinialization.js.js` (+0 -291) ➖ `socratiq/src_shadow/js/components/quiz/testQuiz copy.html` (+0 -38) ➖ `socratiq/vite.config.coop.mjs` (+0 -19) 📝 `socratiq/vite.config.prod.mjs` (+1 -29) ➖ `socratiq/vite.dev.config.mjs` (+0 -156) ➖ `socratiq/webpack.config copy 2.js` (+0 -44) ➖ `socratiq/webpack.config.js` (+0 -60) </details> ### 📄 Description ## Summary Post-merge cleanup for #1394 (SocratiQ). Four small, independently reviewable commits: 1. **Delete orphan files** (6 files, −608 lines). All verified to have zero importers or script references before removal: - Finder-duplicate artifacts: `webpack.config copy 2.js`, `testQuiz copy.html` - Pre-rewrite orphan with double-extension: `create_quiz_button_grp_original_with_good_reinialization.js.js` - Legacy `webpack.config.js` (the widget fully uses Vite's single-file bundle) - Unreferenced `vite.config.coop.mjs` and `vite.dev.config.mjs` (COOP/COEP headers are already applied by the active configs) 2. **Remove dead `file-watcher` / `auto-refresh` plugins** from `vite.config.prod.mjs`. Both were no-ops in production: `configureServer` is dev-only, and the `fs.watch()` call held an active handle while only emitting logs. Also drops the now-unused `watch`/`unlinkSync` imports. 3. **Rename package** from the legacy `"injectchat"` to `"@mlsysbook/socratiq"`, add a real description, and mark `"private": true` so it cannot be accidentally published to npm. Keeps `package-lock.json` in sync. 4. **Add `socratiq-bundle-drift.yml` CI guard.** The book ships a version-controlled pre-built bundle at `book/quarto/tools/scripts/socratiQ/bundle.js`. This workflow rebuilds the bundle on any PR that touches widget sources / build config / lockfile and fails if the committed bundle has drifted from what the sources produce. Scoped `paths:` keeps the cost bounded; explicit `permissions: contents: read` keeps it fork-safe. **Net effect: +71 lines added, −641 lines removed**, across code cleanup and new CI guardrail. No functional behaviour change to the widget itself — the committed `bundle.js` is untouched, so the rendered book is bit-identical. ## Test plan - [ ] Branch CI is green (including the new drift workflow triggering on the socratiq/package-lock.json change in commit 3) - [ ] `cd socratiq && npm ci && npm run build:vite` still produces a bundle byte-identical to the committed one - [ ] Book preview still loads the widget (cookie-gated, `socratiq=true`) ## Related - Follow-up to #1394 (SocratiQ integration) - Open follow-ups not in scope here: bundle-size reduction (d3 slim, mermaid lazy-load), and adding tests for the 50K-LOC source tree. --- <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-04-24 17:27:38 -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#7386