Skip to content

fix(rpc-agent): qualify Decorators namespace in datasource customizer#295

Merged
bexchauveto merged 1 commit into
mainfrom
fix/rpc-agent-decorators-namespace
May 5, 2026
Merged

fix(rpc-agent): qualify Decorators namespace in datasource customizer#295
bexchauveto merged 1 commit into
mainfrom
fix/rpc-agent-decorators-namespace

Conversation

@bexchauveto
Copy link
Copy Markdown
Member

@bexchauveto bexchauveto commented May 4, 2026

Summary

ForestAdminRpcAgent::DatasourceCustomizer#add_datasource overrides its parent to add the mark_collections_callback hook, but the override re-uses the unqualified Decorators::Publication::... / Decorators::RenameCollection::... constants from the parent's body verbatim. The parent class lives in ForestAdminDatasourceCustomizer, where those constants resolve via ForestAdminDatasourceCustomizer::Decorators::.... The override lives in ForestAdminRpcAgent, where there is no Decorators module — so the same identifiers fail to resolve.

The result: any leaf RPC agent calling agent.add_datasource(ds, include: [...]), exclude: [...], or rename: [...] crashes at boot with uninitialized constant ForestAdminRpcAgent::DatasourceCustomizer::Decorators (NameError). Without those options the path is never hit, so the bug stayed silent until now.

Fix

Fully qualify both constants:

  • Decorators::Publication::PublicationDatasourceDecoratorForestAdminDatasourceCustomizer::Decorators::Publication::PublicationDatasourceDecorator
  • Decorators::RenameCollection::RenameCollectionDatasourceDecoratorForestAdminDatasourceCustomizer::Decorators::RenameCollection::RenameCollectionDatasourceDecorator

Two-line constant change. No behavioural change for callers that don't pass these options.

Test plan

  • cd packages/forest_admin_rpc_agent && BUNDLE_GEMFILE=Gemfile-test bundle exec rspec passes (105 examples, 0 failures — verified locally)
  • bundle exec rubocop clean
  • Smoke test in a real leaf RPC agent: agent.add_datasource(some_ds, include: ['SomeCollection']) boots without raising and the resulting RPC schema only exposes the included collection (verified locally against the Snowflake datasource)

Note

Qualify Decorators namespace references in DatasourceCustomizer#add_datasource

Fixes unqualified Decorators:: references in datasource_customizer.rb by prefixing them with ForestAdminDatasourceCustomizer::. This ensures PublicationDatasourceDecorator and RenameCollectionDatasourceDecorator resolve to the correct namespace when called from the ForestAdminRpcAgent context.

Macroscope summarized d7ce117.

`ForestAdminRpcAgent::DatasourceCustomizer#add_datasource` referenced
`Decorators::Publication::PublicationDatasourceDecorator` and
`Decorators::RenameCollection::RenameCollectionDatasourceDecorator`
without a namespace qualifier. The parent
`ForestAdminDatasourceCustomizer::DatasourceCustomizer` defines the same
unqualified constants and resolves them correctly because it lives in the
`ForestAdminDatasourceCustomizer` module — but the override here lives in
`ForestAdminRpcAgent`, where no `Decorators` module exists, so any leaf
RPC agent passing `include:`, `exclude:`, or `rename:` to
`agent.add_datasource(ds, options)` crashed with NameError at boot.

Fully qualify both constants with their actual namespace
(`ForestAdminDatasourceCustomizer::Decorators::...`).
Copy link
Copy Markdown
Member

@matthv matthv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bexchauveto bexchauveto merged commit 12ef7c9 into main May 5, 2026
36 checks passed
@bexchauveto bexchauveto deleted the fix/rpc-agent-decorators-namespace branch May 5, 2026 12:22
forest-bot added a commit that referenced this pull request May 5, 2026
## [1.27.2](v1.27.1...v1.27.2) (2026-05-05)

### Bug Fixes

* **rpc-agent:** qualify Decorators namespace in datasource customizer ([#295](#295)) ([12ef7c9](12ef7c9))
@forest-bot
Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.27.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants