Skip to content

Conversation

@pmbrull
Copy link
Collaborator

@pmbrull pmbrull commented Jan 7, 2026

Describe your changes:

Add trigger permission to application bots. This is used in collate for /run in Dynamic Agents

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

Summary by Gitar

  • Policy update:
    • Added Trigger operation to ApplicationBotPolicy.json enabling application bots to trigger agent runs
  • Database migrations:
    • Idempotent SQL scripts for MySQL and PostgreSQL update existing ApplicationBotPolicy records in policy_entity table
  • Use case:
    • Enables Collate Dynamic Agents to execute via /v1/apps/trigger/{name} endpoint with proper bot permissions

This will update automatically on new commits.


@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

@pmbrull
Copy link
Collaborator Author

pmbrull commented Jan 9, 2026

gitar auto-apply:on

@pmbrull
Copy link
Collaborator Author

pmbrull commented Jan 9, 2026

gitar can you apply your suggestion?

Co-authored-by: pmbrull <pmbrull@users.noreply.github.com>
@gitar-bot
Copy link

gitar-bot bot commented Jan 9, 2026

gitar can you apply your suggestion?

Applied the suggestion! The migration scripts now append the "Trigger" operation to the existing operations array instead of replacing it.

Changes made:

  • MySQL: Changed to JSON_ARRAY_APPEND(json, '$.rules[0].operations', 'Trigger') to append to existing operations
  • PostgreSQL: Changed to (json->'rules'->0->'operations')::jsonb || '["Trigger"]'::jsonb to concatenate arrays

This preserves any custom operations that may have been added to the ApplicationBotPolicy while still adding the new Trigger permission.

@gitar-bot
Copy link

gitar-bot bot commented Jan 9, 2026

🔍 CI failure analysis for 86ceee3: Maven SonarCloud timeout after 3.5 hours, Maven PostgreSQL timeout after 2.75 hours - both infrastructure issues. Plus Playwright (96.8-98.5% pass) and Python (99.97% pass) flaky tests - all unrelated to PR.

Issue

Maven SonarCloud Job (59933446213): maven-sonarcloud-ci failed after ~3.5 hours (16:49:46 to 20:18:45 UTC).

Maven PostgreSQL Job (59933446360): Failed after ~2.75 hours.

Playwright Jobs: Multiple shards with flaky tests (96.8-98.5% pass rates).

Python Job: 1 failed test (99.97% pass rate).

Root Cause

Maven Jobs (SonarCloud & PostgreSQL)

Both Maven jobs failed after extended runtimes (2.75-3.5 hours) with inaccessible logs. This is the same pattern documented multiple times:

  • Previous SonarCloud: 3.5 hours
  • Previous PostgreSQL: 3 hours
  • Current SonarCloud: 3.5 hours
  • Current PostgreSQL: 2.75 hours

Consistent indicators of:

  1. CI infrastructure timeouts
  2. Runner resource exhaustion
  3. Environment issues

Not code problems that can be fixed in this PR.

Previous Failures (Documented)

  • Playwright: Glossary, detail pages, lineage, metrics, entity panels (96.8-98.5% pass rates)
  • Python: PostgreSQL view lineage (99.97% pass rate)

Details

All failures are completely unrelated to this PR's ApplicationBotPolicy changes:

This PR only modifies:

  • ApplicationBotPolicy.json - adds "Trigger" operation
  • MySQL migration script - updates policy operations
  • PostgreSQL migration script - updates policy operations

None of these changes affect:

  • Maven build/test execution (cannot cause 2.75-3.5 hour timeouts)
  • SonarCloud analysis or code quality checks
  • PostgreSQL integration tests
  • Playwright UI tests
  • Python ingestion code

The changes are minimal configuration updates (JSON + SQL) that:

  • Add one permission to a policy
  • Update two migration scripts
  • Have zero impact on build time, test execution, or CI infrastructure

The repeated pattern of Maven timeouts at 2.75-3.5 hours, combined with high test pass rates (96.8-99.97%) in unrelated features, definitively indicates CI infrastructure problems, not code defects.

Code Review ✅ Approved

Clean, well-implemented PR that adds Trigger permission to ApplicationBotPolicy with idempotent migrations for both MySQL and PostgreSQL.

Resolved ✅ 1 resolved
Edge Case: Migration overwrites custom operations if policy was modified

📄 bootstrap/sql/migrations/native/1.12.0/mysql/schemaChanges.sql:11-15 📄 bootstrap/sql/migrations/native/1.12.0/postgres/schemaChanges.sql:26-30
The migration uses a hardcoded operations array ['Create', 'EditAll', 'ViewAll', 'Delete', 'Trigger'] which will overwrite any additional custom operations that may have been added to the ApplicationBotPolicy by users.

If an organization has added extra operations to this policy (e.g., custom permissions beyond the defaults), this migration will remove those customizations.

Impact: Low - this is a system-managed policy that is unlikely to be customized, but worth noting.

Suggested improvement: Consider using JSON array append/merge functions instead of replacement:

  • MySQL: JSON_ARRAY_APPEND(json, '$.rules[0].operations', 'Trigger')
  • PostgreSQL: json->'rules'->0->'operations' || '["Trigger"]'::jsonb

This would preserve any existing operations while adding the new Trigger permission.

What Works Well

Both SQL migrations use proper idempotency patterns - checking for existing values before appending, and validating the JSON path exists before modification.

Options ✅ Auto-apply

✅ Auto-apply is on Gitar will commit updates to this branch.
Display: compact Hiding non-applicable rules.

Comment with these commands to change:

✅ Auto-apply Compact
gitar auto-apply:off         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | This comment will update automatically (Docs)

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

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants