@mastra/factory 0.16.0-alpha.9 → 0.16.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/README.md +37 -0
  2. package/dist/auth.js +1 -1
  3. package/dist/auth.js.map +1 -1
  4. package/dist/boards/review.d.ts.map +1 -1
  5. package/dist/boards/review.js +19 -8
  6. package/dist/boards/review.js.map +1 -1
  7. package/dist/boards/work.d.ts.map +1 -1
  8. package/dist/boards/work.js +31 -3
  9. package/dist/boards/work.js.map +1 -1
  10. package/dist/capabilities/intake.d.ts +4 -0
  11. package/dist/capabilities/intake.d.ts.map +1 -1
  12. package/dist/capabilities/version-control.d.ts +15 -0
  13. package/dist/capabilities/version-control.d.ts.map +1 -1
  14. package/dist/factory.d.ts +7 -7
  15. package/dist/factory.d.ts.map +1 -1
  16. package/dist/factory.js +100 -40
  17. package/dist/factory.js.map +1 -1
  18. package/dist/integrations/base.d.ts +3 -0
  19. package/dist/integrations/base.d.ts.map +1 -1
  20. package/dist/integrations/github/integration.d.ts.map +1 -1
  21. package/dist/integrations/github/integration.js +21 -0
  22. package/dist/integrations/github/integration.js.map +1 -1
  23. package/dist/integrations/github/routes.js +2 -1
  24. package/dist/integrations/github/routes.js.map +1 -1
  25. package/dist/integrations/github/sandbox.d.ts +41 -42
  26. package/dist/integrations/github/sandbox.d.ts.map +1 -1
  27. package/dist/integrations/github/sandbox.js +416 -227
  28. package/dist/integrations/github/sandbox.js.map +1 -1
  29. package/dist/integrations/github/webhook.d.ts +2 -5
  30. package/dist/integrations/github/webhook.d.ts.map +1 -1
  31. package/dist/integrations/github/webhook.js +8 -48
  32. package/dist/integrations/github/webhook.js.map +1 -1
  33. package/dist/integrations/gitlab/agent-tools.d.ts +14 -0
  34. package/dist/integrations/gitlab/agent-tools.d.ts.map +1 -0
  35. package/dist/integrations/gitlab/agent-tools.js +42 -0
  36. package/dist/integrations/gitlab/agent-tools.js.map +1 -0
  37. package/dist/integrations/gitlab/api.d.ts +222 -0
  38. package/dist/integrations/gitlab/api.d.ts.map +1 -0
  39. package/dist/integrations/gitlab/api.js +274 -0
  40. package/dist/integrations/gitlab/api.js.map +1 -0
  41. package/dist/integrations/gitlab/default-rules.d.ts +125 -0
  42. package/dist/integrations/gitlab/default-rules.d.ts.map +1 -0
  43. package/dist/integrations/gitlab/default-rules.js +172 -0
  44. package/dist/integrations/gitlab/default-rules.js.map +1 -0
  45. package/dist/integrations/gitlab/integration.d.ts +138 -0
  46. package/dist/integrations/gitlab/integration.d.ts.map +1 -0
  47. package/dist/integrations/gitlab/integration.js +705 -0
  48. package/dist/integrations/gitlab/integration.js.map +1 -0
  49. package/dist/integrations/gitlab/issue-reconciler.d.ts +6 -0
  50. package/dist/integrations/gitlab/issue-reconciler.d.ts.map +1 -0
  51. package/dist/integrations/gitlab/issue-reconciler.js +123 -0
  52. package/dist/integrations/gitlab/issue-reconciler.js.map +1 -0
  53. package/dist/integrations/gitlab/merge-request-reconciler.d.ts +6 -0
  54. package/dist/integrations/gitlab/merge-request-reconciler.d.ts.map +1 -0
  55. package/dist/integrations/gitlab/merge-request-reconciler.js +267 -0
  56. package/dist/integrations/gitlab/merge-request-reconciler.js.map +1 -0
  57. package/dist/integrations/gitlab/reconciler.d.ts +5 -0
  58. package/dist/integrations/gitlab/reconciler.d.ts.map +1 -0
  59. package/dist/integrations/gitlab/reconciler.js +31 -0
  60. package/dist/integrations/gitlab/reconciler.js.map +1 -0
  61. package/dist/integrations/gitlab/reconciliation-config.d.ts +3 -0
  62. package/dist/integrations/gitlab/reconciliation-config.d.ts.map +1 -0
  63. package/dist/integrations/gitlab/reconciliation-config.js +17 -0
  64. package/dist/integrations/gitlab/reconciliation-config.js.map +1 -0
  65. package/dist/integrations/gitlab/routes.d.ts +20 -0
  66. package/dist/integrations/gitlab/routes.d.ts.map +1 -0
  67. package/dist/integrations/gitlab/routes.js +473 -0
  68. package/dist/integrations/gitlab/routes.js.map +1 -0
  69. package/dist/integrations/gitlab/rules.d.ts +35 -0
  70. package/dist/integrations/gitlab/rules.d.ts.map +1 -0
  71. package/dist/integrations/gitlab/rules.js +391 -0
  72. package/dist/integrations/gitlab/rules.js.map +1 -0
  73. package/dist/integrations/gitlab/session-subscriptions.d.ts +32 -0
  74. package/dist/integrations/gitlab/session-subscriptions.d.ts.map +1 -0
  75. package/dist/integrations/gitlab/session-subscriptions.js +192 -0
  76. package/dist/integrations/gitlab/session-subscriptions.js.map +1 -0
  77. package/dist/integrations/gitlab/subscriptions.d.ts +70 -0
  78. package/dist/integrations/gitlab/subscriptions.d.ts.map +1 -0
  79. package/dist/integrations/gitlab/subscriptions.js +76 -0
  80. package/dist/integrations/gitlab/subscriptions.js.map +1 -0
  81. package/dist/integrations/gitlab/version-control.d.ts +16 -0
  82. package/dist/integrations/gitlab/version-control.d.ts.map +1 -0
  83. package/dist/integrations/gitlab/version-control.js +622 -0
  84. package/dist/integrations/gitlab/version-control.js.map +1 -0
  85. package/dist/integrations/gitlab/webhook-dispatch.d.ts +75 -0
  86. package/dist/integrations/gitlab/webhook-dispatch.d.ts.map +1 -0
  87. package/dist/integrations/gitlab/webhook-dispatch.js +235 -0
  88. package/dist/integrations/gitlab/webhook-dispatch.js.map +1 -0
  89. package/dist/integrations/gitlab/webhook.d.ts +72 -0
  90. package/dist/integrations/gitlab/webhook.d.ts.map +1 -0
  91. package/dist/integrations/gitlab/webhook.js +201 -0
  92. package/dist/integrations/gitlab/webhook.js.map +1 -0
  93. package/dist/integrations/incidentio/integration.js +1 -1
  94. package/dist/integrations/issue-reconciler.d.ts +3 -3
  95. package/dist/integrations/issue-reconciler.d.ts.map +1 -1
  96. package/dist/integrations/issue-reconciler.js +22 -2
  97. package/dist/integrations/issue-reconciler.js.map +1 -1
  98. package/dist/integrations/platform/github/integration.d.ts.map +1 -1
  99. package/dist/integrations/platform/github/integration.js +21 -0
  100. package/dist/integrations/platform/github/integration.js.map +1 -1
  101. package/dist/integrations/platform/gitlab/event-worker.d.ts +64 -0
  102. package/dist/integrations/platform/gitlab/event-worker.d.ts.map +1 -0
  103. package/dist/integrations/platform/gitlab/event-worker.js +306 -0
  104. package/dist/integrations/platform/gitlab/event-worker.js.map +1 -0
  105. package/dist/integrations/platform/gitlab/integration.d.ts +57 -0
  106. package/dist/integrations/platform/gitlab/integration.d.ts.map +1 -0
  107. package/dist/integrations/platform/gitlab/integration.js +125 -0
  108. package/dist/integrations/platform/gitlab/integration.js.map +1 -0
  109. package/dist/integrations/platform/incidentio/integration.js +1 -1
  110. package/dist/integrations/slack/integration.d.ts.map +1 -1
  111. package/dist/integrations/slack/integration.js +3 -3
  112. package/dist/integrations/slack/integration.js.map +1 -1
  113. package/dist/integrations/slack/slack.d.ts +2 -0
  114. package/dist/integrations/slack/slack.d.ts.map +1 -1
  115. package/dist/integrations/slack/slack.js +21 -7
  116. package/dist/integrations/slack/slack.js.map +1 -1
  117. package/dist/integrations/subscription-session.d.ts +37 -0
  118. package/dist/integrations/subscription-session.d.ts.map +1 -0
  119. package/dist/integrations/subscription-session.js +83 -0
  120. package/dist/integrations/subscription-session.js.map +1 -0
  121. package/dist/packages/_internals/workspace/dist/index.js +1 -11
  122. package/dist/packages/_internals/workspace/dist/index.js.map +1 -1
  123. package/dist/routes/intake.d.ts.map +1 -1
  124. package/dist/routes/intake.js +4 -2
  125. package/dist/routes/intake.js.map +1 -1
  126. package/dist/routes/oauth.js +1 -1
  127. package/dist/routes/projects.d.ts +1 -0
  128. package/dist/routes/projects.d.ts.map +1 -1
  129. package/dist/routes/projects.js +1 -0
  130. package/dist/routes/projects.js.map +1 -1
  131. package/dist/routes/source-control-sessions.d.ts +20 -0
  132. package/dist/routes/source-control-sessions.d.ts.map +1 -0
  133. package/dist/routes/source-control-sessions.js +319 -0
  134. package/dist/routes/source-control-sessions.js.map +1 -0
  135. package/dist/routes/source-control-settings.d.ts +10 -0
  136. package/dist/routes/source-control-settings.d.ts.map +1 -0
  137. package/dist/routes/source-control-settings.js +87 -0
  138. package/dist/routes/source-control-settings.js.map +1 -0
  139. package/dist/routes/surface.d.ts +3 -3
  140. package/dist/routes/surface.d.ts.map +1 -1
  141. package/dist/routes/surface.js +55 -13
  142. package/dist/routes/surface.js.map +1 -1
  143. package/dist/routes/tenant-credentials.d.ts +8 -0
  144. package/dist/routes/tenant-credentials.d.ts.map +1 -1
  145. package/dist/routes/tenant-credentials.js +20 -3
  146. package/dist/routes/tenant-credentials.js.map +1 -1
  147. package/dist/routes/work-items.d.ts.map +1 -1
  148. package/dist/routes/work-items.js +1 -1
  149. package/dist/routes/work-items.js.map +1 -1
  150. package/dist/rules/dispatcher.d.ts.map +1 -1
  151. package/dist/rules/dispatcher.js +7 -1
  152. package/dist/rules/dispatcher.js.map +1 -1
  153. package/dist/rules/start-coordinator.d.ts +1 -1
  154. package/dist/rules/start-coordinator.d.ts.map +1 -1
  155. package/dist/rules/start-coordinator.js +3 -2
  156. package/dist/rules/start-coordinator.js.map +1 -1
  157. package/dist/rules/transition-service.d.ts.map +1 -1
  158. package/dist/rules/transition-service.js +6 -3
  159. package/dist/rules/transition-service.js.map +1 -1
  160. package/dist/rules/types.d.ts +67 -3
  161. package/dist/rules/types.d.ts.map +1 -1
  162. package/dist/rules/types.js +23 -2
  163. package/dist/rules/types.js.map +1 -1
  164. package/dist/rules/validation.d.ts.map +1 -1
  165. package/dist/rules/validation.js +2 -0
  166. package/dist/rules/validation.js.map +1 -1
  167. package/dist/sandbox/git-ref.d.ts +7 -0
  168. package/dist/sandbox/git-ref.d.ts.map +1 -0
  169. package/dist/sandbox/git-ref.js +15 -0
  170. package/dist/sandbox/git-ref.js.map +1 -0
  171. package/dist/sandbox/session-retirement.js +1 -1
  172. package/dist/sandbox/workdir.d.ts.map +1 -1
  173. package/dist/sandbox/workdir.js +6 -6
  174. package/dist/sandbox/workdir.js.map +1 -1
  175. package/dist/session/factory-session.d.ts +31 -1
  176. package/dist/session/factory-session.d.ts.map +1 -1
  177. package/dist/session/factory-session.js +60 -1
  178. package/dist/session/factory-session.js.map +1 -1
  179. package/dist/session/source-control-tools.d.ts +16 -0
  180. package/dist/session/source-control-tools.d.ts.map +1 -0
  181. package/dist/session/source-control-tools.js +472 -0
  182. package/dist/session/source-control-tools.js.map +1 -0
  183. package/dist/storage/domains/intake/base.d.ts +18 -0
  184. package/dist/storage/domains/intake/base.d.ts.map +1 -1
  185. package/dist/storage/domains/intake/base.js +77 -0
  186. package/dist/storage/domains/intake/base.js.map +1 -1
  187. package/dist/work-item-branch.d.ts +3 -1
  188. package/dist/work-item-branch.d.ts.map +1 -1
  189. package/dist/work-item-branch.js +22 -4
  190. package/dist/work-item-branch.js.map +1 -1
  191. package/dist/workspace.d.ts +15 -1
  192. package/dist/workspace.d.ts.map +1 -1
  193. package/dist/workspace.js +57 -23
  194. package/dist/workspace.js.map +1 -1
  195. package/factory-skills/factory-gitlab-rereview/SKILL.md +19 -0
  196. package/factory-skills/factory-gitlab-review/SKILL.md +30 -0
  197. package/factory-skills/factory-rereview/SKILL.md +13 -6
  198. package/factory-skills/factory-review/SKILL.md +13 -6
  199. package/factory-skills/factory-review/references/archaeology.md +225 -0
  200. package/factory-skills/factory-review/references/categories/README.md +34 -0
  201. package/factory-skills/factory-review/references/categories/behavior-change.md +36 -0
  202. package/factory-skills/factory-review/references/categories/bug-fix.md +37 -0
  203. package/factory-skills/factory-review/references/categories/docs.md +32 -0
  204. package/factory-skills/factory-review/references/categories/experimental-flagged.md +34 -0
  205. package/factory-skills/factory-review/references/categories/infra-tooling.md +37 -0
  206. package/factory-skills/factory-review/references/categories/internal-capability.md +35 -0
  207. package/factory-skills/factory-review/references/categories/large-cross-cutting.md +35 -0
  208. package/factory-skills/factory-review/references/categories/mechanical.md +36 -0
  209. package/factory-skills/factory-review/references/categories/performance.md +33 -0
  210. package/factory-skills/factory-review/references/categories/public-api.md +38 -0
  211. package/factory-skills/factory-review/references/categories/refactor.md +35 -0
  212. package/factory-skills/factory-review/references/categories/revert.md +31 -0
  213. package/factory-skills/factory-review/references/categories/schema-storage.md +39 -0
  214. package/factory-skills/factory-review/references/categories/security.md +35 -0
  215. package/factory-skills/factory-review/references/categories/tests-only.md +38 -0
  216. package/package.json +9 -9
@@ -0,0 +1,38 @@
1
+ # New public API
2
+
3
+ **Reviewing:** the interface. The implementation can be fixed in a follow-up; the API can't be renamed once it ships.
4
+ **Read first:** the signature, then a call site you write by hand — before any implementation.
5
+ **Done means:** consistent with its three closest neighbors; extensible without breaking; documented; doesn't already exist under another name; you'd be happy to see the call site in someone's codebase forever.
6
+ **Trap:** reviewing the implementation carefully and the signature not at all.
7
+ **Attention:** 80% interface, 20% implementation.
8
+
9
+ ## Questions
10
+
11
+ - **Line it up against three neighbors.** Pull the signatures of the three most similar public APIs. Compare: argument shape (positional vs options object), naming (`get`/`fetch`/`load`, `id` vs `Id`), return shape (value vs result object vs stream), error behavior (throws vs returns vs Result type), async-ness, how optional things are expressed. Any divergence needs a reason.
12
+ - **How will it be _called_, not how is it defined?** Write the call site. Does it read like the other call sites in a user's code? Would it look out of place in the docs next to its siblings?
13
+ - **The version-two problem.** Every public API gets extended. Can this one be extended without breaking? A positional boolean can't; an options object can. This is where "correct today, painful forever" gets caught.
14
+ - **Does it already exist under another name?** Search the public surface for the same capability. Duplicate APIs are the most expensive mistake because they're permanent.
15
+ - **Exports and types.** Is it exported from the same place its siblings are? Does it leak internal types into the public surface?
16
+ - **Does it use the right internals?** Find the sibling feature and read how _it_ does it. Same primitives, or a reinvented one — a second event bus, a second retry loop, a hand-rolled helper that exists three directories over? Reinvention is the #1 sign of not knowing the internals.
17
+ - **Trace one call end-to-end.** Pick the main entry point and follow it to the bottom. It should pass through the layers everything else passes through (auth, validation, logging, tracing, storage abstraction) rather than around them. A bypass is invisible in the diff because it's the _absence_ of a call.
18
+ - **What should it have hooked into?** Lifecycle hooks, middleware, processors, registries. New capability that doesn't register is invisible to observability, plugins, cleanup.
19
+ - **Docs and changeset.** A public surface change without docs is incomplete. The changeset level must match the contract change (`minor` for new surface; `major` if anything existing changes shape).
20
+ - **Is it over-built?** Options no caller sets, generics for one use, a config surface for a hypothetical. What does each option buy _today_?
21
+ - **Cross-package.** If the API spans packages, what does a consumer on an older version of the other package see?
22
+
23
+ ## Signals → branches
24
+
25
+ - Signature diverges from all three neighbors → ask for the reason; absent one, request alignment with the neighbors
26
+ - Positional boolean or more than two positional args → version-two problem; request an options object
27
+ - Same capability found under another name → request removal of one before merge
28
+ - No call site in tests or docs → write one yourself and run it; if it's awkward to write, that's the finding
29
+ - Bypasses a layer the sibling goes through → request the same routing before merge; ask "which existing code did you model this on?" — a good answer names a file
30
+ - "Extensible" / "flexible" in the description → over-built check
31
+
32
+ ## Verify
33
+
34
+ - **Write the call site and run it.** Tests are the author's claim; running it is your evidence. A scratch script importing from the package's public export, on the PR branch.
35
+ - Compare the signature against the closest public neighbors; record meaningful divergences and why they matter.
36
+ - `grep` the public surface (exports map, `index.ts`, docs) for the capability's nouns and verbs.
37
+ - Confirm export location matches siblings: `grep -n "<name>" packages/*/src/index.ts` and the `exports` map in `package.json`.
38
+ - Changeset present and at the right level: `ls .changeset/` on the branch, read it.
@@ -0,0 +1,35 @@
1
+ # Refactor
2
+
3
+ **Reviewing:** an equivalence proof — behavior before equals behavior after.
4
+ **Read first:** the tests. Assertions should be unchanged and green.
5
+ **Done means:** behavior provably identical; the diff is mechanically checkable; test behavior untouched.
6
+ **Trap:** test assertions changed (then it wasn't a refactor); a behavior change smuggled in. Test-file edits that only follow a rename or move (imports, fixtures, paths) with assertions untouched do not break the equivalence claim.
7
+ **Attention:** 100% implementation. The interface is unchanged by definition — if it isn't, this isn't a refactor.
8
+
9
+ ## Questions
10
+
11
+ - **Did any test change?** If a test changed, either it was testing an implementation detail (fine — but then say that) or the behavior changed (then this is a behavior change wearing a refactor label). Either way, each test change needs a reason.
12
+ - **Is anything deleted?** A removed check, a removed await, a removed branch. Every deletion in a refactor must be shown redundant, not just unused-in-the-happy-path.
13
+ - **Who else calls everything touched?** Grep the callers. Refactors move things; callers that weren't updated are the breakage.
14
+ - **Is the diff mechanically checkable?** Rename + move + extract is checkable. Rename + move + extract + "simplified the logic while I was there" is not. If you can't verify equivalence by reading, the PR is too big or too mixed.
15
+ - **Did the failure modes change?** A refactor that consolidates three try/catches into one may have changed what gets swallowed. Same for default values, ordering of side effects, when things are awaited.
16
+ - **Concurrency / ordering.** Did anything move across an await, out of a lock, or from before an event to after it?
17
+ - **Was the old shape a decision?** Blame the removed structure. If it was shaped that way for a reason (a workaround, a constraint), the refactor needs to show the reason no longer applies.
18
+ - **Is the new abstraction earning its keep?** Refactors introduce abstractions. Same over-built tells: one caller, unused generality.
19
+ - **Does the description match?** "Pure refactor, no behavior change" is a claim. Check it against every hunk that isn't a rename.
20
+
21
+ ## Signals → branches
22
+
23
+ - Any test file in the diff → read each change; classify as implementation-detail or behavior; the latter re-categorizes the PR
24
+ - A conditional, default, or await removed → find the case it handled; show it's still handled
25
+ - "Simplified" / "cleaned up" / "while I was there" in the description → look for the smuggled behavior change in exactly that hunk
26
+ - Diff too large to verify by reading → "should be split" finding; do not approve an equivalence you can't check
27
+ - Blame on the removed structure lands on a PR with a reason → deep history
28
+
29
+ ## Verify
30
+
31
+ - **Tests unchanged**: `git diff <base>...HEAD --stat -- '**/*.test.*' '**/*.spec.*' '**/__tests__/**'` should be empty. If not, every changed test is a question.
32
+ - **Tests green on the branch** with no test changes: run the affected suite.
33
+ - Callers of every moved/renamed symbol: `archaeology.md` → Callers.
34
+ - For anything deleted: `git log -S` on the base to find why it was added.
35
+ - If the refactored path is exercisable (a script, an example), run it on base and branch and diff the output.
@@ -0,0 +1,31 @@
1
+ # Revert
2
+
3
+ **Reviewing:** that it's clean, and that the reason is recorded.
4
+ **Read first:** the `git revert` diff vs. the actual diff — are they the same?
5
+ **Done means:** pure inverse of the original commit(s); the reason for reverting is linked (issue, incident, failing run); anything the original PR fixed is either re-broken knowingly or handled.
6
+ **Trap:** a manual "revert" that isn't one — partial, or with extra changes mixed in.
7
+ **Attention:** the delta between this diff and a true `git revert`. Zero delta means a fast review. Any delta is the entire review.
8
+
9
+ ## Questions
10
+
11
+ - **Is it a true inverse?** Generate `git revert <sha>` in a scratch worktree and diff against the PR. Any difference is a finding — either a hand edit or a conflict resolution that needs to be explained.
12
+ - **Why?** What broke? Is there an issue, an incident, a failing CI run linked? A revert with no stated reason is a behavior change with no stated reason.
13
+ - **What did the original PR fix, and is that now re-broken?** Read the original PR. If it fixed a bug, the revert reintroduces it. Is that acceptable, and is there a plan?
14
+ - **Did anything land on top of the original?** Commits since the original that depend on it. Reverting the base leaves them dangling.
15
+ - **Is this the smallest revert?** Reverting a whole PR when one commit was the problem. Or reverting one commit when the whole PR was.
16
+ - **Changeset.** A revert that undoes a released change needs a changeset; a revert of an unreleased change may need the original changeset removed.
17
+ - **Will it be re-landed?** If so, is there a tracking issue, and does this PR say so?
18
+
19
+ ## Signals → branches
20
+
21
+ - Diff differs from `git revert` output → each difference is a question; conflict resolutions need explanation
22
+ - No reason linked → request the reason before merge; ask what broke
23
+ - Original PR fixed a user-reported bug → the revert reintroduces it; the handoff says so explicitly
24
+ - Commits since the original touch the same files → check each for dependency on the reverted change
25
+
26
+ ## Verify
27
+
28
+ - `git revert --no-commit <sha>` in a worktree at the base; `git diff` it against the PR branch. Delta into the notes.
29
+ - `gh pr view <original>` — read what it fixed and why.
30
+ - `git log <original-sha>..<base> -- <files>` for anything that landed on top.
31
+ - `gh pr checks` on the revert branch — the revert should make CI green if a red CI was the reason.
@@ -0,0 +1,39 @@
1
+ # Schema / storage / serialized state / wire format
2
+
3
+ Anything that changes what's written to disk, a database, a cache, a message on the wire, or a persisted config shape.
4
+
5
+ **Reviewing:** irreversibility and the upgrade path.
6
+ **Read first:** what's already on disk / in flight — the _old_ shape and who writes and reads it. Which package versions can coexist.
7
+ **Done means:** old data readable by new code; a rollback story exists; asymmetric package versions handled; the changeset level is `major` if any reader or writer must change.
8
+ **Trap:** "it works on a fresh install."
9
+ **Attention:** the migration and the readers, not the new shape. The new shape is usually fine; the transition isn't.
10
+
11
+ ## Questions
12
+
13
+ - **Walk the upgrade.** A user on the previous version with existing data updates. What happens on first read? First write? What if they downgrade after writing with the new version?
14
+ - **Is it reversible?** Code reverts are free. Schema migrations, data transforms, and changed wire formats aren't. If this ships wrong, what's the rollback — and does rollback lose data? Irreversible changes get an order of magnitude more scrutiny and usually a flag.
15
+ - **Asymmetric package versions.** Packages are upgraded independently by users. `@mastra/core` at N+1 next to `@mastra/memory` at N — which side writes the new shape, which reads it, and what does the un-upgraded side do with data it doesn't recognize? Is the contract guarded (version field, optional fields, feature detection) or assumed?
16
+ - **Where does the code live?** Is the change placed in the package that owns the format, or in a consumer that will drift from it?
17
+ - **Old readers of the new shape.** Every reader of the format, in every package: grep for the field names, the table, the key. Each is a caller.
18
+ - **New readers of the old shape.** Does the new code tolerate rows/files written before this PR? Missing fields, old enum values, previous nesting?
19
+ - **Migration mechanics.** Is there a migration? Is it idempotent? Does it run automatically or need an operator? What happens if it's interrupted?
20
+ - **Is the semver right?** Any change a reader or writer must accommodate is `major`.
21
+ - **What's the failure mode?** When new code meets unexpected old data, does it error loudly with an actionable message, or silently coerce?
22
+ - **Determinism.** Serialization order, timezone, locale, number precision.
23
+ - **Performance at real size.** Migration over 50 rows vs 50 million; index changes on real tables.
24
+
25
+ ## Signals → branches
26
+
27
+ - No migration and a changed shape → walk the read path for old data by hand; expect a finding
28
+ - "Backward compatible" claimed → find the test that reads old-shape data; if absent, it's an inferred claim
29
+ - Changeset is `patch` or `minor` → check whether any reader in another package must change; if yes, request the correct level before merge
30
+ - Field renamed rather than added → every external reader breaks; deep caller grep across packages
31
+ - Fresh-install tests only → run against a fixture written by the previous version
32
+
33
+ ## Verify
34
+
35
+ - **Write old-shape data with the base, read it with the branch.** Use a fixture from the base writer and record the material compatibility result.
36
+ - Grep every reader/writer of the format across all packages: `archaeology.md` → Callers.
37
+ - Confirm the changeset level.
38
+ - If a migration exists, run it twice on the same fixture (idempotence) and interrupt it once if the mechanism allows.
39
+ - Check the package boundary: which package's version bump carries the change, and what the other package's current published version expects.
@@ -0,0 +1,35 @@
1
+ # Security fix
2
+
3
+ **Reviewing:** completeness — every path that reaches the vulnerable code, not just the reported one.
4
+ **Read first:** every path to the vulnerable code, on the base, before reading the fix.
5
+ **Done means:** all paths covered; a backport plan for supported versions; disclosure handled (no details in a public PR before release, if applicable).
6
+ **Trap:** fixed the one reported path.
7
+ **Attention:** the paths you enumerate yourself. The reporter found one; your job is the rest.
8
+
9
+ ## Questions
10
+
11
+ - **Enumerate the paths.** Grep every caller of the vulnerable function, every entry point that feeds it, every surface that accepts the input class (user input, network, disk, another package). Each is a path; each must be covered or shown unreachable.
12
+ - **Is the fix at the boundary or at the symptom?** Validation belongs where data enters. A fix deep inside that sanitizes one consumer leaves the others exposed.
13
+ - **Does the fix change the trust model?** New permission checks, new assumptions about who calls this.
14
+ - **Same class elsewhere?** If this is path traversal in one file handler, are there other file handlers? Injection in one query builder — other builders? The reported instance is a sample of a pattern.
15
+ - **Backport.** Which released versions are affected? Is there a plan?
16
+ - **Disclosure.** Is the PR public before a release is ready? Does the description contain a working exploit?
17
+ - **Test.** Is there a test that exercises the attack, and does it fail on base?
18
+ - **Secrets in logs / errors.** Did the fix add logging that includes the sensitive input?
19
+ - **Dependencies.** If this is a dependency bump for a CVE, is the vulnerable code path actually reachable from this repo? Is the bump minimal, or does it drag a major?
20
+
21
+ ## Signals → branches
22
+
23
+ - Fix touches one call site → enumerate the others; expect a finding
24
+ - No test → request one before merge; a security fix without a red-on-base test is unverified
25
+ - Fix adds a sanitizer inside a consumer → look for the boundary; the fix probably belongs there
26
+ - Working exploit in the public PR description → flag disclosure immediately, before anything else
27
+ - Dependency bump → confirm reachability; a CVE in unreachable code is noise, not a fix
28
+
29
+ ## Verify
30
+
31
+ - **Test-on-base** must be red (`archaeology.md` → Test on base).
32
+ - Caller enumeration: `archaeology.md` → Callers, for the vulnerable function and for every function that produces its input.
33
+ - Grep for the same vulnerable pattern repo-wide (the API shape, not just the function name).
34
+ - If safely reachable, reproduce the exploit on base in an isolated scratch project and confirm it fails on the branch. Record only a redacted result; never preserve dangerous exploit material in the review file.
35
+ - `gh release list` / tags to identify affected versions for the backport question.
@@ -0,0 +1,38 @@
1
+ # Tests only
2
+
3
+ No production code changes — new tests, changed tests, test infrastructure.
4
+
5
+ **Reviewing:** whether they'd catch anything.
6
+ **Read first:** the assertions.
7
+ **Done means:** the tests test what they claim; they'd fail if the feature broke; they're not flaky; they don't mock the thing they claim to test.
8
+ **Trap:** green-on-anything assertions.
9
+ **Attention:** the assertions and the mocks. Setup and structure are secondary.
10
+
11
+ ## Questions
12
+
13
+ - **What does each assertion actually assert?** `toBeDefined()`, `toHaveBeenCalled()`, `not.toThrow()`, `toBeTruthy()` pass for almost any implementation. A real test asserts the _specific_ value or behavior.
14
+ - **Would it fail if the feature broke?** Mentally break the feature (return the wrong order, skip the write, swallow the error). Does the test go red? If not, it's a test of nothing.
15
+ - **Is the code under test the real code?** Count the mocks. If the module being tested is mocked, the test tests the mock.
16
+ - **Does the test name match what it does?** "handles concurrent writes" with one write; "validates input" with only the happy path.
17
+ - **Tests as spec.** Read only the tests — can you reconstruct the behavior? Tests of implementation details ("calls helper with args") break on refactor and catch no bugs.
18
+ - **What's _not_ tested?** The edge cases the feature has — empty, duplicate, concurrent, error path. The absence is the finding.
19
+ - **Flakiness.** Timing, ordering, shared state, real network, real clock. Anything that could pass and fail on the same code.
20
+ - **If a test was deleted or weakened:** why was it safe? A weakened assertion is a behavior change in disguise — the code can now do something it couldn't before without anyone noticing.
21
+ - **If a test was skipped or marked `todo`:** is there an issue? A skipped test is a claim the feature is untested.
22
+ - **Test infra changes** (helpers, fixtures, harness): who else uses them? Same caller grep as production code.
23
+
24
+ ## Signals → branches
25
+
26
+ - Weak assertion → mentally break the feature; if the test stays green, finding
27
+ - Mocked module matches the module under test → finding; the test proves nothing
28
+ - Test deleted or assertion loosened → treat as a behavior change; find what it used to guard and whether that's still guarded
29
+ - `skip` / `todo` / `only` in the diff → ask why for each; `only` must be removed before merge (it disables the rest of the suite)
30
+ - Timing-based waits (`setTimeout` in a test) → flake candidate; run it five times
31
+
32
+ ## Verify
33
+
34
+ - Run the changed tests on the branch; confirm green.
35
+ - **Mutation check**: when the test's value is uncertain, break the behavior it claims to cover in a scratch worktree, run the test, confirm red, and restore. Record the decisive result.
36
+ - Run new tests several times if there's any timing or shared state: `vitest run <file> --repeat 5` or a shell loop.
37
+ - `grep -rn "\.only(" <changed test files>`.
38
+ - If helpers/fixtures changed: `archaeology.md` → Callers for each.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/factory",
3
- "version": "0.16.0-alpha.9",
3
+ "version": "0.16.1-alpha.0",
4
4
  "description": "Mastra Software Factory module: the server core behind the Mastra Software Factory — storage domains, integrations, and surfaces for agent-powered software delivery",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -59,9 +59,9 @@
59
59
  "zod": "^4.6.4",
60
60
  "@mastra/auth-studio": "1.3.6",
61
61
  "@mastra/auth-workos": "1.6.5",
62
- "@mastra/code-sdk": "1.8.0-alpha.9",
63
- "@mastra/slack": "1.6.4-alpha.0",
64
- "@mastra/core": "1.68.0-alpha.9"
62
+ "@mastra/code-sdk": "1.8.0",
63
+ "@mastra/core": "1.68.0",
64
+ "@mastra/slack": "1.6.4"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/node": "22.20.1",
@@ -70,11 +70,11 @@
70
70
  "typescript": "^6.0.3",
71
71
  "typescript-eslint": "^8.57.0",
72
72
  "vitest": "4.1.11",
73
- "@internal/lint": "0.0.133",
74
- "@mastra/libsql": "1.23.1-alpha.2",
75
- "@mastra/pg": "1.26.0-alpha.4",
76
- "@internal/types-builder": "0.0.108",
77
- "@internal/workspace": "0.0.5"
73
+ "@internal/lint": "0.0.134",
74
+ "@mastra/libsql": "1.23.1",
75
+ "@mastra/pg": "1.26.0",
76
+ "@internal/types-builder": "0.0.109",
77
+ "@internal/workspace": "0.0.6"
78
78
  },
79
79
  "engines": {
80
80
  "node": ">=22.19.0"