Skip to content

Conversation

@slimee
Copy link
Contributor

@slimee slimee commented Dec 11, 2025

PR qui fais que le build de datasource RPC n'appelle pas get schema directement.
C'est le polling qui est utilisé dès le départ pour fetch

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

slimee and others added 4 commits December 11, 2025 16:43
- Disable Naming/PredicateMethod cop for start() method (false positive)
- Remove redundant begin block in fetch_initial_schema_sync
- Use single quotes for static strings
- Extract etag_info variable to fix line length violation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@qltysh
Copy link

qltysh bot commented Dec 11, 2025

Qlty

Coverage Impact

⬆️ Merging this pull request will increase total coverage on main by 0.06%.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
...n_datasource_rpc/lib/forest_admin_datasource_rpc/datasource.rb100.0%
Coverage rating: A Coverage rating: A
...lib/forest_admin_datasource_rpc/Utils/schema_polling_client.rb92.2%91-93, 113-118
Total93.8%
🤖 Increase coverage with AI coding...

In the `perf/improve-schema-polling` branch, add test coverage for this new code:

- `packages/forest_admin_datasource_rpc/lib/forest_admin_datasource_rpc/Utils/schema_polling_client.rb` -- Lines 91-93 and 113-118

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@slimee slimee changed the title feat(schema-polling): improve polling fix(schema-polling): improve polling Dec 11, 2025
slimee and others added 2 commits December 12, 2025 10:16
Co-authored-by: dogan.ay <[email protected]>
## Changes

### Merge conflicts resolved
- Integrated introspection fallback feature from main (PR #238)
- Preserved schema polling improvements from this branch

### Schema polling enhancements
- SchemaPollingClient now computes ETag locally using same algorithm as RPC slave (SHA1)
- Added previous_schema parameter to initialize() for better startup resilience
- ETag is computed from schema content instead of relying on server response
- Ensures consistent ETag comparison between master and slave

### Cleanup
- Removed obsolete SSE cleanup hooks (setup_cleanup_hooks method)
- Polling thread cleanup is automatic, no need for manual signal handlers

### Integration with introspection feature
- SchemaPollingClient receives provided_introspection as previous_schema
- Falls back to introspection if RPC slave is unreachable at startup
- Maintains schema polling for live updates once slave becomes available

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@qltysh
Copy link

qltysh bot commented Dec 12, 2025

2 new issues

Tool Category Rule Count
qlty Structure Function with many parameters (count = 5): initialize 1
qlty Structure Function with high complexity (count = 5): fetch_initial_schema_sync 1

- Fix RuboCop Style/RedundantAssignment offense
- Return datasource directly instead of assigning then returning
- Add 'require digest' at the top of schema_polling_client.rb
- Remove inline requires from compute_etag method
- Fixes initialization issues when digest is not yet loaded
@arnaud-moncel arnaud-moncel force-pushed the perf/improve-schema-polling branch from 405ecb7 to 8d0da82 Compare December 15, 2025 13:43
@arnaud-moncel arnaud-moncel force-pushed the perf/improve-schema-polling branch from 8d0da82 to 4053f38 Compare December 15, 2025 13:59
MAX_POLLING_INTERVAL = 3600

def initialize(uri, auth_secret, options = {}, &on_schema_change)
def initialize(uri, auth_secret, options = {}, introspection_schema = nil, &on_schema_change)
Copy link

Choose a reason for hiding this comment

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

Function with many parameters (count = 5): initialize [qlty:function-parameters]

@arnaud-moncel arnaud-moncel force-pushed the perf/improve-schema-polling branch from a3213ac to f62484a Compare December 15, 2025 15:02
@introspection_schema = nil
rescue Faraday::ConnectionFailed, Faraday::TimeoutError,
ForestAdminAgent::Http::Exceptions::AuthenticationOpenIdClient, StandardError => e
handle_initial_fetch_error(e)
Copy link

Choose a reason for hiding this comment

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

Function with high complexity (count = 5): fetch_initial_schema_sync [qlty:function-complexity]

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants