Adding methods to in-body `methods:{}` on `export const model` doesn't re-register
Opened by swamp_lord · 4/17/2026
Description
For user-defined model types (files using export const model = { type, version, methods: { ... }, ... }), adding a new entry to the methods: object is not picked up by swamp at runtime — the registered type keeps the old method set. Identical functionality works correctly when added in a separate export const extension file.
Steps to reproduce
- Start with a repo using a user-defined model type, e.g.
extensions/models/mongodb_atlas_access_list.tswithexport const model = { type: "@john_yq2i/mongodb-atlas-access-list", version: "2026.04.15.3", methods: { revoke_ip, grant_permanent_ip, grant_temporary_ip } }. - Add a new method
listinside themethods:object. Save. rm -rf ~/.swamp/repos/<repoId>/bundles/*/mongodb_atlas_access_list.jsto force a rebundle.- Run
swamp model method run swamp-club-atlas list. - Separately, bump
versionto2026.04.17.1and add an upgrade stub — still no change. - Finally, delete the in-body
listmethod and add an identical method via a new fileextensions/models/mongodb_atlas_access_list_list.tswithexport const extension = { type: "@john_yq2i/mongodb-atlas-access-list", methods: [{ list: { ... } }] }.
Actual behavior
Steps 1–5: swamp model type describe @john_yq2i/mongodb-atlas-access-list --json keeps showing only the original 3 methods. swamp model method run fails with Unknown method 'list' ... Available methods: revoke_ip, grant_permanent_ip, grant_temporary_ip. The regenerated bundle also lacks the list method despite it being in the source file.
Step 6: works immediately. swamp model type describe now shows 4 methods; the method runs fine.
Expected behavior
Adding a method in either location — in-body methods: on export const model, or via export const extension — should behave the same way. Both should pick up edits from source on the next run (after bundle invalidation). Having to move code between files to make a method "stick" is surprising.
Environment
- swamp:
20260414.220725.0-sha.e36340deon darwin aarch64 - Model type version:
2026.04.15.3
Closed
No activity in this phase yet.