chore: merge main into feat/signature-posture
This commit is contained in:
@@ -59,6 +59,10 @@ relevant real-provider or platform workflow, or explain why it was unavailable.
|
|||||||
limits, security/privacy/containment implications, and meaningful proof gaps. -->
|
limits, security/privacy/containment implications, and meaningful proof gaps. -->
|
||||||
|
|
||||||
- Breaking changes or migration steps:
|
- Breaking changes or migration steps:
|
||||||
|
<!-- For ! / BREAKING CHANGE: show a previously valid call/configuration,
|
||||||
|
its new behavior and migration, and why compatibility/deprecation cannot
|
||||||
|
preserve it. Compatible fixes/additions should use patch/minor semantics.
|
||||||
|
See docs/releasing.md. -->
|
||||||
- Real Hopper/Ghidra, browser, or OS coverage:
|
- Real Hopper/Ghidra, browser, or OS coverage:
|
||||||
- Package or release metadata impact:
|
- Package or release metadata impact:
|
||||||
- Security, privacy, process, or containment review:
|
- Security, privacy, process, or containment review:
|
||||||
|
|||||||
@@ -84,6 +84,32 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Check out release controller and Git history
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: ${{ github.sha }}
|
||||||
|
fetch-depth: 0
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Set up Node.js for checkpoint validation
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
package-manager-cache: false
|
||||||
|
|
||||||
|
- name: Install checkpoint validation dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Validate checkpoint version and ancestry before release creation
|
||||||
|
env:
|
||||||
|
RELEASE_PHASE: ${{ inputs.phase }}
|
||||||
|
RELEASE_BRANCH: ${{ inputs.release_branch }}
|
||||||
|
SOURCE_SHA: ${{ steps.branch.outputs.sha }}
|
||||||
|
run: >-
|
||||||
|
node scripts/verify-release-checkpoint.mjs
|
||||||
|
--phase "$RELEASE_PHASE" --release-branch "$RELEASE_BRANCH"
|
||||||
|
--source-sha "$SOURCE_SHA"
|
||||||
|
|
||||||
- uses: googleapis/release-please-action@v4
|
- uses: googleapis/release-please-action@v4
|
||||||
id: release
|
id: release
|
||||||
with:
|
with:
|
||||||
@@ -116,6 +142,7 @@ jobs:
|
|||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
ref: ${{ fromJSON(steps.release.outputs.pr).headBranchName }}
|
ref: ${{ fromJSON(steps.release.outputs.pr).headBranchName }}
|
||||||
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Set up Node.js for generated documentation
|
- name: Set up Node.js for generated documentation
|
||||||
@@ -129,6 +156,16 @@ jobs:
|
|||||||
if: inputs.phase == 'prepare' && steps.release.outputs.prs_created == 'true'
|
if: inputs.phase == 'prepare' && steps.release.outputs.prs_created == 'true'
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Validate prepared release version and migration notes
|
||||||
|
if: inputs.phase == 'prepare' && steps.release.outputs.prs_created == 'true'
|
||||||
|
env:
|
||||||
|
RELEASE_BRANCH: ${{ inputs.release_branch }}
|
||||||
|
SOURCE_SHA: ${{ steps.branch.outputs.sha }}
|
||||||
|
run: >-
|
||||||
|
node scripts/verify-release-checkpoint.mjs
|
||||||
|
--phase prepare --stage candidate --release-branch "$RELEASE_BRANCH"
|
||||||
|
--source-sha "$SOURCE_SHA"
|
||||||
|
|
||||||
- name: Regenerate release documentation
|
- name: Regenerate release documentation
|
||||||
if: inputs.phase == 'prepare' && steps.release.outputs.prs_created == 'true'
|
if: inputs.phase == 'prepare' && steps.release.outputs.prs_created == 'true'
|
||||||
run: npm run docs:generate
|
run: npm run docs:generate
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
".": "5.0.0"
|
".": "6.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,104 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [6.0.0](https://github.com/morluto/rea/compare/rea-agents-5.0.0...rea-agents-6.0.0) (2026-10-08)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* **contracts:** MCP filesystem inputs now require absolute host paths, including target/snapshot paths, evidence bundle paths, managed and firmware inputs, browser/Electron launch paths and expected server paths. Calls such as `open_binary({"path":"./app"})` must send an absolute path such as `/home/analyst/app` or `C:\analysis\app`. Optional paths remain optional. CLI operator-relative paths continue to work. See [#948](https://github.com/morluto/rea/pull/948) and [#1004](https://github.com/morluto/rea/pull/1004).
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **artifacts:** trace Mach-O dylib resolution in bundles ([78d594c](https://github.com/morluto/rea/commit/78d594cacd376725f833a99402069c103aae9aac))
|
||||||
|
* **browser:** inspect historical web network captures ([#992](https://github.com/morluto/rea/issues/992)) ([2bf3663](https://github.com/morluto/rea/commit/2bf3663f654386c9fd8c1437c49659df97bd4697))
|
||||||
|
* **evm:** inspect offline bytecode interfaces through EVMole ([#1051](https://github.com/morluto/rea/issues/1051)) ([7af7bc8](https://github.com/morluto/rea/commit/7af7bc88ce0e8f084eaa0db1e8f834d495440fd9))
|
||||||
|
* **ghidra:** support native x86 PE applications on Windows ([#1030](https://github.com/morluto/rea/issues/1030)) ([c6dad93](https://github.com/morluto/rea/commit/c6dad932084032bcb32acc61e8066a7784497710))
|
||||||
|
* **native:** inspect offline ELF layout through pwntools ([#1037](https://github.com/morluto/rea/issues/1037)) ([4fc6565](https://github.com/morluto/rea/commit/4fc6565b0ffb36d7105b3524e08d0c5d603ae07d))
|
||||||
|
* **native:** inspect recorded crashes through pwntools and pwndbg ([#1054](https://github.com/morluto/rea/issues/1054)) ([163ee09](https://github.com/morluto/rea/commit/163ee09a7425479385e0ed0b5d74043e2587eab2))
|
||||||
|
* **native:** observe function and Objective-C method calls under LLDB ([1d13cef](https://github.com/morluto/rea/commit/1d13cef5f46f5e07f594bde7b1a4725f189b9a5e))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **dotnet:** validate managed metadata and CIL boundaries ([#938](https://github.com/morluto/rea/pull/938)) ([bda4ada](https://github.com/morluto/rea/commit/bda4ada7fb6bd7dd70a444bb3c57e34f7f5cc00b))
|
||||||
|
|
||||||
|
* **build:** clarify generated-file check hint and drop redundant catalog step ([#998](https://github.com/morluto/rea/pull/998)) ([6f0ef16](https://github.com/morluto/rea/commit/6f0ef160501ea3b24dfa2939dfcd3eea0dc13ee7))
|
||||||
|
|
||||||
|
* **release:** extend npm propagation window and improve diagnostics ([#943](https://github.com/morluto/rea/pull/943)) ([06b047a](https://github.com/morluto/rea/commit/06b047a0929369d5b8635b3651da115c8fcd53a7))
|
||||||
|
|
||||||
|
* **contracts:** require absolute local paths for session filesystem inputs ([#948](https://github.com/morluto/rea/pull/948)) ([5b172b1](https://github.com/morluto/rea/commit/5b172b1042fc09a4e12d956018f15d86cf397ffe))
|
||||||
|
|
||||||
|
* **ci:** generate source catalog before shard tests ([#1002](https://github.com/morluto/rea/pull/1002)) ([eb8f649](https://github.com/morluto/rea/commit/eb8f6491a88bfa79d13f7923e4ef94d791f6ba4d))
|
||||||
|
|
||||||
|
* **contracts:** require absolute local paths for remaining caller-supplied file inputs ([#1004](https://github.com/morluto/rea/pull/1004)) ([cbc0dd1](https://github.com/morluto/rea/commit/cbc0dd1e7ca36fa3504a9ea8eae303a0876b176b))
|
||||||
|
|
||||||
|
* **cli:** classify ENOTDIR JSON input failures ([#1000](https://github.com/morluto/rea/pull/1000)) ([a6132be](https://github.com/morluto/rea/commit/a6132be0546d6a9e3fa83426c8b59b1280b3e5bd))
|
||||||
|
|
||||||
|
* **browser:** preserve authorized redirect hops ([#986](https://github.com/morluto/rea/pull/986)) ([ae0f725](https://github.com/morluto/rea/commit/ae0f725fad368730c6198d49716ccc410bca0536))
|
||||||
|
|
||||||
|
* **mcp:** reject unknown MCP tool inputs ([#975](https://github.com/morluto/rea/pull/975)) ([fe64fd6](https://github.com/morluto/rea/commit/fe64fd65d93eff202ad90145544dc9ff84651974))
|
||||||
|
|
||||||
|
* **release:** publish from explicit source checkpoints ([#1003](https://github.com/morluto/rea/pull/1003)) ([64c7188](https://github.com/morluto/rea/commit/64c71880ae4f7bc658ffce46eb729c4141dbdf19))
|
||||||
|
|
||||||
|
* **release:** publish from explicit source checkpoints ([#1006](https://github.com/morluto/rea/pull/1006)) ([b4fc0ec](https://github.com/morluto/rea/commit/b4fc0ecaa1f6b912dc27880e6b6127ace47abc2e))
|
||||||
|
|
||||||
|
* **javascript:** bound semantic node projection for resource safety ([#966](https://github.com/morluto/rea/pull/966)) ([96a46ad](https://github.com/morluto/rea/commit/96a46ada0a36f0349f2b0fc20b4c932401b4ad84))
|
||||||
|
|
||||||
|
* **ci:** avoid slow Azure archive for the native cross compiler ([#1016](https://github.com/morluto/rea/issues/1016)) ([51956c1](https://github.com/morluto/rea/commit/51956c1a49a7dc9ed70a6fba480a670a7e7b2b9b))
|
||||||
|
* **ci:** decouple stdio smoke tests from Linux display probes ([#1014](https://github.com/morluto/rea/issues/1014)) ([93731e1](https://github.com/morluto/rea/commit/93731e17ddea76db86dfa84bb54536dcf8ebfa0b))
|
||||||
|
* **cli:** stream large JavaScript JSON results ([#1024](https://github.com/morluto/rea/issues/1024)) ([0e25bef](https://github.com/morluto/rea/commit/0e25befe78f220691abe5d0291cc04a75c9cc877))
|
||||||
|
* **javascript:** complete large-ASAR analysis with file-local projection ([#1055](https://github.com/morluto/rea/issues/1055)) ([b9fb438](https://github.com/morluto/rea/commit/b9fb43883570bef7cb29fd16f27c25d5a7e5bb54))
|
||||||
|
* **javascript:** recognize digits in artifact URI schemes ([#1045](https://github.com/morluto/rea/issues/1045)) ([03424ae](https://github.com/morluto/rea/commit/03424ae91ef22efd57db1bdde9379a3ac450b8f7))
|
||||||
|
* **javascript:** reconstruct HTML script loads accurately ([#1042](https://github.com/morluto/rea/issues/1042)) ([1154f2f](https://github.com/morluto/rea/commit/1154f2f03c0b0bb6cb6c5da09b8d8e1c837febc4))
|
||||||
|
* **javascript:** report application analysis progress on the CLI ([#1008](https://github.com/morluto/rea/issues/1008)) ([7b18c58](https://github.com/morluto/rea/commit/7b18c581409848077de7a9cb6d7d1a0b91a02e12))
|
||||||
|
* **javascript:** resolve module URLs and reject invalid exports targets ([#1031](https://github.com/morluto/rea/issues/1031)) ([8d5c88f](https://github.com/morluto/rea/commit/8d5c88f17cde4ab4fa54c5142f0a45e612619a53))
|
||||||
|
* **javascript:** resolve root package exports arrays ([#1046](https://github.com/morluto/rea/issues/1046)) ([53409ab](https://github.com/morluto/rea/commit/53409ab1968d60c77f98feedefe237a08859a95c))
|
||||||
|
* **mcp:** advertise JSON values without recursive schemas ([#995](https://github.com/morluto/rea/issues/995)) ([7425f70](https://github.com/morluto/rea/commit/7425f70fd0247a7ea7192deb959fd6f48ba83a21)), closes [#919](https://github.com/morluto/rea/issues/919)
|
||||||
|
* **mcp:** bound capture comparison input schema depth ([#1005](https://github.com/morluto/rea/issues/1005)) ([6b55de0](https://github.com/morluto/rea/commit/6b55de017badc9066642e1ff2561eb1da0ff93f8))
|
||||||
|
* **process:** preserve partial evidence and verify detached cleanup ([#1011](https://github.com/morluto/rea/issues/1011)) ([63cf28f](https://github.com/morluto/rea/commit/63cf28fd8f8acaf656e993300a2a24280b2fd692))
|
||||||
|
* **release:** support built-in credentials and refresh release boundary ([6a278a6](https://github.com/morluto/rea/commit/6a278a68dd4fa69b9153697ecb7bba7de4c55c32))
|
||||||
|
* **release:** support default credentials and record 5.0.0 boundary ([#1012](https://github.com/morluto/rea/issues/1012)) ([6a278a6](https://github.com/morluto/rea/commit/6a278a68dd4fa69b9153697ecb7bba7de4c55c32))
|
||||||
|
* **release:** sync 5.0.0 checkpoint back to main ([966cca8](https://github.com/morluto/rea/commit/966cca8efe5ed08b3285cd06409688d871eb5e6b))
|
||||||
|
* **snapshot:** replay validated workflow evidence ([#984](https://github.com/morluto/rea/issues/984)) ([1d62e54](https://github.com/morluto/rea/commit/1d62e54e1f976e64130e4e9b651c3180aa4fa727))
|
||||||
|
* **windows:** allow Java to read retained target snapshots ([#1027](https://github.com/morluto/rea/issues/1027)) ([28d5c39](https://github.com/morluto/rea/commit/28d5c397c83f901e4086083868041711371ad32a))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* **artifacts:** replace quadratic ZIP overlap checks ([#1013](https://github.com/morluto/rea/issues/1013)) ([76e7e51](https://github.com/morluto/rea/commit/76e7e510bb2d7d37728ca50749d524beb5890cf8))
|
||||||
|
* **javascript:** cache canonical export comparison sort keys ([#1028](https://github.com/morluto/rea/issues/1028)) ([63ba742](https://github.com/morluto/rea/commit/63ba7424c0ab69b94397e8913f8e231de111583f))
|
||||||
|
|
||||||
|
|
||||||
|
### Code Refactoring
|
||||||
|
|
||||||
|
* **build:** generate MCP tool catalog at build time instead of committing it ([#997](https://github.com/morluto/rea/pull/997)) ([35a4e18](https://github.com/morluto/rea/commit/35a4e18d3028014e24d2e209ec99a590fde63152))
|
||||||
|
|
||||||
|
* **process:** separate capture implementation from analyst workflows ([#988](https://github.com/morluto/rea/pull/988)) ([6aa9afb](https://github.com/morluto/rea/commit/6aa9afb5493a97801eb1126a0dcf11f9705165db))
|
||||||
|
|
||||||
|
* **artifacts:** move inventory and extraction into provider owners ([#1032](https://github.com/morluto/rea/issues/1032)) ([6e4535c](https://github.com/morluto/rea/commit/6e4535c1011f1982e9ab07b7ebcd600c19cd494d))
|
||||||
|
* remove abandoned test-only analysis scaffolding ([c93422a](https://github.com/morluto/rea/commit/c93422a898fdbedb7d28709144b4337a2669440b))
|
||||||
|
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
* improve Korean wording and particles ([#1047](https://github.com/morluto/rea/issues/1047)) ([c5d165b](https://github.com/morluto/rea/commit/c5d165bd03fed95a0b0105661d3ba7e0efbfa449))
|
||||||
|
* simplify the English README and organize guides ([#1043](https://github.com/morluto/rea/issues/1043)) ([28f10cf](https://github.com/morluto/rea/commit/28f10cf2bc7b7c590700b50d47072015f3e3c66e))
|
||||||
|
|
||||||
|
|
||||||
|
### Tests
|
||||||
|
|
||||||
|
* **process:** wait for observable snapshot ctime changes ([#999](https://github.com/morluto/rea/pull/999)) ([161ed91](https://github.com/morluto/rea/commit/161ed9157134d5c3b0fbae19ceb756ac58a26c04))
|
||||||
|
|
||||||
|
* **browser:** consolidate CDP workflows and colocate parser coverage ([2682904](https://github.com/morluto/rea/commit/26829045d0f0e744bb60d6babc2dc3312f4bfa53))
|
||||||
|
* **ci:** stabilize browser source identity fixture delivery ([#1023](https://github.com/morluto/rea/issues/1023)) ([ed725da](https://github.com/morluto/rea/commit/ed725dace4a689e4e5c804dc6bf06c7fc663c7c9))
|
||||||
|
* **cli:** reduce repeated startup and filesystem setup ([d88d6c1](https://github.com/morluto/rea/commit/d88d6c1897740ccbd6c57f4ba01861fc751fb3a8))
|
||||||
|
* consolidate service and process fixtures ([f8a53a8](https://github.com/morluto/rea/commit/f8a53a8c065f1ccbdaa051a4e1ef267a2047d759))
|
||||||
|
* **javascript:** consolidate source analysis and export regressions ([f517a5a](https://github.com/morluto/rea/commit/f517a5a1d7c0766ed50f8dfd5ee69e65525ac744))
|
||||||
|
* **javascript:** cover plain long-line loader identities ([#1025](https://github.com/morluto/rea/issues/1025)) ([984fc27](https://github.com/morluto/rea/commit/984fc27ce19d57f708bdae688a258cf8663cdea6))
|
||||||
|
* **mcp:** consolidate SDK schema checks and scenario ports ([9c3479e](https://github.com/morluto/rea/commit/9c3479ed95100d8ee5ed4d9158a4550e4ac2a752))
|
||||||
|
* **providers:** verify framing through client socket boundaries ([1fd1989](https://github.com/morluto/rea/commit/1fd1989d342375a01b6d14b282ad58001b7d1800))
|
||||||
|
* prune redundant conformance checks and document test priorities ([aafdf8a](https://github.com/morluto/rea/commit/aafdf8a01b42fb6fd927c0f2a66e758e1a510abc))
|
||||||
|
|
||||||
## [5.0.0](https://github.com/morluto/rea/compare/rea-agents-4.1.0...rea-agents-5.0.0) (2026-10-07)
|
## [5.0.0](https://github.com/morluto/rea/compare/rea-agents-4.1.0...rea-agents-5.0.0) (2026-10-07)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -243,7 +243,7 @@ rea setup
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"rea": {
|
"rea": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "rea-agents@5.0.0", "mcp"]
|
"args": ["-y", "rea-agents@6.0.0", "mcp"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -272,7 +272,7 @@ TypeScript と SQLite を使って私のプロジェクト向けに実装して
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"rea": {
|
"rea": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "rea-agents@5.0.0", "mcp"]
|
"args": ["-y", "rea-agents@6.0.0", "mcp"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -233,7 +233,7 @@ Setup은 Claude Code, Claude Desktop, Codex, Cursor, Gemini CLI, Windsurf, Devin
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"rea": {
|
"rea": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "rea-agents@5.0.0", "mcp"]
|
"args": ["-y", "rea-agents@6.0.0", "mcp"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -232,7 +232,7 @@ Setup 支持 Claude Code、Claude Desktop、Codex、Cursor、Gemini CLI、Windsu
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"rea": {
|
"rea": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "rea-agents@5.0.0", "mcp"]
|
"args": ["-y", "rea-agents@6.0.0", "mcp"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ For a client that requires manual configuration, use:
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"rea": {
|
"rea": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "rea-agents@5.0.0", "mcp"]
|
"args": ["-y", "rea-agents@6.0.0", "mcp"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"package": {
|
"package": {
|
||||||
"name": "rea-agents",
|
"name": "rea-agents",
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"server": "2.3.1",
|
"server": "2.3.1",
|
||||||
"client": "2.3.1",
|
"client": "2.3.1",
|
||||||
|
|||||||
@@ -11,6 +11,32 @@ breaking changes. Record the full source SHA and create `release/VERSION` at
|
|||||||
that commit. The version is a maintainer choice; Release Please's proposed
|
that commit. The version is a maintainer choice; Release Please's proposed
|
||||||
version must agree before publication.
|
version must agree before publication.
|
||||||
|
|
||||||
|
`release/VERSION` also sets the expected version for the workflow. Use an exact
|
||||||
|
SemVer such as `release/6.1.0` or `release/6.1.0-rc.1`, without build metadata.
|
||||||
|
The checkpoint validator rejects a candidate whose package, lockfile, manifest,
|
||||||
|
registry metadata or changelog disagrees with that version before creating a tag.
|
||||||
|
|
||||||
|
### Compatibility and version selection
|
||||||
|
|
||||||
|
REA uses the default SemVer strategy: compatible fixes increment patch;
|
||||||
|
compatible capabilities increment minor; incompatible public behavior increments
|
||||||
|
major. Adding tools, internal refactoring and correcting behavior outside the
|
||||||
|
supported contract do not by themselves require a major release.
|
||||||
|
|
||||||
|
The supported public surface includes documented CLI commands/options, MCP tool
|
||||||
|
names and input/result contracts, saved evidence formats and supported runtime
|
||||||
|
requirements. Before adding `!` or a `BREAKING CHANGE` footer, a PR must identify
|
||||||
|
a previously valid call or configuration that will fail or change meaning,
|
||||||
|
explain why compatibility cannot be preserved, and give its migration. Prefer
|
||||||
|
optional additions, compatibility adapters and a documented deprecation period;
|
||||||
|
group deliberate removals into a planned major release. Maintainers review this
|
||||||
|
impact before merging; the bot parses markers and cannot infer compatibility.
|
||||||
|
|
||||||
|
For example, adding an optional inspection tool is a minor change. Rejecting a
|
||||||
|
relative MCP path previously accepted by the public contract is breaking;
|
||||||
|
rejecting an input that the existing contract already prohibited is a fix.
|
||||||
|
Changing the version number alone does not restore compatibility.
|
||||||
|
|
||||||
For example, after selecting a reviewed commit for 5.0.0:
|
For example, after selecting a reviewed commit for 5.0.0:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -48,6 +74,24 @@ normalization, then approve that head's blocked runs from the PR page. Updates
|
|||||||
to the bot branch can create new approval-required runs; approval of an older
|
to the bot branch can create new approval-required runs; approval of an older
|
||||||
head does not verify the normalized candidate. Wait for the final head's CI.
|
head does not verify the normalized candidate. Wait for the final head's CI.
|
||||||
|
|
||||||
|
The validator reads the actual ancestry range from the published baseline tag
|
||||||
|
to the selected checkpoint, including visible first-parent Conventional Commits
|
||||||
|
and the PR titles in GitHub's default merge messages. The report preserves the
|
||||||
|
original merge subject alongside the extracted Conventional Commit title.
|
||||||
|
This matters after merging a side-branch release back into a newer main:
|
||||||
|
Release Please's chronological history cutoff can omit unreleased mainline
|
||||||
|
commits. Unreleased breaking markers require a major increment and references
|
||||||
|
in the new release's breaking-change migration section. Other omitted entries
|
||||||
|
are reported for review. Historical notes from an older release cannot satisfy
|
||||||
|
the new release's migration check. This audits declared markers and references;
|
||||||
|
it does not prove API compatibility or the quality of a migration explanation.
|
||||||
|
|
||||||
|
If preparation reports a mismatch or omitted breaking changes, inspect the
|
||||||
|
recorded ancestry report, correct the release PR's version artifacts and notes,
|
||||||
|
regenerate documentation, and review/test its final head. Do not repeatedly
|
||||||
|
prepare over manual corrections. Publication independently checks the merged
|
||||||
|
candidate again before Release Please can create a tag.
|
||||||
|
|
||||||
Review the candidate's version, notes, generated metadata, and package
|
Review the candidate's version, notes, generated metadata, and package
|
||||||
contents. Wait for the candidate's CI and relevant real-provider checks.
|
contents. Wait for the candidate's CI and relevant real-provider checks.
|
||||||
Routine local iterations need focused checks; CI owns full deterministic
|
Routine local iterations need focused checks; CI owns full deterministic
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "rea-agents",
|
"name": "rea-agents",
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "rea-agents",
|
"name": "rea-agents",
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/parser": "8.0.4",
|
"@babel/parser": "8.0.4",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "rea-agents",
|
"name": "rea-agents",
|
||||||
"mcpName": "io.github.morluto/rea",
|
"mcpName": "io.github.morluto/rea",
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
"description": "Reverse engineer anything from your terminal or agent with one CLI and MCP server.",
|
"description": "Reverse engineer anything from your terminal or agent with one CLI and MCP server.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -0,0 +1,338 @@
|
|||||||
|
import { gt, major, valid } from "semver";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
const shaSchema = z.string().regex(/^[a-f0-9]{40}$/u);
|
||||||
|
const versionSchema = z.object({ version: z.string() });
|
||||||
|
const manifestSchema = z.object({ ".": z.string() });
|
||||||
|
const sectionsSchema = z.object({
|
||||||
|
"changelog-sections": z.array(
|
||||||
|
z.object({ type: z.string(), hidden: z.boolean().optional() }),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
const GITHUB_MERGE_SUBJECT = /^Merge pull request #(\d+) from \S+/u;
|
||||||
|
|
||||||
|
function conventionalTitle(subject, body) {
|
||||||
|
if (!GITHUB_MERGE_SUBJECT.test(subject)) return subject;
|
||||||
|
// GitHub's default merge message puts the PR title after its subject.
|
||||||
|
// Inspect that first nonempty line, not arbitrary examples in commit prose.
|
||||||
|
return (
|
||||||
|
body
|
||||||
|
.split(/\r?\n/u)
|
||||||
|
.slice(1)
|
||||||
|
.find((line) => line.trim() !== "")
|
||||||
|
?.trim() ?? subject
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function releaseVersion(value, location) {
|
||||||
|
if (valid(value) !== value || value.includes("+")) {
|
||||||
|
throw new Error(
|
||||||
|
`${location} must contain an exact SemVer without build metadata: ${value}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function readJson(git, sha, path, schema) {
|
||||||
|
const text = await git(["show", `${sha}:${path}`]);
|
||||||
|
let value;
|
||||||
|
try {
|
||||||
|
value = JSON.parse(text);
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof SyntaxError) {
|
||||||
|
throw new Error(`${path}@${sha} contains invalid JSON: ${error.message}`);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
const parsed = schema.safeParse(value);
|
||||||
|
if (!parsed.success) {
|
||||||
|
throw new Error(`${path}@${sha} is malformed: ${parsed.error.message}`);
|
||||||
|
}
|
||||||
|
return parsed.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function readCommits(text) {
|
||||||
|
if (text.length === 0) return [];
|
||||||
|
const fields = text.split("\0");
|
||||||
|
if (fields.pop() !== "" || fields.length % 3 !== 0) {
|
||||||
|
throw new Error("Git returned malformed checkpoint history records.");
|
||||||
|
}
|
||||||
|
const commits = [];
|
||||||
|
for (let index = 0; index < fields.length; index += 3) {
|
||||||
|
const sha = shaSchema.parse(fields[index]);
|
||||||
|
const subject = z.string().parse(fields[index + 1]);
|
||||||
|
const body = z.string().parse(fields[index + 2]);
|
||||||
|
const title = conventionalTitle(subject, body);
|
||||||
|
const type = /^([a-z]+)(?:\([^)]*\))?!?: /u.exec(title)?.[1];
|
||||||
|
commits.push({
|
||||||
|
sha,
|
||||||
|
subject,
|
||||||
|
...(title !== subject ? { conventionalTitle: title } : {}),
|
||||||
|
type,
|
||||||
|
breaking:
|
||||||
|
/^[a-z]+(?:\([^)]*\))?!: /u.test(title) ||
|
||||||
|
/^BREAKING(?: CHANGE|-CHANGE):\s*\S/mu.test(body),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return commits;
|
||||||
|
}
|
||||||
|
|
||||||
|
function referencesCommit(text, commit) {
|
||||||
|
if (text.includes(commit.sha.slice(0, 7))) return true;
|
||||||
|
const pullRequest =
|
||||||
|
GITHUB_MERGE_SUBJECT.exec(commit.subject)?.[1] ??
|
||||||
|
/\(#(\d+)\)$/u.exec(commit.subject)?.[1];
|
||||||
|
return (
|
||||||
|
pullRequest !== undefined &&
|
||||||
|
new RegExp(`#${pullRequest}(?!\\d)`, "u").test(text)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function releaseNotes(text, expectedVersion) {
|
||||||
|
const headings = Array.from(text.matchAll(/^## \[([^\]]+)\].*$/gmu));
|
||||||
|
const first = headings[0];
|
||||||
|
if (first?.[1] !== expectedVersion || first.index === undefined) {
|
||||||
|
throw new Error(`CHANGELOG.md must start with release ${expectedVersion}.`);
|
||||||
|
}
|
||||||
|
return text.slice(first.index, headings[1]?.index ?? text.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
function breakingSection(notes) {
|
||||||
|
const heading = /^### [^\n]*BREAKING CHANGES[^\n]*\n/imu.exec(notes);
|
||||||
|
if (heading === null) return "";
|
||||||
|
const body = notes.slice(heading.index + heading[0].length);
|
||||||
|
const end = body.search(/^### /mu);
|
||||||
|
return end < 0 ? body : body.slice(0, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function requireAncestor(git, ancestor, descendant, description) {
|
||||||
|
try {
|
||||||
|
await git(["merge-base", "--is-ancestor", ancestor, descendant]);
|
||||||
|
} catch (error) {
|
||||||
|
const failure = z.object({ code: z.literal(1) }).safeParse(error);
|
||||||
|
if (!failure.success) throw error;
|
||||||
|
throw new Error(
|
||||||
|
`${description}: ${ancestor} is not an ancestor of ${descendant}. Sync the released tag into main before cutting a checkpoint, and prepare candidates from that frozen source.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function resolveBaseline(git, tag) {
|
||||||
|
try {
|
||||||
|
return shaSchema.parse(
|
||||||
|
(await git(["rev-parse", "--verify", `${tag}^{commit}`])).trim(),
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
const failure = z.object({ code: z.literal(128) }).safeParse(error);
|
||||||
|
if (!failure.success) throw error;
|
||||||
|
throw new Error(
|
||||||
|
`Published baseline ${tag} is unavailable. Fetch release tags and finish the previous release sync before preparing this checkpoint. ${error instanceof Error ? error.message : String(error)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function validateCandidate(git, sha, version, commits) {
|
||||||
|
const versions = [
|
||||||
|
[
|
||||||
|
"package.json",
|
||||||
|
(await readJson(git, sha, "package.json", versionSchema)).version,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
".release-please-manifest.json",
|
||||||
|
(
|
||||||
|
await readJson(
|
||||||
|
git,
|
||||||
|
sha,
|
||||||
|
".release-please-manifest.json",
|
||||||
|
manifestSchema,
|
||||||
|
)
|
||||||
|
)["."],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
const lock = await readJson(
|
||||||
|
git,
|
||||||
|
sha,
|
||||||
|
"package-lock.json",
|
||||||
|
versionSchema.extend({
|
||||||
|
packages: z.object({ "": versionSchema }),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
versions.push(
|
||||||
|
["package-lock.json", lock.version],
|
||||||
|
["package-lock.json packages.root", lock.packages[""].version],
|
||||||
|
);
|
||||||
|
const server = await readJson(
|
||||||
|
git,
|
||||||
|
sha,
|
||||||
|
"server.json",
|
||||||
|
versionSchema.extend({
|
||||||
|
packages: z.array(
|
||||||
|
z.object({ identifier: z.string(), version: z.string() }),
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const npmPackage = server.packages.find(
|
||||||
|
(entry) => entry.identifier === "rea-agents",
|
||||||
|
);
|
||||||
|
if (npmPackage === undefined)
|
||||||
|
throw new Error("server.json is missing the rea-agents package.");
|
||||||
|
versions.push(
|
||||||
|
["server.json", server.version],
|
||||||
|
["server.json rea-agents package", npmPackage.version],
|
||||||
|
);
|
||||||
|
const catalog = await readJson(
|
||||||
|
git,
|
||||||
|
sha,
|
||||||
|
"docs/product-catalog.json",
|
||||||
|
z.object({ package: versionSchema }),
|
||||||
|
);
|
||||||
|
versions.push(["docs/product-catalog.json", catalog.package.version]);
|
||||||
|
const generated = await git([
|
||||||
|
"show",
|
||||||
|
`${sha}:src/generatedPackageMetadata.ts`,
|
||||||
|
]);
|
||||||
|
const generatedVersions = Array.from(
|
||||||
|
generated.matchAll(/^\s+version: "([^"]+)"/gmu),
|
||||||
|
);
|
||||||
|
if (generatedVersions.length !== 1)
|
||||||
|
throw new Error(
|
||||||
|
"Generated package metadata must declare one literal version.",
|
||||||
|
);
|
||||||
|
versions.push(["src/generatedPackageMetadata.ts", generatedVersions[0]?.[1]]);
|
||||||
|
for (const [location, actual] of versions) {
|
||||||
|
if (actual !== version) {
|
||||||
|
throw new Error(
|
||||||
|
`${location}@${sha} declares ${actual}; release branch requires ${version}.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const notes = releaseNotes(
|
||||||
|
await git(["show", `${sha}:CHANGELOG.md`]),
|
||||||
|
version,
|
||||||
|
);
|
||||||
|
const breakingNotes = breakingSection(notes);
|
||||||
|
const missingBreaking = commits.filter(
|
||||||
|
(commit) => commit.breaking && !referencesCommit(breakingNotes, commit),
|
||||||
|
);
|
||||||
|
if (missingBreaking.length > 0) {
|
||||||
|
throw new Error(
|
||||||
|
`Release ${version} migration notes omit unreleased breaking changes: ${missingBreaking.map((commit) => `${commit.sha} ${commit.subject}`).join("; ")}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return commits.filter((commit) => !referencesCommit(notes, commit));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Validate a recorded checkpoint and optional candidate using exact Git ancestry. */
|
||||||
|
export async function inspectReleaseCheckpoint(git, options) {
|
||||||
|
const { phase, stage, releaseBranch, sourceSha, candidateSha } = z
|
||||||
|
.object({
|
||||||
|
phase: z.enum(["prepare", "publish"]),
|
||||||
|
stage: z.enum(["source", "candidate"]),
|
||||||
|
releaseBranch: z.string().startsWith("release/"),
|
||||||
|
sourceSha: shaSchema,
|
||||||
|
candidateSha: shaSchema.optional(),
|
||||||
|
})
|
||||||
|
.parse(options);
|
||||||
|
const expectedVersion = releaseVersion(
|
||||||
|
releaseBranch.slice("release/".length),
|
||||||
|
"release/VERSION",
|
||||||
|
);
|
||||||
|
if (phase === "publish" && stage === "candidate") {
|
||||||
|
throw new Error(
|
||||||
|
"Publish validates its merged source SHA; candidate stage applies only to prepare.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const applicationSha =
|
||||||
|
phase === "publish"
|
||||||
|
? shaSchema.parse((await git(["rev-parse", `${sourceSha}^1`])).trim())
|
||||||
|
: sourceSha;
|
||||||
|
const manifest = await readJson(
|
||||||
|
git,
|
||||||
|
applicationSha,
|
||||||
|
".release-please-manifest.json",
|
||||||
|
manifestSchema,
|
||||||
|
);
|
||||||
|
const baselineVersion = releaseVersion(
|
||||||
|
manifest["."],
|
||||||
|
"published baseline manifest",
|
||||||
|
);
|
||||||
|
const sourcePackage = await readJson(
|
||||||
|
git,
|
||||||
|
applicationSha,
|
||||||
|
"package.json",
|
||||||
|
versionSchema,
|
||||||
|
);
|
||||||
|
if (sourcePackage.version !== baselineVersion) {
|
||||||
|
throw new Error(
|
||||||
|
`Source package ${sourcePackage.version} and release baseline ${baselineVersion} disagree.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!gt(expectedVersion, baselineVersion)) {
|
||||||
|
throw new Error(
|
||||||
|
`Expected release ${expectedVersion} must advance published baseline ${baselineVersion}.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const baselineTag = `refs/tags/rea-agents-${baselineVersion}`;
|
||||||
|
const baselineSha = await resolveBaseline(git, baselineTag);
|
||||||
|
await requireAncestor(
|
||||||
|
git,
|
||||||
|
baselineSha,
|
||||||
|
applicationSha,
|
||||||
|
"Published baseline is outside the checkpoint ancestry",
|
||||||
|
);
|
||||||
|
const configuration = await readJson(
|
||||||
|
git,
|
||||||
|
applicationSha,
|
||||||
|
"release-please-config.json",
|
||||||
|
sectionsSchema,
|
||||||
|
);
|
||||||
|
const visibleTypes = new Set(
|
||||||
|
configuration["changelog-sections"]
|
||||||
|
.filter((section) => !section.hidden)
|
||||||
|
.map((section) => section.type),
|
||||||
|
);
|
||||||
|
const commits = readCommits(
|
||||||
|
await git([
|
||||||
|
"log",
|
||||||
|
"--first-parent",
|
||||||
|
"-z",
|
||||||
|
"--format=%H%x00%s%x00%B",
|
||||||
|
`${baselineSha}..${applicationSha}`,
|
||||||
|
]),
|
||||||
|
).filter((commit) => commit.breaking || visibleTypes.has(commit.type));
|
||||||
|
const breaking = commits.filter((commit) => commit.breaking);
|
||||||
|
if (
|
||||||
|
breaking.length > 0 &&
|
||||||
|
major(baselineVersion) > 0 &&
|
||||||
|
major(expectedVersion) <= major(baselineVersion)
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`Expected release ${expectedVersion} contains unreleased breaking markers since ${baselineVersion}: ${breaking.map((commit) => `${commit.sha} ${commit.subject}`).join("; ")}. Review compatibility or select a major version.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let snapshot = phase === "publish" ? sourceSha : candidateSha;
|
||||||
|
if (stage === "candidate" && snapshot === undefined) {
|
||||||
|
snapshot = shaSchema.parse((await git(["rev-parse", "HEAD"])).trim());
|
||||||
|
}
|
||||||
|
if (phase === "publish" || stage === "candidate") {
|
||||||
|
await requireAncestor(
|
||||||
|
git,
|
||||||
|
applicationSha,
|
||||||
|
snapshot,
|
||||||
|
"Candidate is outside the selected checkpoint ancestry",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const missingNotes =
|
||||||
|
phase === "publish" || stage === "candidate"
|
||||||
|
? await validateCandidate(git, snapshot, expectedVersion, commits)
|
||||||
|
: [];
|
||||||
|
return {
|
||||||
|
expectedVersion,
|
||||||
|
baselineVersion,
|
||||||
|
baselineSha,
|
||||||
|
sourceSha,
|
||||||
|
applicationSha,
|
||||||
|
commits,
|
||||||
|
missingNotes,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
import { execFile } from "node:child_process";
|
||||||
|
import { parseArgs, promisify } from "node:util";
|
||||||
|
import { inspectReleaseCheckpoint } from "./lib/release-checkpoint.mjs";
|
||||||
|
|
||||||
|
const execFileAsync = promisify(execFile);
|
||||||
|
|
||||||
|
async function git(args) {
|
||||||
|
const result = await execFileAsync("git", args, {
|
||||||
|
encoding: "utf8",
|
||||||
|
maxBuffer: 16 * 1024 * 1024,
|
||||||
|
});
|
||||||
|
return result.stdout;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const { values } = parseArgs({
|
||||||
|
options: {
|
||||||
|
phase: { type: "string" },
|
||||||
|
stage: { type: "string", default: "source" },
|
||||||
|
"release-branch": { type: "string" },
|
||||||
|
"source-sha": { type: "string" },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const report = await inspectReleaseCheckpoint(git, {
|
||||||
|
phase: values.phase,
|
||||||
|
stage: values.stage,
|
||||||
|
releaseBranch: values["release-branch"],
|
||||||
|
sourceSha: values["source-sha"],
|
||||||
|
});
|
||||||
|
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
||||||
|
if (report.missingNotes.length > 0) {
|
||||||
|
process.stderr.write(
|
||||||
|
`Review ${report.missingNotes.length} additional unreleased mainline entries missing from these release notes; see the ancestry report above.\n`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await main().catch((error) => {
|
||||||
|
process.stderr.write(
|
||||||
|
`Release checkpoint validation failed: ${error instanceof Error ? error.message : String(error)}\n`,
|
||||||
|
);
|
||||||
|
process.exitCode = 1;
|
||||||
|
});
|
||||||
+2
-2
@@ -8,13 +8,13 @@
|
|||||||
"url": "https://github.com/morluto/rea",
|
"url": "https://github.com/morluto/rea",
|
||||||
"source": "github"
|
"source": "github"
|
||||||
},
|
},
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"registryType": "npm",
|
"registryType": "npm",
|
||||||
"registryBaseUrl": "https://registry.npmjs.org",
|
"registryBaseUrl": "https://registry.npmjs.org",
|
||||||
"identifier": "rea-agents",
|
"identifier": "rea-agents",
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
"runtimeHint": "npx",
|
"runtimeHint": "npx",
|
||||||
"transport": {
|
"transport": {
|
||||||
"type": "stdio"
|
"type": "stdio"
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
import { TOOL_CONTRACTS, toolContract } from "./toolContracts.js";
|
||||||
|
import {
|
||||||
|
toolInputSchemaWithMetadata,
|
||||||
|
toolOutputSchemaWithMetadata,
|
||||||
|
} from "./toolSchemaMetadata.js";
|
||||||
|
|
||||||
|
const target = "draft-2020-12";
|
||||||
|
|
||||||
|
describe("advertised tool JSON Schema", () => {
|
||||||
|
it("projects each canonical contract once per target", () => {
|
||||||
|
for (const contract of TOOL_CONTRACTS) {
|
||||||
|
const input = toolInputSchemaWithMetadata(contract)["~standard"];
|
||||||
|
const output = toolOutputSchemaWithMetadata(contract)["~standard"];
|
||||||
|
const advertisedInput = input.jsonSchema.input({ target });
|
||||||
|
const advertisedOutput = output.jsonSchema.output({ target });
|
||||||
|
|
||||||
|
expect(input.jsonSchema.input({ target }), contract.name).toBe(
|
||||||
|
advertisedInput,
|
||||||
|
);
|
||||||
|
expect(output.jsonSchema.output({ target }), contract.name).toBe(
|
||||||
|
advertisedOutput,
|
||||||
|
);
|
||||||
|
expect(advertisedInput.examples, contract.name).toEqual(
|
||||||
|
contract.examples.map(({ input: example }) => example),
|
||||||
|
);
|
||||||
|
expect(advertisedOutput, contract.name).toEqual(
|
||||||
|
contract.outputSchema["~standard"].jsonSchema.output({ target }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("keeps other targets and library options distinct", () => {
|
||||||
|
const contract = toolContract("open_binary");
|
||||||
|
const input = toolInputSchemaWithMetadata(contract)["~standard"];
|
||||||
|
const latest = input.jsonSchema.input({ target });
|
||||||
|
const draft07 = input.jsonSchema.input({ target: "draft-07" });
|
||||||
|
const libraryOptions = { unrepresentable: "any" };
|
||||||
|
const configured = input.jsonSchema.input({ target, libraryOptions });
|
||||||
|
|
||||||
|
expect(latest.$schema).toBe("https://json-schema.org/draft/2020-12/schema");
|
||||||
|
expect(draft07.$schema).toBe("http://json-schema.org/draft-07/schema#");
|
||||||
|
expect(input.jsonSchema.input({ target: "draft-07" })).toBe(draft07);
|
||||||
|
expect(configured).not.toBe(latest);
|
||||||
|
expect(input.jsonSchema.input({ target, libraryOptions })).not.toBe(
|
||||||
|
configured,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
toolInputSchemaWithMetadata(contract).safeParse(
|
||||||
|
contract.examples[0]?.input,
|
||||||
|
).success,
|
||||||
|
).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -47,37 +47,72 @@ const PROPERTY_DESCRIPTIONS: Readonly<Record<string, string>> = {
|
|||||||
unknown_id: "Exact residual-unknown identifier.",
|
unknown_id: "Exact residual-unknown identifier.",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type JsonSchemaProjection = z.ZodType["~standard"]["jsonSchema"]["input"];
|
||||||
|
|
||||||
/** Attach caller guidance to a canonical schema for the SDK wire projection. */
|
/** Attach caller guidance to a canonical schema for the SDK wire projection. */
|
||||||
export const toolInputSchemaWithMetadata = <Contract extends ToolContract>(
|
export const toolInputSchemaWithMetadata = <Contract extends ToolContract>(
|
||||||
contract: Contract,
|
contract: Contract,
|
||||||
): Contract["inputSchema"] => {
|
): Contract["inputSchema"] =>
|
||||||
const schema = contract.inputSchema.meta(
|
withAdvertisedJsonSchema(
|
||||||
z.globalRegistry.get(contract.inputSchema) ?? {},
|
contract.inputSchema,
|
||||||
|
"input",
|
||||||
|
(project) => (options) => ({
|
||||||
|
...describeProperties(project(options)),
|
||||||
|
examples: contract.examples.map(({ input }) => input),
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
const standard = schema["~standard"];
|
|
||||||
const inputJsonSchema = standard.jsonSchema?.input;
|
|
||||||
if (inputJsonSchema === undefined)
|
|
||||||
throw new TypeError(
|
|
||||||
"Tool input schema does not expose Standard JSON Schema",
|
|
||||||
);
|
|
||||||
|
|
||||||
|
/** Advertise a canonical output schema without reconverting it per listing. */
|
||||||
|
export const toolOutputSchemaWithMetadata = <Contract extends ToolContract>(
|
||||||
|
contract: Contract,
|
||||||
|
): Contract["outputSchema"] =>
|
||||||
|
withAdvertisedJsonSchema(contract.outputSchema, "output");
|
||||||
|
|
||||||
|
const withAdvertisedJsonSchema = <Schema extends z.ZodType>(
|
||||||
|
canonical: Schema,
|
||||||
|
io: "input" | "output",
|
||||||
|
advertise: (project: JsonSchemaProjection) => JsonSchemaProjection = (
|
||||||
|
project,
|
||||||
|
) => project,
|
||||||
|
): Schema => {
|
||||||
// Zod's input projection drops root metadata when a descendant transforms.
|
// Zod's input projection drops root metadata when a descendant transforms.
|
||||||
// Preserve the parser and let the SDK own conversion of everything else.
|
// Preserve the parser and let the SDK own conversion of everything else.
|
||||||
|
const schema = canonical.meta(z.globalRegistry.get(canonical) ?? {});
|
||||||
|
const standard = schema["~standard"];
|
||||||
|
const project = standard.jsonSchema?.[io];
|
||||||
|
if (project === undefined)
|
||||||
|
throw new TypeError(
|
||||||
|
`Tool ${io} schema does not expose Standard JSON Schema`,
|
||||||
|
);
|
||||||
Object.defineProperty(schema, "~standard", {
|
Object.defineProperty(schema, "~standard", {
|
||||||
value: {
|
value: {
|
||||||
...standard,
|
...standard,
|
||||||
jsonSchema: {
|
jsonSchema: {
|
||||||
...standard.jsonSchema,
|
...standard.jsonSchema,
|
||||||
input: (options: Parameters<typeof inputJsonSchema>[0]) => ({
|
[io]: memoizeByTarget(advertise(project)),
|
||||||
...describeProperties(inputJsonSchema(options)),
|
|
||||||
examples: contract.examples.map(({ input }) => input),
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return schema;
|
return schema;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// The SDK reconverts every registered schema on each `tools/list`, although a
|
||||||
|
// registered contract cannot change. Like the SDK's own memoized output
|
||||||
|
// projection, the advertised value is shared and treated as read-only.
|
||||||
|
const memoizeByTarget = (
|
||||||
|
project: JsonSchemaProjection,
|
||||||
|
): JsonSchemaProjection => {
|
||||||
|
const byTarget = new Map<string, Record<string, unknown>>();
|
||||||
|
return (options) => {
|
||||||
|
if (options.libraryOptions !== undefined) return project(options);
|
||||||
|
const cached = byTarget.get(options.target);
|
||||||
|
if (cached !== undefined) return cached;
|
||||||
|
const projected = project(options);
|
||||||
|
byTarget.set(options.target, projected);
|
||||||
|
return projected;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const describeProperties = (
|
const describeProperties = (
|
||||||
value: Readonly<Record<string, unknown>>,
|
value: Readonly<Record<string, unknown>>,
|
||||||
): Record<string, unknown> =>
|
): Record<string, unknown> =>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/** Generated from package.json and package-lock.json; do not edit. */
|
/** Generated from package.json and package-lock.json; do not edit. */
|
||||||
export const PACKAGE_METADATA = {
|
export const PACKAGE_METADATA = {
|
||||||
name: "rea-agents",
|
name: "rea-agents",
|
||||||
version: "5.0.0", // x-release-please-version
|
version: "6.0.0", // x-release-please-version
|
||||||
serverSdkVersion: "2.3.1",
|
serverSdkVersion: "2.3.1",
|
||||||
clientSdkVersion: "2.3.1",
|
clientSdkVersion: "2.3.1",
|
||||||
coreSdkVersion: "2.3.1",
|
coreSdkVersion: "2.3.1",
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import type { ToolContract } from "../contracts/toolContracts.js";
|
import type { ToolContract } from "../contracts/toolContracts.js";
|
||||||
import { toolInputSchemaWithMetadata } from "../contracts/toolSchemaMetadata.js";
|
import {
|
||||||
|
toolInputSchemaWithMetadata,
|
||||||
|
toolOutputSchemaWithMetadata,
|
||||||
|
} from "../contracts/toolSchemaMetadata.js";
|
||||||
|
|
||||||
/** Project the canonical Zod contracts directly into SDK registration. */
|
/** Project the canonical Zod contracts directly into SDK registration. */
|
||||||
export const toolRegistrationOptions = <Contract extends ToolContract>(
|
export const toolRegistrationOptions = <Contract extends ToolContract>(
|
||||||
@@ -14,6 +17,6 @@ export const toolRegistrationOptions = <Contract extends ToolContract>(
|
|||||||
title: contract.title,
|
title: contract.title,
|
||||||
description: contract.description,
|
description: contract.description,
|
||||||
inputSchema: toolInputSchemaWithMetadata(contract),
|
inputSchema: toolInputSchemaWithMetadata(contract),
|
||||||
outputSchema: contract.outputSchema,
|
outputSchema: toolOutputSchemaWithMetadata(contract),
|
||||||
annotations: contract.annotations,
|
annotations: contract.annotations,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,545 @@
|
|||||||
|
import { execFile } from "node:child_process";
|
||||||
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||||
|
import { join } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { promisify } from "node:util";
|
||||||
|
import { expect, it } from "vitest";
|
||||||
|
import { z } from "zod";
|
||||||
|
import { parse } from "yaml";
|
||||||
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||||
|
|
||||||
|
const execFileAsync = promisify(execFile);
|
||||||
|
const verifier = fileURLToPath(
|
||||||
|
new URL("../../../scripts/verify-release-checkpoint.mjs", import.meta.url),
|
||||||
|
);
|
||||||
|
|
||||||
|
async function git(
|
||||||
|
directory: string,
|
||||||
|
args: string[],
|
||||||
|
date = "2026-01-04T00:00:00Z",
|
||||||
|
) {
|
||||||
|
const result = await execFileAsync(
|
||||||
|
"git",
|
||||||
|
[
|
||||||
|
"-c",
|
||||||
|
"user.name=REA fixture",
|
||||||
|
"-c",
|
||||||
|
"user.email=fixture@example.invalid",
|
||||||
|
"-c",
|
||||||
|
"commit.gpgsign=false",
|
||||||
|
"-c",
|
||||||
|
`core.hooksPath=${join(directory, "no-hooks")}`,
|
||||||
|
...args,
|
||||||
|
],
|
||||||
|
{
|
||||||
|
cwd: directory,
|
||||||
|
env: { ...process.env, GIT_AUTHOR_DATE: date, GIT_COMMITTER_DATE: date },
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return result.stdout.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function metadata(directory: string, version: string, notes: string) {
|
||||||
|
await mkdir(join(directory, "docs"), { recursive: true });
|
||||||
|
await mkdir(join(directory, "src"), { recursive: true });
|
||||||
|
const files = {
|
||||||
|
"package.json": { name: "rea-agents", version },
|
||||||
|
"package-lock.json": { version, packages: { "": { version } } },
|
||||||
|
".release-please-manifest.json": { ".": version },
|
||||||
|
"server.json": {
|
||||||
|
version,
|
||||||
|
packages: [{ identifier: "rea-agents", version }],
|
||||||
|
},
|
||||||
|
"docs/product-catalog.json": { package: { version } },
|
||||||
|
"release-please-config.json": {
|
||||||
|
"changelog-sections": [
|
||||||
|
{ type: "feat", hidden: false },
|
||||||
|
{ type: "fix", hidden: false },
|
||||||
|
{ type: "chore", hidden: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
for (const [name, value] of Object.entries(files)) {
|
||||||
|
await writeFile(join(directory, name), JSON.stringify(value));
|
||||||
|
}
|
||||||
|
await writeFile(
|
||||||
|
join(directory, "src/generatedPackageMetadata.ts"),
|
||||||
|
`export const METADATA = {\n version: "${version}",\n};\n`,
|
||||||
|
);
|
||||||
|
await writeFile(
|
||||||
|
join(directory, "CHANGELOG.md"),
|
||||||
|
`# Changelog\n\n## [${version}]\n\n${notes}\n`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fixture(
|
||||||
|
subject = "fix(contracts)!: require absolute paths (#948)",
|
||||||
|
footer = "",
|
||||||
|
options: { mergePullRequest?: boolean } = {},
|
||||||
|
) {
|
||||||
|
const directory = await createTestTempDirectory("rea-release-ancestry-");
|
||||||
|
await git(directory, ["init", "--initial-branch=main"]);
|
||||||
|
await metadata(directory, "4.0.0", "Initial release");
|
||||||
|
await git(directory, ["add", "."]);
|
||||||
|
await git(directory, ["commit", "-m", "chore: seed"], "2026-01-01T00:00:00Z");
|
||||||
|
await git(directory, ["switch", "-c", "release/5.0.0"]);
|
||||||
|
await metadata(directory, "5.0.0", "Previous release");
|
||||||
|
await git(directory, ["add", "."]);
|
||||||
|
await git(
|
||||||
|
directory,
|
||||||
|
["commit", "-m", "chore: release 5.0.0"],
|
||||||
|
"2026-01-03T00:00:00Z",
|
||||||
|
);
|
||||||
|
const releasedSha = await git(directory, ["rev-parse", "HEAD"]);
|
||||||
|
await git(directory, ["tag", "rea-agents-5.0.0"]);
|
||||||
|
await git(directory, ["switch", "main"]);
|
||||||
|
if (options.mergePullRequest) {
|
||||||
|
await git(directory, ["switch", "-c", "change/contracts"]);
|
||||||
|
}
|
||||||
|
await writeFile(
|
||||||
|
join(directory, "behavior.txt"),
|
||||||
|
"Unreleased mainline behavior\n",
|
||||||
|
);
|
||||||
|
await git(directory, ["add", "."]);
|
||||||
|
await git(
|
||||||
|
directory,
|
||||||
|
["commit", "-m", subject, "-m", footer],
|
||||||
|
"2026-01-02T00:00:00Z",
|
||||||
|
);
|
||||||
|
if (options.mergePullRequest) {
|
||||||
|
await git(directory, ["switch", "main"]);
|
||||||
|
await git(
|
||||||
|
directory,
|
||||||
|
[
|
||||||
|
"merge",
|
||||||
|
"--no-ff",
|
||||||
|
"change/contracts",
|
||||||
|
"-m",
|
||||||
|
"Merge pull request #948 from fixture/absolute-paths",
|
||||||
|
"-m",
|
||||||
|
subject,
|
||||||
|
],
|
||||||
|
"2026-01-02T00:00:00Z",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const changedSha = await git(directory, ["rev-parse", "HEAD"]);
|
||||||
|
await git(directory, [
|
||||||
|
"merge",
|
||||||
|
"--no-ff",
|
||||||
|
"release/5.0.0",
|
||||||
|
"-m",
|
||||||
|
"chore: sync published baseline",
|
||||||
|
]);
|
||||||
|
const sourceSha = await git(directory, ["rev-parse", "HEAD"]);
|
||||||
|
return { directory, sourceSha, changedSha, releasedSha };
|
||||||
|
}
|
||||||
|
|
||||||
|
type Fixture = Awaited<ReturnType<typeof fixture>>;
|
||||||
|
|
||||||
|
async function candidate(
|
||||||
|
f: Fixture,
|
||||||
|
version: string,
|
||||||
|
notes = "### ⚠ BREAKING CHANGES\n\n* MCP callers must use absolute paths; CLI paths remain compatible. See #948.",
|
||||||
|
) {
|
||||||
|
await metadata(f.directory, version, notes);
|
||||||
|
await git(f.directory, ["add", "."]);
|
||||||
|
await git(
|
||||||
|
f.directory,
|
||||||
|
["commit", "-m", `chore: release ${version}`],
|
||||||
|
"2026-01-05T00:00:00Z",
|
||||||
|
);
|
||||||
|
return git(f.directory, ["rev-parse", "HEAD"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function verify(
|
||||||
|
f: Pick<Fixture, "directory" | "sourceSha">,
|
||||||
|
version = "6.0.0",
|
||||||
|
phase = "prepare",
|
||||||
|
stage = "candidate",
|
||||||
|
) {
|
||||||
|
return execFileAsync(
|
||||||
|
process.execPath,
|
||||||
|
[
|
||||||
|
verifier,
|
||||||
|
"--phase",
|
||||||
|
phase,
|
||||||
|
"--stage",
|
||||||
|
stage,
|
||||||
|
"--release-branch",
|
||||||
|
`release/${version}`,
|
||||||
|
"--source-sha",
|
||||||
|
f.sourceSha,
|
||||||
|
],
|
||||||
|
{ cwd: f.directory },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const reportSchema = z.object({
|
||||||
|
expectedVersion: z.string(),
|
||||||
|
baselineVersion: z.string(),
|
||||||
|
applicationSha: z.string(),
|
||||||
|
commits: z.array(
|
||||||
|
z.object({
|
||||||
|
sha: z.string(),
|
||||||
|
subject: z.string(),
|
||||||
|
conventionalTitle: z.string().optional(),
|
||||||
|
breaking: z.boolean(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
missingNotes: z.array(
|
||||||
|
z.object({
|
||||||
|
sha: z.string(),
|
||||||
|
subject: z.string(),
|
||||||
|
conventionalTitle: z.string().optional(),
|
||||||
|
type: z.string().optional(),
|
||||||
|
breaking: z.boolean(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
it("retains an unreleased breaking commit hidden by the side-branch chronological cutoff", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
const walk = (
|
||||||
|
await git(f.directory, ["log", "--format=%H", f.sourceSha])
|
||||||
|
).split("\n");
|
||||||
|
expect(walk.slice(0, walk.indexOf(f.releasedSha))).not.toContain(
|
||||||
|
f.changedSha,
|
||||||
|
);
|
||||||
|
await candidate(f, "6.0.0");
|
||||||
|
const result = await verify(f);
|
||||||
|
const report = reportSchema.parse(JSON.parse(result.stdout));
|
||||||
|
expect(report).toMatchObject({
|
||||||
|
expectedVersion: "6.0.0",
|
||||||
|
baselineVersion: "5.0.0",
|
||||||
|
missingNotes: [],
|
||||||
|
});
|
||||||
|
expect(report.commits).toContainEqual({
|
||||||
|
sha: f.changedSha,
|
||||||
|
subject: "fix(contracts)!: require absolute paths (#948)",
|
||||||
|
breaking: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects a wrong bot version before publication", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
await candidate(f, "5.1.0");
|
||||||
|
await expect(verify(f)).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining(
|
||||||
|
"declares 5.1.0; release branch requires 6.0.0",
|
||||||
|
),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects a requested minor that omits the breaking ancestry", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
await expect(verify(f, "5.1.0", "prepare", "source")).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining("contains unreleased breaking markers"),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects a minor when a GitHub merge commit carries its bang marker in the PR title", async () => {
|
||||||
|
const f = await fixture("fix(contracts)!: require absolute paths", "", {
|
||||||
|
mergePullRequest: true,
|
||||||
|
});
|
||||||
|
await expect(verify(f, "5.1.0", "prepare", "source")).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining("contains unreleased breaking markers"),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
{
|
||||||
|
subject: "fix(contracts)!: require absolute paths",
|
||||||
|
version: "6.0.0",
|
||||||
|
breaking: true,
|
||||||
|
},
|
||||||
|
{ subject: "fix: improve diagnostics", version: "5.0.1", breaking: false },
|
||||||
|
])(
|
||||||
|
"recognizes GitHub merge titles and PR note references for $version",
|
||||||
|
async ({ subject, version, breaking }) => {
|
||||||
|
const f = await fixture(subject, "", { mergePullRequest: true });
|
||||||
|
await candidate(
|
||||||
|
f,
|
||||||
|
version,
|
||||||
|
`${breaking ? "### ⚠ BREAKING CHANGES" : "### Bug Fixes"}\n\nSee #948 for the change and migration.`,
|
||||||
|
);
|
||||||
|
const report = reportSchema.parse(
|
||||||
|
JSON.parse((await verify(f, version)).stdout),
|
||||||
|
);
|
||||||
|
expect(report.missingNotes).toEqual([]);
|
||||||
|
expect(report.commits).toContainEqual({
|
||||||
|
sha: f.changedSha,
|
||||||
|
subject: "Merge pull request #948 from fixture/absolute-paths",
|
||||||
|
conventionalTitle: subject,
|
||||||
|
breaking,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
it("does not treat an ordinary body example as a merge title or breaking declaration", async () => {
|
||||||
|
const f = await fixture(
|
||||||
|
"fix: improve diagnostics",
|
||||||
|
"Example subject:\n\nfix(contracts)!: example only",
|
||||||
|
);
|
||||||
|
await candidate(f, "5.0.1", `### Bug Fixes\n\n${f.changedSha}`);
|
||||||
|
await expect(verify(f, "5.0.1")).resolves.toMatchObject({ stderr: "" });
|
||||||
|
});
|
||||||
|
|
||||||
|
it("cannot satisfy migration references with notes retained from an older release", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
await candidate(
|
||||||
|
f,
|
||||||
|
"6.0.0",
|
||||||
|
"### Features\n\nNew tool\n\n## [5.0.0]\n\n### ⚠ BREAKING CHANGES\n\nSee #948.",
|
||||||
|
);
|
||||||
|
await expect(verify(f)).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining(
|
||||||
|
"migration notes omit unreleased breaking changes",
|
||||||
|
),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("recognizes a BREAKING CHANGE footer without a bang in the subject", async () => {
|
||||||
|
const f = await fixture(
|
||||||
|
"fix(contracts): change path inputs (#948)",
|
||||||
|
"BREAKING CHANGE: relative MCP paths are rejected",
|
||||||
|
);
|
||||||
|
await expect(verify(f, "5.1.0", "prepare", "source")).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining("contains unreleased breaking markers"),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
{ subject: "fix: correct supported output", version: "5.0.1" },
|
||||||
|
{ subject: "feat: add an optional inspection", version: "5.1.0" },
|
||||||
|
])(
|
||||||
|
"accepts compatible $version without a major increment",
|
||||||
|
async ({ subject, version }) => {
|
||||||
|
const f = await fixture(subject);
|
||||||
|
await candidate(f, version, `### Changes\n\n${f.changedSha} ${subject}`);
|
||||||
|
const report = reportSchema.parse(
|
||||||
|
JSON.parse((await verify(f, version)).stdout),
|
||||||
|
);
|
||||||
|
expect(report.expectedVersion).toBe(version);
|
||||||
|
expect(report.commits.every((entry) => !entry.breaking)).toBe(true);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
it("accepts an exact prerelease version", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
await candidate(f, "6.0.0-rc.1");
|
||||||
|
await expect(verify(f, "6.0.0-rc.1")).resolves.toMatchObject({ stderr: "" });
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each(["6.01.0", "6.0", "not-a-version", "6.0.0+build"])(
|
||||||
|
"rejects invalid release version %s",
|
||||||
|
async (version) => {
|
||||||
|
const directory = await createTestTempDirectory(
|
||||||
|
"rea-release-invalid-version-",
|
||||||
|
);
|
||||||
|
await expect(
|
||||||
|
verify(
|
||||||
|
{ directory, sourceSha: "1".repeat(40) },
|
||||||
|
version,
|
||||||
|
"prepare",
|
||||||
|
"source",
|
||||||
|
),
|
||||||
|
).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining("must contain an exact SemVer"),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
it("validates candidate options before inspecting the working directory", async () => {
|
||||||
|
const directory = await createTestTempDirectory(
|
||||||
|
"rea-release-invalid-candidate-",
|
||||||
|
);
|
||||||
|
await git(directory, ["init", "--initial-branch=main"]);
|
||||||
|
await expect(
|
||||||
|
verify({ directory, sourceSha: "1".repeat(40) }, "not-a-version"),
|
||||||
|
).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining("must contain an exact SemVer"),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
"package-lock.json",
|
||||||
|
"server.json",
|
||||||
|
"docs/product-catalog.json",
|
||||||
|
"src/generatedPackageMetadata.ts",
|
||||||
|
])("rejects inconsistent version metadata in %s", async (path) => {
|
||||||
|
const f = await fixture();
|
||||||
|
await candidate(f, "6.0.0");
|
||||||
|
await writeFile(
|
||||||
|
join(f.directory, path),
|
||||||
|
path.endsWith(".ts")
|
||||||
|
? 'export const METADATA = {\n version: "5.1.0",\n};\n'
|
||||||
|
: JSON.stringify(
|
||||||
|
path === "package-lock.json"
|
||||||
|
? { version: "6.0.0", packages: { "": { version: "5.1.0" } } }
|
||||||
|
: path === "server.json"
|
||||||
|
? {
|
||||||
|
version: "6.0.0",
|
||||||
|
packages: [{ identifier: "rea-agents", version: "5.1.0" }],
|
||||||
|
}
|
||||||
|
: { package: { version: "5.1.0" } },
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await git(f.directory, ["add", "."]);
|
||||||
|
await git(f.directory, ["commit", "-m", "chore: inconsistent metadata"]);
|
||||||
|
await expect(verify(f)).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining(
|
||||||
|
"declares 5.1.0; release branch requires 6.0.0",
|
||||||
|
),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("checks a publish merge using its pre-release first parent baseline", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
const sourceSha = await candidate(f, "6.0.0");
|
||||||
|
const report = reportSchema.parse(
|
||||||
|
JSON.parse(
|
||||||
|
(await verify({ ...f, sourceSha }, "6.0.0", "publish", "source")).stdout,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
expect(report.applicationSha).toBe(f.sourceSha);
|
||||||
|
expect(report.baselineVersion).toBe("5.0.0");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("reports other omitted entries for review without inventing a breaking change", async () => {
|
||||||
|
const f = await fixture("fix: improve diagnostics");
|
||||||
|
await candidate(f, "5.0.1", "### Bug Fixes\n\nUpdated diagnostics");
|
||||||
|
const result = await verify(f, "5.0.1");
|
||||||
|
expect(reportSchema.parse(JSON.parse(result.stdout)).missingNotes).toEqual([
|
||||||
|
{
|
||||||
|
sha: f.changedSha,
|
||||||
|
subject: "fix: improve diagnostics",
|
||||||
|
type: "fix",
|
||||||
|
breaking: false,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
expect(result.stderr).toContain("additional unreleased mainline entries");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("reports a missing published tag with recovery advice", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
await git(f.directory, ["tag", "-d", "rea-agents-5.0.0"]);
|
||||||
|
await expect(verify(f, "6.0.0", "prepare", "source")).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining("Fetch release tags"),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects a published baseline outside the selected ancestry", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
const next = await candidate(f, "6.0.0");
|
||||||
|
await git(f.directory, ["tag", "-f", "rea-agents-5.0.0", next]);
|
||||||
|
await expect(verify(f, "6.0.0", "prepare", "source")).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining(
|
||||||
|
"Published baseline is outside the checkpoint ancestry",
|
||||||
|
),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("reports malformed candidate JSON with the exact metadata path", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
await candidate(f, "6.0.0");
|
||||||
|
await writeFile(join(f.directory, "server.json"), "{");
|
||||||
|
await git(f.directory, ["add", "."]);
|
||||||
|
await git(f.directory, ["commit", "-m", "chore: invalid metadata"]);
|
||||||
|
await expect(verify(f)).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringMatching(/server\.json@.*contains invalid JSON/u),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects a candidate from a different source even when versions and notes match", async () => {
|
||||||
|
const f = await fixture();
|
||||||
|
await git(f.directory, ["switch", "release/5.0.0"]);
|
||||||
|
await candidate(f, "6.0.0");
|
||||||
|
await expect(verify(f)).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining(
|
||||||
|
"Candidate is outside the selected checkpoint ancestry",
|
||||||
|
),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.skipIf(process.platform === "win32").each([true, false])(
|
||||||
|
"the actual publish preflight admits the next action only for valid metadata (%s)",
|
||||||
|
async (valid) => {
|
||||||
|
const f = await fixture();
|
||||||
|
const sourceSha = await candidate(f, valid ? "6.0.0" : "5.1.0");
|
||||||
|
const workflow = z
|
||||||
|
.object({
|
||||||
|
jobs: z.object({
|
||||||
|
"release-please": z.object({
|
||||||
|
steps: z.array(
|
||||||
|
z.object({
|
||||||
|
name: z.string().optional(),
|
||||||
|
run: z.string().optional(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
.parse(
|
||||||
|
parse(
|
||||||
|
await readFile(
|
||||||
|
new URL("../../../.github/workflows/release.yml", import.meta.url),
|
||||||
|
"utf8",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
const command = z
|
||||||
|
.string()
|
||||||
|
.parse(
|
||||||
|
workflow.jobs["release-please"].steps.find(
|
||||||
|
(step) =>
|
||||||
|
step.name ===
|
||||||
|
"Validate checkpoint version and ancestry before release creation",
|
||||||
|
)?.run,
|
||||||
|
);
|
||||||
|
const marker = join(f.directory, "next-release-action");
|
||||||
|
const execution = execFileAsync(
|
||||||
|
"bash",
|
||||||
|
[
|
||||||
|
"-e",
|
||||||
|
"-o",
|
||||||
|
"pipefail",
|
||||||
|
"-c",
|
||||||
|
`${command}\ntouch "$NEXT_RELEASE_ACTION_MARKER"`,
|
||||||
|
],
|
||||||
|
{
|
||||||
|
cwd: fileURLToPath(new URL("../../../", import.meta.url)),
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
GIT_DIR: join(f.directory, ".git"),
|
||||||
|
GIT_WORK_TREE: f.directory,
|
||||||
|
RELEASE_PHASE: "publish",
|
||||||
|
RELEASE_BRANCH: "release/6.0.0",
|
||||||
|
SOURCE_SHA: sourceSha,
|
||||||
|
NEXT_RELEASE_ACTION_MARKER: marker,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (valid) {
|
||||||
|
await expect(execution).resolves.toMatchObject({ stderr: "" });
|
||||||
|
expect(await readFile(marker, "utf8")).toBe("");
|
||||||
|
} else {
|
||||||
|
await expect(execution).rejects.toMatchObject({
|
||||||
|
code: 1,
|
||||||
|
stderr: expect.stringContaining("release branch requires 6.0.0"),
|
||||||
|
});
|
||||||
|
await expect(readFile(marker)).rejects.toMatchObject({ code: "ENOENT" });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
@@ -43,6 +43,43 @@ async function readReleaseWorkflow() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it("validates the source before release creation and the prepared candidate before generation", async () => {
|
||||||
|
const steps = (await readReleaseWorkflow()).jobs["release-please"].steps;
|
||||||
|
const source = steps.findIndex(
|
||||||
|
(step) =>
|
||||||
|
step.name ===
|
||||||
|
"Validate checkpoint version and ancestry before release creation",
|
||||||
|
);
|
||||||
|
const action = steps.findIndex((step) =>
|
||||||
|
step.uses?.startsWith("googleapis/release-please-action@"),
|
||||||
|
);
|
||||||
|
const candidate = steps.findIndex(
|
||||||
|
(step) =>
|
||||||
|
step.name === "Validate prepared release version and migration notes",
|
||||||
|
);
|
||||||
|
const generation = steps.findIndex(
|
||||||
|
(step) => step.name === "Regenerate release documentation",
|
||||||
|
);
|
||||||
|
expect(source).toBeGreaterThanOrEqual(0);
|
||||||
|
expect(source).toBeLessThan(action);
|
||||||
|
expect(steps[source]?.if).toBeUndefined();
|
||||||
|
expect(steps[source]?.run).toContain("--source-sha");
|
||||||
|
expect(candidate).toBeGreaterThan(action);
|
||||||
|
expect(candidate).toBeLessThan(generation);
|
||||||
|
expect(steps[candidate]?.if).toBe(
|
||||||
|
"inputs.phase == 'prepare' && steps.release.outputs.prs_created == 'true'",
|
||||||
|
);
|
||||||
|
expect(steps[candidate]?.run).toContain("--stage candidate");
|
||||||
|
for (const name of [
|
||||||
|
"Check out release controller and Git history",
|
||||||
|
"Check out release pull request",
|
||||||
|
]) {
|
||||||
|
expect(
|
||||||
|
steps.find((step) => step.name === name)?.with?.["fetch-depth"],
|
||||||
|
).toBe(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
it("requires explicit release preparation or publication instead of main pushes", async () => {
|
it("requires explicit release preparation or publication instead of main pushes", async () => {
|
||||||
const workflow = await readReleaseWorkflow();
|
const workflow = await readReleaseWorkflow();
|
||||||
expect(Object.keys(workflow.on)).toEqual(["workflow_dispatch"]);
|
expect(Object.keys(workflow.on)).toEqual(["workflow_dispatch"]);
|
||||||
@@ -90,6 +127,13 @@ it.skipIf(process.platform === "win32").each([
|
|||||||
expect(actionIndex).toBeGreaterThanOrEqual(0);
|
expect(actionIndex).toBeGreaterThanOrEqual(0);
|
||||||
const commands = steps
|
const commands = steps
|
||||||
.slice(0, actionIndex)
|
.slice(0, actionIndex)
|
||||||
|
.filter((step) =>
|
||||||
|
[
|
||||||
|
"Validate release selection",
|
||||||
|
"Resolve release branch tip",
|
||||||
|
"Require the publish dispatch to match the branch tip",
|
||||||
|
].includes(step.name ?? ""),
|
||||||
|
)
|
||||||
.filter(
|
.filter(
|
||||||
(step) =>
|
(step) =>
|
||||||
step.if === undefined ||
|
step.if === undefined ||
|
||||||
|
|||||||
Reference in New Issue
Block a user