Repository navigation
[IMP] owl: help coding agents write Owl 3 code - #2079
Merged
Merged
Conversation
AI coding agents know Owl 2 from their training data, and write Owl 2 code that fails, often silently, in Owl 3. The Owl 3 documentation is not at hand when they work: the npm package only contains the bundles, and Odoo only vendors owl.js and owl.d.ts. So agents end up reading the Owl source each time. This commit adds owl.llm.md, a condensed reference written for them: the Owl 2 habits that are wrong in Owl 3 (and what happens if they are used anyway), the silent failures to avoid, the whole public API, and a complete example. The build copies it to dist/, stamped with the version, so it is published with the npm package, and the release script attaches it to the GitHub release, next to the bundles.
Before this commit, an unknown directive (a t-* attribute that Owl does not handle) only threw on DOM elements. On a <t> node, or as a parameter of t-call, t-call-slot, t-set-slot or t-set, it was silently ignored. In particular, the Owl 2 directives t-slot and t-raw rendered nothing, and a directive meant for DOM elements (t-on-*, t-att-*, ...) had no effect on a <t> node. On DOM elements too, any attribute starting with "t-att" was accepted, so a misspelled t-attclass rendered a "lass" attribute. This commit makes the compiler throw in all these cases: - an unknown directive throws, and the Owl 2 directives that no longer exist (t-raw, t-slot, t-portal) get an error telling what to use instead; - a known directive used where it has no effect throws an error saying so: on a <t> node, together with a directive that ignores it (t-key with t-call, t-set with t-out, ...), or t-ref on a <t t-out>; - t-call-slot and t-call-block, like t-call, only work on <t> nodes: on another element, the element was dropped. The attributes of a t-set-slot node (scope, handlers) are still read after its content is parsed, as a directive on the same node (t-call, t-tag, t-component) may use them too, so they are not reported there. An empty t-translation-context is now ignored, as no context. Compiling the templates of Odoo with this change reveals 6 templates with such an ignored directive (t-valuef, t-index, t-foreach-index, t-inherit-mode without t-inherit, t-att-id on a <t>, and t-call-slot on a <span>). They have to be fixed, as they now fail to compile.
onWillUpdateProps is deprecated and will be removed. The documentation said it was already removed, while it is still exported: it now says it is deprecated, and the hook is marked as such in the type declarations. Its replacement is to give the props that a component reacts to as signals, and to derive state from them with computed values, effects or useOnChange. A plain prop is a value for the template. Reading a plain prop in a computed value or an effect currently subscribes to it, but this is not part of the API and may change: the documentation no longer presents it as a feature, and its examples use signal props instead.
Running the examples of the documentation against the current build showed several of them do not work, and some statements are wrong: - the README example throws at mount: t-model is given a plain object property instead of a signal, and push is called on the signal instead of its value; - ErrorBoundary does not catch errors thrown in event handlers, its example created an effect that outlives the component, and missed imports and a component registration; - the body of a t-set is not escaped, t-foreach accepts any iterable, Sets included, and t-att-* only omits the attribute for false, null and undefined (0 and "" are set); - the SVG and slots examples read props without `this.` and without useProps; - the useOnChange example could show the record of a previous id when responses arrive out of order; - the useMouse example of the migration guide gave no event name to useListener, and an example of the design notes used a useInterval hook that does not exist; - a root created with app.createRoot must wait for the plugins with an asynchronous onWillStart, as the mount helper does.
Two orientations of Owl 3 were not stated by the documentation: - plugins are the architectural units of an application: they own its state, data and logic, while components are the presentation of these units, with only UI state of their own. The plugins and components pages now say so, and the agent reference presents plugins first; - a component declares its props with a schema. useProps also accepts a list of keys or no argument, but the schema documents, validates and types the props: the documentation now presents it as the preferred form, and its examples use it. The agent reference also gets a section on schemas and types: the validators, optional values and defaults, the types that are only checked by TypeScript, and how to reuse and apply a schema.
t-esc was deprecated in favor of t-out: it still worked, and logged a deprecation warning. It is now a removed directive, like t-raw, t-slot and t-portal: using it throws an "Unknown QWeb directive" error telling to use t-out instead. 3 templates of Odoo still use t-esc and have to be converted to t-out.
mcm-odoo
force-pushed
the
master-agent-reference-mcm
branch
from
November 26, 2026 14:16
bbd3b15 to
7503e9a
Compare
14 tasks
odoo-mergebot Bot
pushed a commit
to odoo/o-spreadsheet
that referenced
this pull request
Nov 27, 2026
PR odoo/owl#2079 in owl3 introduces a detection of wrong owl3 usages. There was two instances in our code: - t-att-id on a <t> tag does nothing - t-call-slot on a <span> This commit fixes those wrong usages in our code. closes #10219 Task: 0 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
14 tasks
14 tasks
mcm-odoo
marked this pull request as ready for review
November 27, 2026 12:03
ged-odoo
approved these changes
Nov 27, 2026
odoo-mergebot Bot
pushed a commit
to odoo/o-spreadsheet
that referenced
this pull request
Nov 27, 2026
PR odoo/owl#2079 in owl3 introduces a detection of wrong owl3 usages. There was two instances in our code: - t-att-id on a <t> tag does nothing - t-call-slot on a <span> This commit fixes those wrong usages in our code. closes #10221 Task: 0 X-original-commit: 0511aaf Signed-off-by: Rémi Rahir (rar) <rar@odoo.com> Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
odoo-mergebot Bot
pushed a commit
to odoo/o-spreadsheet
that referenced
this pull request
Nov 27, 2026
PR odoo/owl#2079 in owl3 introduces a detection of wrong owl3 usages. There was two instances in our code: - t-att-id on a <t> tag does nothing - t-call-slot on a <span> This commit fixes those wrong usages in our code. closes #10222 Task: 0 X-original-commit: 0511aaf Signed-off-by: Rémi Rahir (rar) <rar@odoo.com> Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
odoo-mergebot Bot
pushed a commit
to odoo/o-spreadsheet
that referenced
this pull request
Nov 27, 2026
PR odoo/owl#2079 in owl3 introduces a detection of wrong owl3 usages. There was two instances in our code: - t-att-id on a <t> tag does nothing - t-call-slot on a <span> This commit fixes those wrong usages in our code. closes #10222 Task: 0 X-original-commit: 0511aaf Signed-off-by: Rémi Rahir (rar) <rar@odoo.com> Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
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.
AI coding agents learned Owl from Owl 2 code. In Owl 3 they keep writing Owl 2 code, which often fails silently, and they read the Owl source to find out why. This PR ships a reference for them with the build, makes the compiler reject directives it used to ignore silently, and fixes documentation that contradicts Owl 3.
Changes
Agent reference (
packages/owl/owl.llm.md)dist/and stamps it with the version. It is therefore published on npm, and the release script attaches it to the GitHub release, together withowl.d.ts.Compiler: unknown directives throw
t-*attribute only threw on DOM elements. On<t>nodes and ont-call,t-call-slot,t-set-slotandt-set, it was ignored without any error.t-raw,t-slot,t-portal), with an error that names the replacement;t-on-*on<t>,t-keywitht-call, ort-setwitht-out;t-att*; for example,t-attclassused to render alassattribute;t-call-slotort-call-blockon an element other than<t>, which used to drop the element.Compiler:
t-escthrowst-escused to work and only logged a deprecation warning. It is now a removed directive liket-raw, and the error says to uset-outinstead.onWillUpdatePropsdeprecated@deprecatedand will be removed. The docs said it was already removed, but it is still exported.computed,useEffectoruseOnChange.Documentation
useOnChangeand migration examples are also fixed.t-setescaping, the iterablest-foreachaccepts, the falsy values for whicht-attomits the attribute,createRootwith async plugins, and the errors ErrorBoundary catches.useProps()anduseProps([...])still exist, but the schema form is preferred.Impact on Odoo
With this branch, 9 templates of Odoo no longer compile. They must be fixed before the Owl upgrade lands in Odoo, or in the same change.
6 templates contain a directive that was silently ignored until now, so each one is an existing bug:
list_renderer.xmlt-valuefo-spreadsheet-TopBart-att-idon<t>o-spreadsheet-ValidationMessagest-call-sloton<span>gantt_popover.xmlt-inherit-modewithoutt-inherittax_declaration_client_action.xmlt-foreach-indexsign_items.xmlt-index3 templates still use
t-escand must switch tot-out:webclient/clickbot/clickbot_overlay.xmlcomponents/stripe_attachment_widget.xml(2 occurrences)js/version_update_dialog.xmlOdoo applies
t-inheritbefore Owl compiles a template, so templates that uset-inheritare not affected. The two spreadsheet templates must be fixed in the o-spreadsheet repository.Follow-up in Odoo
owl.llm.mdnext to the vendoredowl.js.AGENTS.mdthat points agents toowl.llm.md.Testing