Skip to content

[SENTRY][PALAD-AI-RAILS-2M] Fix project destroy when workflows are column-bound - #181

Merged
artempartos merged 2 commits into
developfrom
task-1392-fix-project-destroy-workflow-bindings
Sep 4, 2026
Merged

artempartos merged 2 commits into
developfrom
task-1392-fix-project-destroy-workflow-bindings

Conversation

@aixle-com

@aixle-com aixle-com Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Reorder Project associations so board is destroyed before workflows / workflow_runs, clearing ColumnWorkflowBinding (and column transitions) before Workflow#check_column_bindings runs.
  • Add model + integration regression coverage for bound-workflow project destroy, and keep standalone soft/hard delete guards when a binding still exists.
  • Fixes Sentry PALAD-AI-RAILS-2M / board task 1392.

Test plan

  • bin/rails test test/models/project_test.rb test/models/workflow_test.rb test/models/board_test.rb test/integration/web/company/projects_controller_test.rb
  • Manually: create a project with a board column bound to a workflow, then delete the project via Company UI — expect redirect success, no HTTP 500 / RecordNotDestroyed

Made with Cursor

Destroy the board (and its ColumnWorkflowBindings) before project
workflows so Workflow#check_column_bindings no longer aborts cascade
teardown. Fixes PALAD-AI-RAILS-2M.

@alex-astafyev alex-astafyev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code review verdict: Approve

Matches the tech design and fixes the Sentry failure mode (board destroyed before workflows so ColumnWorkflowBindings are gone before Workflow#check_column_bindings).

What looks good

  • Minimal, correct change: association reorder + comment explaining why order matters
  • Standalone workflow soft/hard delete guards preserved (covered in workflow_test)
  • Strong model regression with binding + board_task + workflow_run + column_transition
  • Integration coverage for the company destroy HTTP path

Non-blocking notes

  • Association declaration order remains load-bearing (also on Board: tasks before columns). The new comment is enough for this fix; a prepended before_destroy is optional hardening only.
  • CI Backend/Frontend checks were still pending at review time — Wait/Gate will block QA until they pass.

Acceptance criteria: met for the described failure mode.

Comment thread app/models/project.rb Resolved
Comment thread test/models/project_test.rb Resolved
Comment thread test/models/workflow_test.rb Resolved
BoardColumn/BoardTask already guard after_commit touch with persisted?;
ColumnWorkflowBinding did not, so project destroy (board-first) raised
ActiveRecord::ActiveRecordError and failed Backend Checks.

Signed-off-by: Alex Astafyev <[email protected]>
Co-authored-by: Cursor <[email protected]>

@alex-astafyev alex-astafyev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code review verdict: Approve

Re-reviewed after the CI fix commit (30f0eb2). Still matches the tech design and acceptance criteria for PALAD-AI-RAILS-2M.

What looks good

  • Association reorder + comment: board destroyed before workflows/runs so bindings and column_transitions are cleared first
  • ColumnWorkflowBinding#touch_board now mirrors BoardColumn/BoardTask (persisted? guard) — necessary because after_commit runs after the outer destroy transaction, when the board is already gone
  • Standalone soft/hard delete guards preserved and covered
  • Model + integration regressions cover the Sentry path (binding) and the RESTRICT edge (run + ColumnTransition)

Non-blocking

  • Destroy order remains load-bearing on association declaration order; the comment is enough for this fix
  • Backend Checks still in progress at review time — Gate/Wait will block QA until green

Acceptance criteria: met for the described failure mode.

Comment thread app/models/column_workflow_binding.rb Resolved
Comment thread app/models/project.rb Resolved
Comment thread test/models/project_test.rb Resolved
@alex-astafyev
alex-astafyev marked this pull request as draft September 1, 2026 08:34
@alex-astafyev
alex-astafyev marked this pull request as ready for review September 1, 2026 12:30
@alex-astafyev alex-astafyev changed the title [PALAD-AI-RAILS-2M] Fix project destroy when workflows are column-bound [SENTRY][PALAD-AI-RAILS-2M] Fix project destroy when workflows are column-bound Sep 1, 2026
@artempartos
artempartos merged commit 2dbc17a into develop Sep 4, 2026
7 checks passed
artempartos added a commit that referenced this pull request Sep 6, 2026
Everything here was found in Sentry on the currently deployed release, and
each is the smallest change that makes the reported failure impossible.

PALAD-AI-TEMPORAL-X — an `exec` nobody could account for pinned its
reservation forever. AD-5 retains a slot so a late Pod never finds its seat
handed to someone else, but only a create or a start can produce that Pod:
an exec runs inside a container, and release is reached only once that
container is provably absent, so a late one can only 404. The gate is now
scoped to the phases that can still materialize a workload, and the queue
health line reports `pinned_reservations` beside the wider
`uncertain_operations` so the alarm counts slots actually held. Replaying an
uncertain exec is still refused — launching the agent twice is the thing
that must not happen — it just no longer costs the pool a slot.

PALAD-AI-RAILS-2R — `update_connector` had no `update_connector?` on the
policy, so the dynamic authorize raised NoMethodError and every role got a
500 instead of an answer. `accept_tool_drift` was one click away from the
same fate. A structural test now walks every company-scoped route and
asserts its policy can answer, because actions get added far more often than
policies get re-read.

PALAD-AI-RAILS-2N — a soft-deleted step keeps its position and the unique
(workflow, position) index still covers it, so the builder's "one past the
highest visible position" collided with a step the user had already deleted.
Appending is the server's job now; the client no longer sends a position,
and a caller that does send a taken one gets a 422 rather than a 500.

PALAD-AI-RAILS-2P — one tool whose schema the MCP gem refuses raised out of
tools/list and took the whole endpoint down with it, including calls to the
tools that were fine. Validation only protects new writes; a row saved
before `$ref` was forbidden still has a matching digest. Each tool is now
published on its own and a bad one is dropped loudly, the way a failed
digest check already was.

PALAD-AI-RAILS-2K — reorder renumbered only the columns the payload named
and left the rest where they were, colliding on (board_id, position). The
board settings dialog sends a partial list whenever a column appears while
it is open. The whole board is now ordered every time: named columns first,
the rest after in their existing order.

PALAD-AI-RAILS-2M needed no code — PR #181 fixed it after the release the
events came from — and the rest of the open issues were stale. Both are
closed in Sentry with the evidence.

Signed-off-by: Artem Petrov <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

2 participants