Skip to content

v4.4.0-client: emit manifest.json + defaultMenuUrl field (4.4.1) - #2

Merged
alexey-max-fedorov merged 17 commits into
masterfrom
v4.4.0-client
May 25, 2026
Merged

alexey-max-fedorov merged 17 commits into
masterfrom
v4.4.0-client

Conversation

@alexey-max-fedorov

Copy link
Copy Markdown
Contributor

Summary

Ships the patcher-side half of the client-side patching architecture. Companion PR on ProdigyOrigin consumes the new manifest format.

What changed

  • Manifest schema — new `dist/manifest.json` emitted alongside `dist/game.min.js`. Contains `schemaVersion`, `patcherVersion`, `hash` (sha256 of `{rules, prefix, suffix, defaultMenuUrl}`), `rules`, `prefix`, `suffix`, `defaultMenuUrl`.
  • Patcher refactor — `src/wrappers.ts` (prefix + suffix builders), `src/rules.ts` (regex rule definitions + `applyRules`), `src/manifest.ts` (type + `buildManifest` + `hashManifest`). Orchestrator at `src/patch.ts` calls them in order and writes both artifacts.
  • `defaultMenuUrl` field (v4.4.1) — `buildSuffix` no longer takes `guiLink`. The CheatGUI loader block now reads `window.ORIGIN_MENU_URL` (set by the extension before the bundle runs). `buildManifest` carries `defaultMenuUrl` as a top-level field, included in the hash for cache invalidation.
  • Tests — full TDD coverage for rules / wrappers / manifest / integration. 37/37 passing.

Artifacts

  • `dist/manifest.json` — manifestHash `aa3a3ec39939dbb0`, gameVersion `2026.25.0`, all 6 rules pass, `patchDegraded: false`
  • `dist/game.min.js` — regenerated with new suffix shape
  • `dist/metadata.json` — game version + patch status

Test plan

  • CI: `pnpm test` passes (37/37)
  • CI: `pnpm build && pnpm run patch ./dist` produces a clean manifest with all rules passing
  • Browser test via ProdigyOrigin extension: load patched bundle, confirm menu loads from `defaultMenuUrl`
  • Browser test: set popup override → confirm override wins over `defaultMenuUrl`

🤖 Generated with Claude Code

alexey-max-fedorov and others added 14 commits May 24, 2026 01:45
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Undo the named-callback extraction (_pnpLoadGUI / _pnpPollTick) from
buildSuffix and restore the original inline IIFE forms that match
patch.ts byte-for-byte. Loosen the two timer regex tests to tolerate
nested parens in the timer callbacks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Refactors src/patch.ts to delegate to patches.ts (RULES + applyRules),
wrappers.ts (buildPrefix + buildSuffix), and manifest.ts (buildManifest).
Now emits dist/manifest.json, dist/game.min.js (verification copy), and
dist/metadata.json with manifestHash + perRuleCounts. Switches from throw-on-degraded
to graceful degradation (patchDegraded flag). All 6 rules matched live bundle;
patchDegraded=false.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The mod-bundle URL is now supplied at runtime by the extension via
window.__ORIGIN_MENU_URL__. This unblocks per-user override from the
extension popup without rebuilding the manifest.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
defaultMenuUrl is the URL the patched bundle fetches for the mod (cheatGUI)
loader at runtime. It is included in the manifest hash so that changes
invalidate extension caches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
manifest.json now ships defaultMenuUrl=GUI_LINK and the suffix no longer
bakes in the URL. dist artifacts regenerated against current game version.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 25, 2026 04:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements the patcher-side half of the client-side patching flow by emitting a dist/manifest.json artifact (rules + wrappers + hash) and refactoring patch logic into dedicated modules, including support for a defaultMenuUrl that the extension can override at runtime.

Changes:

  • Add manifest generation (schemaVersion, patcherVersion, hash, rules, prefix, suffix, defaultMenuUrl) and write dist/manifest.json alongside a verification dist/game.min.js.
  • Refactor patching into src/patches.ts (rules/apply/hash), src/wrappers.ts (prefix/suffix), and src/manifest.ts (manifest build/hash), wired by src/patch.ts.
  • Add a Node test suite covering rules/wrappers/manifest and an integration pipeline test; update workflow to commit the new manifest.

Reviewed changes

Copilot reviewed 14 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/wrappers.test.ts Adds unit tests for buildPrefix/buildSuffix, including __ORIGIN_MENU_URL__ behavior.
tests/smoke.test.ts Adds a minimal harness smoke test.
tests/patches.test.ts Adds unit tests for rule shapes, substitutions, and rule hashing.
tests/manifest.test.ts Adds tests for manifest construction and hashing including defaultMenuUrl.
tests/integration.test.ts Adds an end-to-end synthetic bundle test for rules → wrappers → manifest.
src/wrappers.ts Introduces prefix/suffix builders; suffix now reads menu URL from window.__ORIGIN_MENU_URL__.
src/patches.ts Defines PatchRule, the RULES list, applyRules, and hashRules.
src/patch.ts Refactors orchestrator to verify/apply rules, build manifest, and write artifacts/metadata.
src/manifest.ts Adds manifest type + buildManifest/hashManifest.
src/constants.ts Bumps patcher VERSION to 4.4.1.
README.md Documents the manifest-based architecture (needs an update to match current schema/hash).
package.json Bumps version and adds test/typecheck scripts.
dist/metadata.json Updates generated metadata to include manifestHash and perRuleCounts.
dist/manifest.json Adds generated manifest artifact containing rules + wrappers + defaultMenuUrl.
CLAUDE.md Updates architecture notes (contains a stale buildSuffix signature).
.github/workflows/patch.yml Ensures dist/manifest.json is committed by the patch workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread CLAUDE.md Outdated
alexey-max-fedorov and others added 2 commits May 25, 2026 13:48
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Alexey Fedorov <alexey.max.fedorov@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Alexey Fedorov <alexey.max.fedorov@gmail.com>
@alexey-max-fedorov

Copy link
Copy Markdown
Contributor Author

@copilot
You will resolve the merge conflicts in this pull request:

  1. Delete dist/game.min.js and dist/metadata.json
  2. Run this: pnpm run patch ./dist
  3. Commit and push to this branch

This should fix it.

Copilot AI commented May 25, 2026

Copy link
Copy Markdown

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • math.prodigygame.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node dist/patch.js ./dist (dns block)
    • Triggering command: /usr/bin/curl curl -I REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@alexey-max-fedorov
alexey-max-fedorov merged commit 092bb8d into master May 25, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants