Skip to content

fix(gateway): release a merged plan task's own dependents via its ticket's plan link - #719

Merged
nambok merged 2 commits into
mainfrom
fm/coderhelm-plan-dependents-fix
Nov 18, 2026
Merged

nambok merged 2 commits into
mainfrom
fm/coderhelm-plan-dependents-fix

Conversation

@thinkaxelthink

@thinkaxelthink thinkaxelthink commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

  • When a pull request merges, trigger_plan_dependents in services/gateway/src/routes/github_webhook.rs no longer looks up the plan task by issue number alone. Before, it took the first task row with a matching number in any of the team's plans, and a missing number counted as 0. It now passes the whole run record to the new common::plan_dependents::dependents_to_release. That function looks up the ticket's PLAN_TICKET#… plan link in the settings table first, then releases only the waiting tasks that depend on the task the link names.
  • If no plan link exists, it checks the task rows' own ticket fields. For a GitHub run it matches the repository and issue number parsed from issue_url. For a Jira run it matches jira_ticket_key. Issue number 0, a missing repository or a number on its own never match. If the run record names a plan, only that plan is searched. Otherwise it searches all of the team's plans and releases dependents only when exactly one task names the ticket.
  • The worker's PlanTicket::sk in plan_execute.rs now builds its link keys with the shared github_link_sk and jira_link_sk helpers, so the key written when a plan opens a ticket is the same key read at merge. The new module includes unit tests against an in-memory store. They cover a Jira merge releasing its own dependents, the same issue number in another repository releasing nothing, number 0 never matching, a ticket named by two tasks releasing nothing, and the link being checked before the task rows.

Follow-ups (not in this change)

  • On a run with pull requests in several repositories, only the merge of the run's main pull request starts waiting tasks. That was already true before this change.

🤖 Generated with Claude Code

nambok
nambok previously approved these changes Nov 17, 2026

@nambok nambok 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.

lgtm, good catch. looking the task up by its own plan link instead of scanning for the first matching issue number fixes both jira runs (issue number 0) and the cross-repo #12 case. sharing github_link_sk/jira_link_sk between the worker and the gateway means they can't drift. merges clean with main.

one follow-up, not blocking: link_ticket_to_plan is best effort (a failed put just logs), so if that write fails, dependents now stall silently. could you fall back to the run record's plan_id and match by issue number + repo inside that one plan when no link exists? that also covers plans from before #335.

Shoyu added 2 commits November 17, 2026 16:12
…ket's plan link

After a pull request merged, the tasks waiting on its plan task were found
by issue number alone: the first task row in any of the team's plans with
the run's issue number. A Jira ticket's run records issue number 0, so a
merged Jira task never released its own dependents and could release those
of a task with no issue yet, in any plan. GitHub issue numbers repeat
across repositories, so a merge in one repository could release the
dependents of a task in another.

The merged run's task is now found through its ticket's plan link, the
settings row the plan wrote when it opened the ticket (repository and
issue number, or Jira key), and issue number 0 never names a ticket. A
merge whose ticket has no plan link releases nothing.
…w records

The link from a ticket to its plan task is written best effort, and plans
from before links existed have none. A merge on such a task released
nothing, so its waiting tasks stayed waiting.

Without a link, the merged run's task is now the task row that records the
same ticket: the repository and issue number from the issue's URL, or the
Jira key. Never issue number 0 and never a number alone. The search stays
in the run's plan when the run names one, otherwise covers the team's
plans, and a ticket that more than one task names releases nothing. The
link is still looked up first.
@thinkaxelthink

Copy link
Copy Markdown
Contributor Author

The review's follow-up is included in 5985ce8.

The fallback as suggested (use the run record's plan_id, then match issue number + repo inside that plan) could not fire in either case it was meant to cover. A run's plan_id is only ever written from the link. The worker copies it onto a new run only when it finds the link, and link_ticket_to_plan adds it to a run that already started only after the link write succeeds. So a failed link write leaves the run with no plan_id, and runs from before #335 never had one.

What's built instead: when there is no link, the merged run's ticket is matched against the plan task rows' own ticket fields, which the plan writes separately from the link. For GitHub that's the repository and issue number from issue_url; for Jira it's jira_ticket_key. Issue number 0 or a bare number never matches. The search stays in the run's plan when the run names one; otherwise it covers the team's plans and releases only on a single exact match. The link is still checked first.

Testing: 7 new unit tests in common::plan_dependents (13 in the module). With the fallback switched off, the two tests that find a task through its row fail; with it on, all pass. The pipeline's live check against a local DynamoDB was not completed because the build outran its time budget, so the evidence is the unit tests plus CI. The branch is rebased on current main.

@nambok nambok 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.

fallback looks good, finding the task by the ticket on its own row (scoped to the run's plan when it has one, only on a single match) covers the failed link write and the pre-#335 plans. thanks

@nambok
nambok merged commit 6e4010b into main Nov 18, 2026
10 checks passed
@nambok
nambok deleted the fm/coderhelm-plan-dependents-fix branch November 18, 2026 00:43
nambok added a commit that referenced this pull request Nov 19, 2026
…#707)

* Fill the Before and After table from the end-to-end run's screenshots

CoderHelm's own pull request now shows the screenshots its end-to-end run
already took, instead of "No screenshot".

- common::e2e::shots reads the images Cucumber JSON embeds, Playwright
  JSON attaches and Playwright's HTML report keeps under data/, keyed by
  the test's id, and picks the test that shows the change: one the change
  edits, one the test map ties to the changed files, or one whose name
  shares a word with a changed UI file.
- e2e_screens keeps that test's screenshot on the head and on the default
  branch's newest passing run in the install's own bucket, records it for
  the head and rebuilds the description.
- The table links each image through the API with a signed link that
  works for a year (GET /webhooks/ci/tests/screenshot); the bucket keeps
  the images 395 days.

* Say why a screenshot's test was picked, and pass clippy

The reason names the test, not only its name (the match reads its title
and file); an empty Before cell says no passing run on the base kept one
rather than "yet"; the caption gives the reason before the run links.
Formatted, and two iterator and one slice lint fixed.

* no-mistakes(review): Claim head record, use PR base, align record TTL

* no-mistakes(review): Upload screenshots before claiming the head record

* no-mistakes(review): Detect lost claim race with the typed DynamoDB error

* Format the screenshot fixes with cargo fmt

* no-mistakes(review): Pick screenshot test against PR base, fetch PR once

* no-mistakes(document): Format is_own_pr with cargo fmt

* Fill the Before and After table from the end-to-end run's screenshots

CoderHelm's own pull request now shows the screenshots its end-to-end run
already took, instead of "No screenshot".

- common::e2e::shots reads the images Cucumber JSON embeds, Playwright
  JSON attaches and Playwright's HTML report keeps under data/, keyed by
  the test's id, and picks the test that shows the change: one the change
  edits, one the test map ties to the changed files, or one whose name
  shares a word with a changed UI file.
- e2e_screens keeps that test's screenshot on the head and on the default
  branch's newest passing run in the install's own bucket, records it for
  the head and rebuilds the description.
- The table links each image through the API with a signed link that
  works for a year (GET /webhooks/ci/tests/screenshot); the bucket keeps
  the images 395 days.

* Say why a screenshot's test was picked, and pass clippy

The reason names the test, not only its name (the match reads its title
and file); an empty Before cell says no passing run on the base kept one
rather than "yet"; the caption gives the reason before the run links.
Formatted, and two iterator and one slice lint fixed.

* no-mistakes(review): Claim head record, use PR base, align record TTL

* no-mistakes(review): Upload screenshots before claiming the head record

* no-mistakes(review): Detect lost claim race with the typed DynamoDB error

* Format the screenshot fixes with cargo fmt

* no-mistakes(review): Pick screenshot test against PR base, fetch PR once

* no-mistakes(document): Format is_own_pr with cargo fmt

* Keep end-to-end screenshots on the screenshots ref, under the preview's pages

Review asked for one hosting model and for the pair not to hide the
preview's page captures.

- The Before and After images are committed to refs/coderhelm/screenshots
  beside the preview's captures and linked by commit, so only people who
  can read the repository see them. The public screenshot route, its
  signed links, the bucket copies and their lifecycle rule are gone.
- preview::keep_on_ref is the one way both write that ref: blobs, a commit
  on top of the ref, and a move without force (advance_own_ref), tried
  again on top when another writer moved it, so no writer's commit is
  dropped and no image link breaks.
- The pair is its own fact (e2e_screens), rendered as a table under the
  preview's pages and never instead of them; it takes the place of a "No
  screenshot" line. The preview's pages now win over a set screens table.
- An ingest reads the pull request only when it needs it: a failure on a
  branch that is not CoderHelm's shape, or a report that carries
  screenshots. CiReports gets the run's real attempt.

* Pin the dashboard for the November 17 proof release (#770)

* The changed tests run both ways: CI's install, a budget of their own, every runner read (#769)

* A bug is reproduced on the base before it is planned; people's answers decide scope

The planner runs the ticket's inputs through the base code (reproduce_on_base)
and writes ## Reproduce: inputs with stored variants, the command and its
output, the wrong line. The fix goes in that line's mechanism; questions a
lookup answers are looked up first; a diff rewriting a path for a few named
records goes back; new tests run on the base the way CI runs them, loops
included, and an unproven bug fix says Unverified. A person's answer or
comment moves an out-of-scope item in at seed and every round, and a revert
of it is a breach.

* The changed tests run both ways: CI's install, a budget of their own, every runner read

Across the 53 most recent runs, none of the 17 with a test check ran a new
test on the base and the head. Six failed the install: a pnpm workspace
member was installed on its own (`cd apps/web && pnpm install
--ignore-workspace --frozen-lockfile`), where pnpm stops with
ERR_PNPM_NO_LOCKFILE. Seven ran out of time: the fresh step ran every
other check first and reached the sandbox runs short again, with its one
request spent. Two could not read a CI loop and listed fixtures as tests.

- A workspace member installs from the workspace root (falling back to
  the member and its dependencies); the runs use CI's job for the test
  files, its install lines, Node and pnpm versions, through the cached
  environment. A failed install says why.
- The sandbox runs are owed to a fresh step, which runs them before any
  other check and records them for the head; up to four asks a run.
- One `test_env::narrow` for pytest, unittest, Vitest, Jest, go test and
  cargo test; package scripts and make targets read to their runner; a
  file's own package script as the narrow fallback; end-to-end specs and
  test data are not unit tests; one file without a command no longer
  stops the rest.
- Whether the tests ran, and why not, is counted (`tests_ran`) on the
  run's checks, its notes and the pull request.

Incident: tq_tests_run.

* ci: bump the actions group across 1 directory with 8 updates (#313)

Bumps the actions group with 8 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4.4.0` | `7.0.1` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.6.2` | `7.0.2` |
| [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) | `3.10.1` | `4.1.3` |
| [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance) | `2.4.0` | `4.2.2` |
| [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) | `4.3.1` | `6.3.0` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `4.3.0` | `8.0.2` |
| [actions/setup-python](https://github.com/actions/setup-python) | `5.6.0` | `7.1.0` |
| [actions/setup-node](https://github.com/actions/setup-node) | `4.4.0` | `7.1.0` |



Updates `actions/checkout` from 4.4.0 to 7.0.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@11d5960...3d3c42e)

Updates `actions/upload-artifact` from 4.6.2 to 7.0.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@ea165f8...cf430e0)

Updates `sigstore/cosign-installer` from 3.10.1 to 4.1.3
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](sigstore/cosign-installer@7e8b541...756fe2d)

Updates `actions/attest-build-provenance` from 2.4.0 to 4.2.2
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](actions/attest-build-provenance@e8998f9...4d10147)

Updates `aws-actions/configure-aws-credentials` from 4.3.1 to 6.3.0
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](aws-actions/configure-aws-credentials@7474bc4...e125382)

Updates `actions/download-artifact` from 4.3.0 to 8.0.2
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@d3f86a1...9000827)

Updates `actions/setup-python` from 5.6.0 to 7.1.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@a26af69...6d4fd22)

Updates `actions/setup-node` from 4.4.0 to 7.1.0
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](actions/setup-node@49933ea...949feb2)

---
updated-dependencies:
- dependency-name: actions/attest-build-provenance
  dependency-version: 4.2.2
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/download-artifact
  dependency-version: 8.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/setup-node
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/setup-python
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: sigstore/cosign-installer
  dependency-version: 4.1.2
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(gateway): release a merged plan task's own dependents via its ticket's plan link (#719)

* A merged plan task releases its own dependents, found through its ticket's plan link

After a pull request merged, the tasks waiting on its plan task were found
by issue number alone: the first task row in any of the team's plans with
the run's issue number. A Jira ticket's run records issue number 0, so a
merged Jira task never released its own dependents and could release those
of a task with no issue yet, in any plan. GitHub issue numbers repeat
across repositories, so a merge in one repository could release the
dependents of a task in another.

The merged run's task is now found through its ticket's plan link, the
settings row the plan wrote when it opened the ticket (repository and
issue number, or Jira key), and issue number 0 never names a ticket. A
merge whose ticket has no plan link releases nothing.

* Without a plan link, a merged task is found by the ticket its task row records

The link from a ticket to its plan task is written best effort, and plans
from before links existed have none. A merge on such a task released
nothing, so its waiting tasks stayed waiting.

Without a link, the merged run's task is now the task row that records the
same ticket: the repository and issue number from the issue's URL, or the
Jira key. Never issue number 0 and never a number alone. The search stays
in the run's plan when the run names one, otherwise covers the team's
plans, and a ticket that more than one task names releases nothing. The
link is still looked up first.

---------

Co-authored-by: Shoyu <shoyu@hmdnyc-v29dlvcg.tail1a3f79.ts.net>

* Pin the dashboard for the November 17 test-run release (#771)

* Find each pull request's preview wherever it is published (#772)

The preview was found only through a workflow CoderHelm recognized, an
address whose host said "preview", and a deployment's first status of any
state. A host that publishes its preview through deployments, deploy
statuses, check runs or a bot comment was read as having no preview, a
protected preview could not be opened, and a preview still building was
waited on with no limit.

- common::preview_find reads every route a preview is published on
  (deployment statuses, commit statuses, check runs, bot comments edited in
  place, the description, the team's address template), counts only what is
  tied to the head commit first, picks the changed app's preview in a
  monorepo, and gives one answer: up, building, failed, or nothing.
- preview::settle bounds the wait: a short grace when nothing is
  published, a pending preview looked at every two minutes, at most an hour
  per commit, and a failed or taken-down deploy said with its source.
- common::preview_access and /api/repos/:owner/:name/preview-access: one
  per-repository Settings item holding the address template and a sealed
  secret (header lines, query parameters or a password) that the capture
  sends only to the preview's own host.
- The capture keeps a preview's path, retries pages still warming up, and
  reads a sign-in wall (401, 403, or a redirect to another host) as a wall
  that points to the setting.
- Replay tests with payloads shaped like the code host's listings and
  common preview bots' comments, one per route.

* Fill the Before and After table from the end-to-end run's screenshots

CoderHelm's own pull request now shows the screenshots its end-to-end run
already took, instead of "No screenshot".

- common::e2e::shots reads the images Cucumber JSON embeds, Playwright
  JSON attaches and Playwright's HTML report keeps under data/, keyed by
  the test's id, and picks the test that shows the change: one the change
  edits, one the test map ties to the changed files, or one whose name
  shares a word with a changed UI file.
- e2e_screens keeps that test's screenshot on the head and on the default
  branch's newest passing run in the install's own bucket, records it for
  the head and rebuilds the description.
- The table links each image through the API with a signed link that
  works for a year (GET /webhooks/ci/tests/screenshot); the bucket keeps
  the images 395 days.

* Say why a screenshot's test was picked, and pass clippy

The reason names the test, not only its name (the match reads its title
and file); an empty Before cell says no passing run on the base kept one
rather than "yet"; the caption gives the reason before the run links.
Formatted, and two iterator and one slice lint fixed.

* no-mistakes(review): Claim head record, use PR base, align record TTL

* no-mistakes(review): Upload screenshots before claiming the head record

* no-mistakes(review): Detect lost claim race with the typed DynamoDB error

* Format the screenshot fixes with cargo fmt

* no-mistakes(review): Pick screenshot test against PR base, fetch PR once

* no-mistakes(document): Format is_own_pr with cargo fmt

* Keep end-to-end screenshots on the screenshots ref, under the preview's pages

Review asked for one hosting model and for the pair not to hide the
preview's page captures.

- The Before and After images are committed to refs/coderhelm/screenshots
  beside the preview's captures and linked by commit, so only people who
  can read the repository see them. The public screenshot route, its
  signed links, the bucket copies and their lifecycle rule are gone.
- preview::keep_on_ref is the one way both write that ref: blobs, a commit
  on top of the ref, and a move without force (advance_own_ref), tried
  again on top when another writer moved it, so no writer's commit is
  dropped and no image link breaks.
- The pair is its own fact (e2e_screens), rendered as a table under the
  preview's pages and never instead of them; it takes the place of a "No
  screenshot" line. The preview's pages now win over a set screens table.
- An ingest reads the pull request only when it needs it: a failure on a
  branch that is not CoderHelm's shape, or a report that carries
  screenshots. CiReports gets the run's real attempt.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Shoyu <shoyu@hmdnyc-v29dlvcg.tail1a3f79.ts.net>
Co-authored-by: Nam Bok Rodriguez <nambok@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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