Skip to content

feat(finalize-pr): a preview link must open on data - #159

Closed
Ardnived wants to merge 2 commits into
mainfrom
claude/preview-links-open-on-data
Closed

Ardnived wants to merge 2 commits into
mainfrom
claude/preview-links-open-on-data

Conversation

@Ardnived

@Ardnived Ardnived commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A Preview link must now land on data that shows the change, and the body carries any file the reviewer must supply.
  • Reason: SahajCloud#874's links opened a database holding only the preview admin, and the PR named a CSV that does not exist.
  • One exception to push-and-end: a run may wait, with a time limit, for the preview to deploy, so the run that opens a PR can seed it.

Change outline

Behaviour — what finalize-pr step 7 asks of a Preview link

 finalize-pr step 7, Preview                       workflow/skills/finalize-pr/SKILL.md
   host:  PR-number pattern | discovered branch alias
   path:  the changed route, 2–4 deep links
+  data:  read back what each link needs, signed in; link a document by id
+         missing → run previewUrl.seed (smallest set, never real people's contact details)
+  input: a file the change takes → inline <details>, or a path git ls-files lists
+  none yet (new PR, or this push not deployed) → step 7b, then seed + verify
+  can't  → one line naming what is missing

Behaviour — step 7b, the one wait the pipeline allows

 finalize-pr after open/refresh                    workflow/skills/finalize-pr/SKILL.md
-  push and end; never wait
+  7b, only when step 7 needs the new build (no data yet, or this push changes a linked page):
+    read the deploy status on the head SHA        # Railway commit status / Cloudflare check run
+    every preview.pollSeconds, ≤ preview.deployWaitMinutes, one background sleep, no CI reads
+    success → seed, verify, one body update
+    failure | timeout → "Data: not seeded yet", report what it last saw, end
 hard rule: never wait for CI                     + the one wait is 7b's preview deploy

Behaviour — who checks it

 implement-issue step 10   review aids             + each link opens on data
 pr-template ## Preview    placeholder             + seeded data; reviewer inputs in <details>
 adversarial-review        gather context, step 2  + open each Preview link signed in;
                                                     a link on no data → should-fix

Contract — new keys

 .claude/workflow.json  previewUrl                 (per repo)
   pattern: "https://…-pr-{pr}.up.railway.app"
+  seed:    how to fill this repo's preview with data   # finalize-pr step 7

 loop-config.json                                  (loop-wide)
+  preview: { deployWaitMinutes: 20, pollSeconds: 60 }  # finalize-pr step 7b

No repo sets previewUrl.seed yet. Until one does, step 7 takes its cannot seed branch: it writes one line saying what is missing, so a link never lands on nothing silently. The SahajCloud key should follow in its own PR. .claude/workflow.json is a protected path, so it needs an attended session.

Test results

  • Lean gate: ✓ claude plugin validate ./workflow --strict
  • rule-delta.mjs --base main workflow/skills: 62 → 64 directives, 2 added, none removed
  • node --test dispatcher/test/*.test.mjs: 0 failed
  • Version: 2.7.0 → 2.8.0

Notes for reviewer

Check the exception to #push-and-end. A Railway host builds only after its PR opens. So the run that opens a PR had to wait for the deploy, or the preview would stay empty until some later run happened to refresh the body. The wait is in step 7b and is limited three ways: it runs only when step 7 needs the new build, it has one waiter, and it reads only the deploy status, never CI. 20 minutes fits inside the shortest lease of a run that calls finalize-pr (address-review and fix-ci, 60). preview is a new value, not a ceilings change, so the skill-and-ceiling split does not apply.

What #874's preview showed once seeded. Running a German CSV through the import put 9 of 13 offline lines in the wrong town (Köln → Greven, Regensburg → Ennepetal). That is reported on #874 itself. The point here is that no reviewer could have seen it.

Detail

Why the critic, not a new handler. The critic already reads the body first and runs once the preview has built. One more check there costs one paragraph. A deploy-triggered seeding handler would be a new event path in dispatcher.yml that runs in all five repos.

Pre-existing, not fixed here. Step 7 cites docs/why.md#construct-a-number-discover-a-slug, and docs/why.md has no such heading.

🤖 Generated with Claude Code

SahajCloud#874 shipped eighteen phases with Preview links into a database
that held only the preview admin, plus a manual-verification step naming a
CSV fixture that was never committed. The link rule checked the host and
the path, never whether the page showed the change.

finalize-pr step 7 gains "Every link opens on data": read back what each
link needs, seed what is missing with `previewUrl.seed`, carry the
reviewer's inputs in the body, and say so in one line when a link cannot
be backed by data yet. implement-issue step 10 and the PR template point
at it, and adversarial-review opens each Preview link and flags one that
shows nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Railway host builds only after its PR opens, so the run that opens a
PR could never seed it, and a single-phase PR with a clean critic has no
later run before a human reads it. Step 7b allows the one bounded wait:
read the deploy status on the head SHA every `preview.pollSeconds`, for
at most `preview.deployWaitMinutes`, with one waiter and no CI reads.
Then seed, verify and refresh the body. On timeout, the
`Data: not seeded yet` line stands.

docs/why.md#push-and-end records the exception and why it cannot turn
back into the CI polling that rule replaced.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ardnived added a commit that referenced this pull request Oct 12, 2026
#164 and the commits that built it assumed no mcp__github__* tool returns
a commit status, so the dispatch record was a session's only route to a
failing preview's link. That is wrong: `pull_request_read
method:get_status` returns the head's commit statuses, Railway's
included — merge-gate.mjs's header and docs/why.md's rung-1 history
already say so, and #159's step 7b reads the deploy status the same way.

It mattered for trust, not reach. A deploy pass read the deployment the
record named, so a forged or stale record could aim a token at another
deployment it reaches. Step 1 of deploy mode now keeps only a link that a
failing status from get_status also carries. The comments in fire.mjs,
merge-gate.mjs, railway.mjs and the why.md entry stop claiming the record
is the only route.

Refs #164

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ardnived added a commit that referenced this pull request Oct 12, 2026
…deploy pass

#159's step 7b sent a failed preview deploy "to fix-ci through CI". A
Railway preview is a commit status the ruleset does not require, so it is
not CI: it reaches the dispatcher as an advisory, which now links the
deployment and, once railway.readLogs is on, fires a fix-ci deploy pass
(#164). Step 7b says so, so a run that times out on a red preview does
not go looking for a CI repair that will never be fired.

The foreground-sleep refusal step 7b works around is Claude Code's, not
one of this plugin's hooks; the line now says which.

Refs #159

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived

Copy link
Copy Markdown
Contributor Author

Folded into #186, rebased onto the current tree: its two commits are there unchanged in intent, ported to the renamed skills (implement-issue → implement-ticket, adversarial-review → review-pr), plus one commit that hands a failed deploy in step 7b to the dispatcher's new deploy pass (#164). The branch is left in place.

@Ardnived Ardnived closed this Oct 12, 2026
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Oct 12, 2026
Ardnived added a commit that referenced this pull request Oct 13, 2026
#164 and the commits that built it assumed no mcp__github__* tool returns
a commit status, so the dispatch record was a session's only route to a
failing preview's link. That is wrong: `pull_request_read
method:get_status` returns the head's commit statuses, Railway's
included — merge-gate.mjs's header and docs/why.md's rung-1 history
already say so, and #159's step 7b reads the deploy status the same way.

It mattered for trust, not reach. A deploy pass read the deployment the
record named, so a forged or stale record could aim a token at another
deployment it reaches. Step 1 of deploy mode now keeps only a link that a
failing status from get_status also carries. The comments in fire.mjs,
merge-gate.mjs, railway.mjs and the why.md entry stop claiming the record
is the only route.

Refs #164

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ardnived added a commit that referenced this pull request Oct 13, 2026
…deploy pass

#159's step 7b sent a failed preview deploy "to fix-ci through CI". A
Railway preview is a commit status the ruleset does not require, so it is
not CI: it reaches the dispatcher as an advisory, which now links the
deployment and, once railway.readLogs is on, fires a fix-ci deploy pass
(#164). Step 7b says so, so a run that times out on a red preview does
not go looking for a CI repair that will never be fired.

The foreground-sleep refusal step 7b works around is Claude Code's, not
one of this plugin's hooks; the line now says which.

Refs #159

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ardnived added a commit that referenced this pull request Oct 13, 2026
#186)

* fix(loop): run the lib test suite in the lean gate, and pass it from a worktree

`workflow/lib/*.test.mjs` held 57 tests that no gate, skill or doc named, so
the scripts that own the loop's mechanical rules (budget.mjs, payload.mjs,
base-ref.mjs) had regression tests that never ran. Two of them also failed
inside `.claude/worktrees/<slug>` — where implement-ticket works by default —
so the one command a run would reach for to check its own change reported
failures that were not its own.

The two failures asserted the environment, not the function:
`defaultAttachedDir()` resolves three levels up from its module, which is
the checkouts directory only from the checkout. Its one caller is its own
CLI, run by start-run step 2 from the checkout before any worktree exists,
so the function is checkout-only and stays as it is. The path-math test
keeps its assertion and drops the existsSync; the attached-check test now
builds a fixture root (mkdtemp plus an empty claude-workflow directory, as
base-ref.test.mjs does) and also asserts that a missing checkout is
refused. Seen red with the existsSync check disabled.

Then the gate (decision 1A): `leanGate.command` gains
`node --test workflow/lib/*.test.mjs` after the validator, and
`leanGate.contents` stops saying there is no test suite. The ticket orders
the gate edit after the test fix because a gate merged alone would turn
every worktree run red; both land in this one PR, so main never sees the
gate without the fix. `.claude/workflow.json` is a protected path, edited
attended.

57/57 pass from the checkout and from a worktree.

Closes #176

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(comments): a glob's ** spans any depth, and K5 protects Storybook's descriptions

globToRe rewrote `**/` to `(.*/)?` and then rewrote every `*`, including
the two inside the group it had just written, giving `(.[^/]*/)?`: one
path segment at most. Every story file in both repos sits two or three
segments deep, so K5 (`**/*.stories.tsx`) has matched 0 of their 120
story files since it was written. globToRe now converts in one pass, so
`**` spans any depth. The separate denyPaths converter already handled
depth and is left alone; the two converters duplicate each other.

The comment sweep's rule 1 deletes a comment that restates a name, and
that is exactly what a Storybook reference page prints for a component
and for each prop row (`/** Button size @default 'md' */` on `size`).
K5 becomes that guard: renamed off Ladle; widened from stories files to
the component trees (components/, src/components/, src/views/, and
**/*.stories.tsx anywhere: 183 files in WeMeditateWeb and 162 in
SahajAtlasWeb, every story file included, plus SahajCloud's 97
components, which is fail-safe); narrowed from `^` to a docblock; and
`position`, which nothing read, is dropped. comment-sweep.md's "Never
delete" list now names the category.

Fixing globToRe revives K5 for the first time, and that is intended:
the verifier now reports a PROTECTED VIOLATION when a sweep deletes a
docblock in one of those files, where it reported nothing before
(checked on WeMeditateWeb's Button.tsx: K5 13 to 12). The docblock-only
pattern keeps it from firing on every deleted `//` comment there, which
`^` would have done.

The globs stay under the existing `pathGlob` key, which now takes a
string or an array, rather than a new `pathGlobs` key. comment-sweep.mjs
builds the codemod's KEEP list from the rules without `pathGlob`, so
under a second key K5 would have joined it and stopped tier 2 collapsing
any docblock in any file. One key leaves comment-sweep.mjs and its
behaviour unchanged. A test pins this.

comment-protect.test.mjs (21 tests, over paths and fixture text only, so
it needs no typescript) covers each case. Every test was seen to fail
against the pre-change code or a reintroduced defect. The remaining
Ladle mentions in finalize-pr and docs/cleanup.md now name the Storybook
library.

Refs #180

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(loop): pin the one Storybook version the libraries install

WeMeditateWeb and SahajAtlasWeb are moving their component libraries
from Ladle to Storybook, and SahajCloud#915 follows. Each installs
Storybook in its own repo, so without one shared value the libraries
drift onto different versions and their component manifests stop being
comparable. loop-config.json now holds that value, storybook.version,
for each library child and SahajCloud#915 to read when they install.

10.6.1 is the version SahajCloud#902 records as settled and build-tested
on Node 22.17.0. The block holds the value only: the rule that reads it
lives in the library children's own skills and setup, and the story
stays in SahajCloud#902. No `projects` key yet; the agent-connector
child adds it beside the version when it ships.

Revertable on its own: nothing reads the key until a library child
lands.

Closes #180

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(loop): a goal whose children were all withdrawn verifies as if they shipped

When a roadmap goal's last child closes, the dispatcher fires revise-roadmap
in verify mode. It read each child's state and never its state_reason, so a
set closed entirely as not planned looked the same as one that shipped. On
sydevs/SahajCloud#897 three children were withdrawn ("this feature restarts
from the roadmap goals") and the verify run went looking for merged PRs that
never existed.

The fire is kept: a withdrawn set leaves the Technical notes block claiming
work is built, and only a session can rewrite it. What was missing is the
fact. Now:

- gather.mjs carries each child's stateReason from the sub-issues response.
- decide.mjs computes the verify flags in one helper, verifyFlags, read by
  both fire sites (child-closed, and the verifyDue path on unlock), so the
  lock can no longer decide whether the fact survives. withdrawn: true only
  when every child closed as not_planned; a mixed set keeps today's verify.
- fire.mjs buildRecord and workflow/lib/payload.mjs both whitelist flags to
  onDemand/delegated/mode, so a bare flag on the plan never reached the
  session or the dry-run record line. Both now carry withdrawn, as true or
  absent, so every other record keeps its exact shape.
- revise-roadmap's Verify section tells a withdrawn run to report the goal
  unstarted, correct the notes block, tick nothing and close nothing.
- docs/why.md gains the withdrawn case beside a-goal-is-verified-not-assumed.

Tests: both fire sites agree for an all-withdrawn and a mixed set; gather
carries stateReason; a dry-run act prints withdrawn in the record and writes
nothing; payload carries withdrawn only as true.

Closes #184

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(dispatcher): verify fires twice when children close together

When a roadmap goal's children close seconds apart, each closure is its own
act leg. One leg reads every child closed and fires verify. A sibling leg
that gathers after the lock is on re-arms verifyDue, because it cannot tell
the verify it would wait for from any other handler holding the lock. The
verify's own unlock then consumes the flag and fires verify again. On
sydevs/SahajCloud#897 the second run started ten minutes later under a fresh
lease, found the work done, and wrote nothing. Closing children together is
the normal shape, so every completed goal paid for a wasted session.

Fixed at the consumer, as the ticket proposes. On unlock, record.current is
still the session that is ending. If it was revise-roadmap in verify mode and
every child closed at or before it fired, the re-armed flag is cleared and
nothing fires. The comparison is by timestamp, so a child reclosed during
the run still gets its check. Guarding the producer alone is not enough:
apply writes the lock label before rec.current, so a leg gathering in that
window re-arms anyway.

gather.mjs carries closedAt from the sub-issues response. The comparison
uses Date.parse, since GitHub's closed_at has no milliseconds and firedAt
does, and plain string order misreads the same second. A child with no
closedAt counts as not yet verified, which fires: a duplicate verify is
idempotent, a missed one is not.

Unlike the ticket's sketch, the skip does not return early. It falls through
to the ordinary unlock, so a verify that left a gap still ends with the goal
awaiting, exactly as an unlock with nothing re-armed would. An early return
would have dropped that label in the race case only. When the unlock path
does fire, it still uses verifyFlags, so #184's withdrawn flag rides on it.

The deadline path is untouched: a verify that times out is re-fired from
rec.current with its own flags, which a new act test now pins.

Closes #185

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(loop): strip a Blocked by line once it becomes a relationship

The dispatcher turned a `Blocked by:` line into a native relationship and
left the line in the body, a second copy that drifted from the first. Every
later `issues.edited` pass read it again, so a blocker a reviewer had cleared
was re-POSTed, with `blocked` re-applied, on the next unrelated body edit. A
struck line made it worse. `- ~~Blocked by: …~~` read as live, because the
strike test ran before the bullet came off.

Now the pass that makes the relationship deletes the line:

- markers.mjs: `stripBlockedBy` is pure and sits beside `parseBlockedBy`,
  sharing its line test. It drops a line only when every in-org target on it
  is related. Every other byte stays, CRLF included. The blank run a drop
  leaves collapses to one, and an emptied `## Notes` heading stays.
- apply.mjs: the `relationships` case collects the targets that ended related
  (already present in any state, or POSTed without error), re-reads the body
  and PUTs the stripped copy. It never builds from the gathered snapshot:
  `issues.edited` takes no lock, so a session may have rewritten the body
  since `gather`. A dry run logs the lines and writes nothing. A failed strip
  is logged and leaves the line for the next edit.
- gather.mjs: `blockedByAll` carries every relationship, closed blockers too,
  so a line naming a closed blocker is stripped, not re-POSTed.
  `blockedByOpen` is unchanged.
- decide.mjs: only the two body passes, `issues.opened` and `issues.edited`,
  ask for the strip. Both already refuse a non-member's own line. A
  `block on` verb's targets come from a comment, so a member's verb never
  strips a stranger's line.
- The bullet now comes off before the strike test, so a struck list item is
  skipped and `- **Blocked by sydevs/X#9.**` still reads. `parseRecheck`
  keeps its test, with a note that a list item never reaches it.

There is no sender filter. The strip's own edit fires `issues.edited`, and
that echo pass finds no marker and stops. The story is in
docs/why.md#a-converted-blocker-line-is-deleted.

Closes #178

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(loop): the skills treat a Blocked by line as write-only

The dispatcher now deletes a `Blocked by:` line once its relationship
exists, so three skills described behaviour that no longer holds.

- format-ticket: the line is converted, then deleted. A deleted line is
  never restored, because a run that puts one back re-creates the drift the
  strip removes. The note that a struck-through line is skipped is gone. It
  was the only place any skill spelled a strike, and that is how a run came to
  improvise one as a "clear" on sydevs/SahajAtlasWeb#266. It is replaced by
  the rule: never strike a line, because a blocker clears when its issue
  closes or a person removes the relationship.
- write-ticket: "keep every `Blocked by:` line" now means every unconverted
  line. A revise that finds the line gone has nothing to put back.
- implement-ticket: the dispatcher's own check covers the open native
  blockers as well as the `blocked` label. Reading the body only catches a
  line it has not converted yet.

The failure this prevents is a session that reads the old prose, sees the
line missing, and writes it back. That is one more echo pass at best. At
worst it revives a blocker a person has already cleared.

rule-delta: directives 87 → 87, none removed.

Closes #178

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(loop): a recheck names the blockers that cleared

The previous commit deletes a `Blocked by:` line once it becomes a
relationship. write-ticket's recheck mode found why a ticket waited by
reading that line, and a session cannot read native relationships
(#3), so by the time the last blocker closed, a recheck session had
nothing left in the body to check.

The dispatcher already holds the answer: `unblock-check` gathers every
blocked-by relationship. The recheck fire now carries the closed ones as
`flags.cleared` (`owner/repo#N`), buildRecord passes them through only
when present, and payload.mjs keeps only well-formed refs, so the field
can carry a reference and never instructions. write-ticket step 1 reads
it in place of the line. A date park names no blocker and is unchanged.

Found by the run that implemented #178.

Refs #178

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(dispatcher): carry a failing deploy's link to the advisory comment and the record

A failing Railway preview reached the loop as a bare context name. gather
dropped the commit status's target_url, requiredOnly reduced each advisory
row to a string, and buildRecord sent only {green, reason}. GitHub held the
deployment link and no session could reach it: no mcp__github__* tool
returns a commit status. So the advisory comment named `sahajcloud -
SahajCloud` and nothing more, and a fix-ci session on the same head could
not see the deployment at all.

Now each status row keeps target_url and description, requiredOnly returns
advisory rows as {name, kind, targetUrl} (a status's target_url, a check
run's details_url), the advisory comment links each name to its deployment,
and the dispatch record's ci carries advisory. The commentOnce key is still
built from names alone, so no advisory note already posted is posted again.

A target_url is whatever its poster set, so only an https URL is linked,
with parentheses escaped so the Markdown link cannot end early. Nothing here
reads Railway or needs a credential.

Failure prevented: a reviewer sees "sahajcloud - SahajCloud failed" and has
to go find the deployment by hand, and a session has no route to it at all.

Refs #164 (phase 1)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(loop): parse a failed preview's deployment id and build its log read

Phase 1 carries a red Railway status's target_url into the record's
ci.advisory. That link holds the deployment id, and the deployment id is
what Railway's buildLogs and deploymentLogs queries take. Nothing parsed
it, and nothing said which statuses are Railway's or where the token lives.

Adds a `railway` key to loop-config.json, beside `sentry`: apiBase,
tokenEnvVar (the maintainer chose a project token, option A on #164),
statusContexts (`sahajcloud - SahajCloud`), and logLines. Adds
workflow/lib/railway.mjs: deploymentFrom() parses the one link shape
observed on SahajCloud#879, every id a UUID, https on railway.com or
railway.app only, since a status link is whatever its poster set.
failedDeploys() picks the advisory status rows the config lists.
readPlan() and the CLI give a session the apiBase, the header, whether the
token is set (never its value), and one GraphQL request per deployment
reading both its build log and its runtime log: a preview can build
cleanly and then fail its healthcheck.

The script never fetches and holds no credential. The session sends the
request, so the rule that no script here opens a connection still holds.
Nothing fires it yet; phase 3 does.

routine-setup.md names the token by its config key, not by spelling it,
and warns that Railway scopes a project token to one environment while
each preview runs in its own, with the two calls that check it.

Failure prevented: a session that has the deployment link still cannot
turn it into a log read without guessing the URL shape and the query.

Refs #164 (phase 2)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(loop): a failed Railway preview gets one fix-ci pass that reads its log

With phases 1 and 2 the record carries the failed preview's link and a
script turns it into a log read, but nothing starts a session to do the
read. A red status the ruleset does not require fired nobody, so a broken
preview build was said once and then left to the reviewer.

decide: when required CI is green and an advisory row is a preview that
railway.statusContexts lists, with a link that parses, the plan is the
advisory note plus fix-ci with flags.mode "deploy". There is no bumpFixCi
and no fixCi write, so the pass spends nothing against
ceilings.ciFixIterations or ciInfraReruns, and no ceiling value changes.
It fires once per head. The key reads record.current as well as
dispatches: the unlock that ends the pass is decided before apply moves
current into dispatches, and fire-time entries carry no flags, so keying
on ended entries alone would fire a second pass at that unlock.
endedFixCiFor now skips deploy passes, so a deploy pass on a head never
stands in for a repair pass there. No pass fires mid-phases, where the
next phase may be what fixes the build.

fix-ci/SKILL.md: a Deploy mode section. It carves the two standing rules
out (the advisory preview is this run's subject, and the dispatcher cannot
re-run it), runs railway.mjs, and degrades with no token to one comment
with the link plus a journalled missing credential. It reads the logs with
curl, since Railway is not GitHub, and names the token only through
railway.tokenEnvVar. A cause in the repo is fixed and pushed. A cause
outside it gets one comment naming the log line. A new hard rule: never
redeploy, restart or change anything on Railway, a vendor write. No new
allowed-tools grant: Bash(*) already covers curl, jq and printenv.
rule-delta: 87 -> 88 directives, nothing removed.

Failure prevented: on 2026-10-07 three SahajCloud previews failed while
the required tests passed, and the loop spent passes blind or said nothing.

Refs #164 — the ticket stays open until a token is shown to reach a preview and railway.readLogs is on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(loop): bump the plugin cache key to 3.3.0

This PR changes workflow/skills, workflow/lib and adds a fix-ci mode, a
new capability, so the minor moves (cut-release/SKILL.md). An unchanged
version keeps every installed plugin on its cached skills however far
main moves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(dispatcher): a stood-down fix-ci is not fired again by its own unlock

endedFixCiFor looked for an ended fix-ci on the head in `dispatches` alone.
The unlock that ends a session is decided before apply moves `current`
into `dispatches`, so at that moment only the fire-time entry is there,
with no outcome. A pass that commented and stood down without pushing
therefore met red CI on the same head, and the unlock planned
`bumpFixCi` plus another `fix-ci` — the SahajAtlasWeb#245 loop, by a
second route, spending a ceilings.ciFixIterations pass each time.

The existing test passed only because it set `current: null`, which is
never the record an unlock sees. The ending session in `current` now
counts as ended, the way deployPassFor already reads it. A pass that
pushed has moved the head, so it still gets its repair. Seen red with
the `current` read removed.

Found while building the deploy pass for #164.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(loop): a deploy pass confirms its preview link against get_status

#164 and the commits that built it assumed no mcp__github__* tool returns
a commit status, so the dispatch record was a session's only route to a
failing preview's link. That is wrong: `pull_request_read
method:get_status` returns the head's commit statuses, Railway's
included — merge-gate.mjs's header and docs/why.md's rung-1 history
already say so, and #159's step 7b reads the deploy status the same way.

It mattered for trust, not reach. A deploy pass read the deployment the
record named, so a forged or stale record could aim a token at another
deployment it reaches. Step 1 of deploy mode now keeps only a link that a
failing status from get_status also carries. The comments in fire.mjs,
merge-gate.mjs, railway.mjs and the why.md entry stop claiming the record
is the only route.

Refs #164

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(finalize-pr): a preview link must open on data

SahajCloud#874 shipped eighteen phases with Preview links into a database
that held only the preview admin, plus a manual-verification step naming a
CSV fixture that was never committed. The link rule checked the host and
the path, never whether the page showed the change.

finalize-pr step 7 gains "Every link opens on data": read back what each
link needs, seed what is missing with `previewUrl.seed`, carry the
reviewer's inputs in the body, and say so in one line when a link cannot
be backed by data yet. implement-issue step 10 and the PR template point
at it, and adversarial-review opens each Preview link and flags one that
shows nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(finalize-pr): wait for the preview deploy when step 7 needs it

A Railway host builds only after its PR opens, so the run that opens a
PR could never seed it, and a single-phase PR with a clean critic has no
later run before a human reads it. Step 7b allows the one bounded wait:
read the deploy status on the head SHA every `preview.pollSeconds`, for
at most `preview.deployWaitMinutes`, with one waiter and no CI reads.
Then seed, verify and refresh the body. On timeout, the
`Data: not seeded yet` line stands.

docs/why.md#push-and-end records the exception and why it cannot turn
back into the CI polling that rule replaced.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(finalize-pr): step 7b leaves a failed deploy to the dispatcher's deploy pass

#159's step 7b sent a failed preview deploy "to fix-ci through CI". A
Railway preview is a commit status the ruleset does not require, so it is
not CI: it reaches the dispatcher as an advisory, which now links the
deployment and, once railway.readLogs is on, fires a fix-ci deploy pass
(#164). Step 7b says so, so a run that times out on a red preview does
not go looking for a CI repair that will never be fired.

The foreground-sleep refusal step 7b works around is Claude Code's, not
one of this plugin's hooks; the line now says which.

Refs #159

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(loop): a workspace token reads the preview logs, and the pass is always on

Railway's project-token form offers production or one existing preview
environment, never "any preview" (confirmed by the maintainer,
2026-10-12). Every PR gets a new environment, so a project token can never
reach the next preview. Only a workspace token can, and it authenticates
as `Authorization: Bearer`, not `Project-Access-Token`. The maintainer has
set one in the routines' cloud environment as RAILWAY_TOKEN.

So the deploy pass reads with that header and that variable name, and
nothing switches it off: a red preview with green required CI on a bot PR
always earns one read. With no token, or a refusal from Railway, the pass
comments the link and stops, as before.

fix-ci's deploy mode drops from five steps to four: the no-token case and
the Railway-error case are the same comment, so they are one step.
routine-setup.md §4 and the why.md entry say why a workspace token is the
only kind that works here, and that it reaches production too.

Closes #164

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant