Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contribution License Agreement - Valid 🟢All commits contain valid signoff. As a confirmation, remember that you are agreeing to our Contribution License Agreement. |
Closes InditexTech#1256 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: txnio <bytxnio@gmail.com>
txnioh
force-pushed
the
fix/sdk-optional-lifecycle-hooks
branch
from
November 3, 2026 00:49
4403fbb to
d5bc919
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1256
Problem
WeaveNode,WeaveActionandWeavePlugindeclare their optional hooks asabstract name?(): void. TypeScript requires abstract members to be implemented even when they are marked optional, so a subclass that leaves one out fails withTS2515. The SDK always calls these hooks with?.(), and the API reference describes them as optional ("if defined").The SDK works around it with
hook = undefined;: there are 72 such lines insdk/src, 22 inweavejs-frontendandweavejs-backend, and the pattern is in.github/copilot-instructions.md. Anyone who does not know the pattern gets the error. Since #994 (3.7.0) addedinitializethis way, every custom node, action and plugin written before that release fails to type-check after upgrading. Thecreate-weave-*-apptemplates are an example: their actions setonPropsChange = undefinedbut notinitialize.Change
abstractis removed from the 8 optional hooks, which stay optional:nodes/node.ts:initializeactions/action.ts:initialize,onInit,onPropsChange,cleanupplugins/plugin.ts:initialize,onInit,onRenderabstractonly exists in the types, so the emitted JavaScript does not change. The required members (onRender/onUpdateon nodes,triggeron actions,enable/disableon plugins) are untouched.All existing code keeps compiling: subclasses that implement a hook, subclasses that set it to
undefined, and subclasses that leave it out. I checked the hook signatures used in the SDK, the templates and the two showcase repos: all of them are(): void, and none callssuper.<hook>()or usesoverride.Tests
src/__tests__/types/optional-hooks.test-d.tsis a type-level test. It defines a minimal node, action and plugin with no hooks, plus an action that uses the= undefinedpattern.The SDK's
tsconfig.jsonexcludes__tests__and vitest did not type-check, so a regular test could not catch this. To run the new test,vitest.config.tsenablestypecheck, scoped bysrc/__tests__/types/tsconfig.jsonto*.test-d.tsfiles. The folder'stsconfig.jsonis already covered byREUSE.toml's**/tsconfig.json.main,npm run test -w @inditextech/weave-sdkexits 1:MinimalNodedoes not implementinitialize(TS2515).Verification
npm run verifyincode/(the CI command) passes for all 10 projects on this branch, with no Nx cache hits.vitest(162 files, 5762 tests),tsc --noEmit,eslintand the package build pass.prettier --checkis clean on the changed files.sdk/srcalready has 156 files that prettier reports onmain, and I left them alone.reuse lint: compliant (1728/1728).sanitize-changelog.mjs --checkandcommitlintpass.TS2515are gone), and the generated backend has 0 once the template fixes from Generated create-weave-*-app projects do not install, build or run without manual fixes #1257 are in.Out of scope:
= undefinedlines. They are harmless now, and removing them would only add noise to this diff. I can do it in a follow-up if you want.init,render), and do not documentinitialize. I opened API reference for WeaveNode, WeaveAction and WeavePlugin lists outdated hook names and omits initialize #1259 for that.If you would rather not enable
typecheckin the SDK's vitest config, I can drop the type test and keep only the 8-line change.Suggested label:
release-type/patch. I can't set labels myself.