Skip to content

fix(mcp): bundle the authoring primer production serves - #1325

Merged
ynadge merged 1 commit into
mainfrom
mcp-primer-from-production
Nov 23, 2026
Merged

ynadge merged 1 commit into
mainfrom
mcp-primer-from-production

Conversation

@ynadge

@ynadge ynadge commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Primary change type

  • Bug fix
  • Documentation
  • Feature
  • Tests
  • Dependency update
  • Maintenance or refactor

Problem and motivation

@sapiom/mcp bundles a copy of the authoring primer that it falls back to when neither the live instructions nor a cached copy is available. #1314 bundled a copy taken from a local backend (127.0.0.1, release 2026-11-15.1), because production did not yet serve the browser revision guidance, and changed the snapshot test to accept that source. George approved #1314 on the condition that the primer is regenerated from production and the production-URL test restored once backend #6972 deployed. #6972 is live, but #1314 merged before the refresh, so the release PR #1322 would currently publish the local copy.

Summary and scope

  • Regenerate packages/mcp/src/instructions.generated.ts from https://api.sapiom.ai/v1/mcp/instructions (release 2026-11-22.3, digest 8fd85f75d34f, verified against the served digest).
  • Restore the snapshot test to its form before feat(purchases): add explicit browser revision handling #1314, which renders the committed file for https://api.sapiom.ai and so rejects any other source.
  • Update the browser revision checks in instructions.test.ts to the served wording, which replaced the phrases feat(purchases): add explicit browser revision handling #1314 asserted. The test still checks both sides: a browser revision the agent resends under the same key, and an uncertain merchant update a person reconciles.
  • Drop the App Links test's docs.sapiom.ai/capabilities/app-links check; the served primer no longer links to docs.sapiom.ai.
  • Add a @sapiom/mcp patch changeset.

Out of scope: no code or API change. Merge this before the release PR #1322.

Related work

Related issue or discussion: George's approval of #1314, which asked for this before merge. Backend: Sapiom #6972, deployed at 547e88e71.

Validation

node scripts/mcp-instructions-snapshot.mjs — wrote from https://api.sapiom.ai/v1/mcp/instructions: release 2026-11-22.3, digest 8fd85f75d34f (matches X-Sapiom-Content-Digest)
node --test scripts/mcp-instructions-snapshot.test.mjs — 6 pass
pnpm --filter @sapiom/mcp typecheck — pass (after building workspace dependencies)
pnpm --filter @sapiom/mcp lint — pass
pnpm --filter @sapiom/mcp test — 27 files, 363 tests pass; perf 1 pass; capabilities 1 pass
prettier --check on the changed files — pass
With main's local snapshot restored, the production snapshot test and the browser revision test both fail

Tests and documentation

The snapshot test again requires a production source. The browser revision and App Links tests follow the served primer. No documentation change: PUBLISHING.md already describes this refresh as the first step of an @sapiom/mcp release.

Compatibility and release impact

  • Breaking or externally visible changes: None to the API. The bundled fallback primer changes to the text production serves.
  • Changeset: Added (@sapiom/mcp patch).

Security

  • I have not included secrets, credentials, private data, or unsanitized logs.
  • This pull request does not publicly disclose a suspected vulnerability. I
    will follow the
    Security Policy for
    private reporting.

AI assistance

  • I did not use AI assistance for this change.
  • I used AI assistance and have described it below.

Claude Code ran the generator against production and edited the tests and changeset. The results were checked by the commands above, including putting the old snapshot back to confirm the restored tests reject it.

Checklist

  • I read CONTRIBUTING.md, and this contribution follows the direct-PR or issue-first policy.
  • This pull request addresses one focused problem and contains no unrelated cleanup.
  • I added or updated tests, or explained above why tests are not applicable.
  • I ran the relevant build, typecheck, lint, and test commands, or explained
    any N/A checks above.
  • I updated documentation for user-facing changes, or marked it N/A above.
  • I added a Changeset for a published-package change, or explained why it is not applicable.
  • I can explain and maintain every submitted change, including any AI-assisted work.

🤖 Generated with Claude Code


Devin Review

Summary by CodeRabbit

  • New Features
    • The MCP package now includes the authoring primer for use when live instructions or a cached copy are unavailable.
  • Improvements
    • Updated guidance for browser-based cart revisions, retries, refusal handling, and recovery through REST or the merchant.
  • Tests
    • Updated checks to reflect the current instruction wording and snapshot rendering behavior.

#1314 bundled a primer taken from a local backend (release 2026-11-15.1), because production
did not yet serve the browser revision guidance, and let the snapshot test accept that source.
Production now serves it (release 2026-11-22.3), so the snapshot is regenerated from
https://api.sapiom.ai and the test requires production again.

The browser revision checks now match the served wording, and the App Links test no longer
expects the docs.sapiom.ai link the primer dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The changeset records a patch release for @sapiom/mcp and documents when the bundled production primer is used. Tests update expected instruction wording and snapshot validation, including use of the production API URL.

Changes: Production Primer Snapshot

Layer / File(s) Summary
Record release and update validation
.changeset/mcp-primer-from-production.md, packages/mcp/src/instructions.test.ts, scripts/mcp-instructions-snapshot.test.mjs
The changeset documents the production-served primer release and its fallback condition. Instruction tests check revised browser-revision, retry, refusal, and recovery wording. Snapshot validation uses the snapshot’s embedded constants and the production API URL. The tests no longer check the retired App Link documentation URL or extract a source URL from the snapshot.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: gwitwer

Merge Risk: Minimal · up to 7cef5

This updates the bundled fallback primer tests and adds a patch changeset. No behavior or API risk was identified, so the change looks safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: bundling the authoring primer that production serves in the @sapiom/mcp fallback. It is specific and matches the changeset, regenerated primer, and test updates. The t…
Description check Passed The description follows the repository template. It sets the primary change type to Bug fix and fills in problem and motivation, summary and scope, related work, validation commands with results, test…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: bundling the authoring primer that production serves in the @sapiom/mcp fallback. It is specific and matches the changeset, regenerated primer, and test updates. The title uses the fix(mcp) convention and is 55 characters, within a concise length.

Full details: Description check

Explanation

The description follows the repository template. It sets the primary change type to Bug fix and fills in problem and motivation, summary and scope, related work, validation commands with results, tests and documentation, compatibility and release impact, security, AI assistance, and checklist. It explains the link to #1314 and the reason production must be the source. The template's validation block uses a text fence with the commands, so the required content is present.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit reads the primer at dawn,
And checks the words before hopping on.
The cart stays open for revisions anew,
Same request, same key, retries stay true.
The snapshot agrees, and the rabbit says, “Phew!”

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ff6b9eed-a09b-4c09-b772-ebb535b579c8
Commits

Reviewing files that changed from the base of the PR and between e9c43de and 7cef5b4.

Files ignored due to path filters: 1

  • packages/mcp/src/instructions.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 3

  • .changeset/mcp-primer-from-production.md
  • packages/mcp/src/instructions.test.ts
  • scripts/mcp-instructions-snapshot.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 2 potential issues.

Devin Review

Comment on lines +172 to +174
// A hand edit anywhere in the committed snapshot, header included, fails this offline:
// the file must be exactly what the generator renders from its own constants.
test("the committed snapshot is the generator's output for its own body", async () => {

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.

🔍 Source label is not provenance

The offline test passes checked-in values to renderModule rather than comparing them with a production response. A locally generated snapshot still passes if its source header is relabeled as production.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +239 to +241
\`lineItems\` go in \`claimedLineItems\`; merchant, currency and card stay the same). You can also
update a purchase that is waiting for approval or ready to pay, until the card is entered. Then
follow the new \`nextAction\`: the person may be asked to approve again. If the response is lost,

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.

🔍 Earlier browser checkout revision cutoff

The primer ends revisions at card entry, while transactions.update documents revisions for unused authorizations. Browser Pay separates filling the form from relaying payment.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@ynadge
ynadge merged commit e660ede into main Nov 23, 2026
14 of 15 checks passed
@ynadge
ynadge deleted the mcp-primer-from-production branch November 23, 2026 01:44
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.

2 participants