Skip to content

feat(access): derive the routing mode on the server, so the widget stops taking it from the script URL - #774

Merged
sydevs-bot merged 15 commits into
mainfrom
claude/feat-644-derive-routing
Sep 14, 2026
Merged

sydevs-bot merged 15 commits into
mainfrom
claude/feat-644-derive-routing

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The CMS now observes whether a host can path-route, instead of believing the widget's self-report. A second render probes <canonical.embed>/<random-token> plus a control at the origin root.
  • The verdict lands in canonical.verification.routingProbe, and it is the record's only routing answer — verified.routing is no longer written at all.
  • Every reader spells it verification?.routingProbe?.verdict ?? 'query'. There is no accessor in between: the default is applied on the read path by the canonical.routing afterRead hook, and by hand at the sites that never read through Payload.
  • The widget reads it from a virtual canonical.routing field — no new endpoint, no new select key, no migration.
  • No operator can type a routing mode, and no script parameter can assert one.

Changes

  • src/lib/embedVerification/verifyEmbed.ts — routingProbeUrls (both URLs derived from the mount key, in one place) and probeRouting, plus the shared probeForOutcome render gate. The probe's two renders start together — see the review rounds below.
  • src/lib/clients/verification.ts — nextRoutingProbeState (the ladder) and ROUTING_PROBE_FAILURE_LIMIT, plus the doc block that states how to read the verdict.
  • src/lib/atlas/canonicalUrl.ts — canonicalTargetForHost takes routing as a required second argument, so passing a VerifiedEmbed straight in no longer compiles.
  • src/jobs/VerifyEmbeds/VerifyEmbeds.ts, src/collections/Clients/endpoints/verifyEmbed.ts — both fold the verdict in through the same gate, in one pass and one write.
  • src/components/admin/CanonicalEmbedPicker/model.ts — both sample branches read the derived verdict, so the picker's preview is the shape the resolver emits.
  • DEPLOYMENT.md, docs/rules/api-clients.md — the post-deploy step the no-backfill decision needs, and where the default lives.

Review round 3 — the reader (2026-09-13)

  • Adopted — delete effectiveRouting and move ?? 'query' into the call sites (5bebd53). The function is gone. Six readers now spell the verdict out, and only one of them is on a read path: the canonical.routing afterRead hook, which is what the widget reads. The rest hold the verification object they are about to write or have just written (VerifyEmbeds, the verifyEmbed endpoint), or read the row through their own select, which does not run the hook (canonicalOwnerFrom, the picker).
  • Same answer settles stored, not computed. canonicalOwnerFrom now reads verification.routingProbe.verdict with nothing in between.

No behaviour changed. The unit specs that asserted through the function read the stored verdict directly now; the read-path default stays pinned by client-canonical.int.spec.ts, which already asserts canonical.routing is query for an unprobed row.

Review round 2 — naming (2026-09-12)

Three review comments, one commit each. All three are renames: no behaviour changed, and nothing carries the stored key yet, so no row is stranded and no migration appears.

  • Adopted — strikes reads better as failedAttempts (338e9dd). The counter now says what it counts, beside the attempts log it is about.
  • Adopted — pathProbe should name the question, not one answer (4dd1ac0). The stored key is routingProbe, and the symbols follow: ROUTING_PROBE_FAILURE_LIMIT, RoutingProbeResult, RoutingProbeDeps, nextRoutingProbeState, routingProbeUrls, and probeRouting — which answers which routing a host supports, not only whether path works. A second routing shape can ride the same ladder without a third name.
  • Adopted — effectiveRouting should just be routing (e72b0ce). ⚠ The name was free but not unclaimed: feat(access): add embed metadata and canonical ownership to Clients #633 deleted a hand-typed routing field and a spec pinned its absence by name. That spec now pins what the deletion actually protected — the field is virtual (no column for a write to land in), admin-readonly, and hook-computed. Verified by removing virtual and watching it fail.
  • Adopted — two routing fields is one too many (a030a1a). The verifier stops writing verified.routing, so routingProbe is the record's only routing answer. The key stays in the schema as an optional legacy property: verified is closed and validated on every save, so deleting it would strand every row verified before this change.

Still open: should the probe and the mount verification be one process? Answered in a comment below rather than guessed at — they already share one pass and one write, and what is deliberately separate is the counter and the render gate. The one thing that would change is worth a decision, not an assumption.

Rebutted: a shared ProbeResult type. RoutingProbeResult is flat — a status plus a detail string. VerificationResult is a discriminated union whose arms carry different payloads. Only the word inconclusive is shared, and neither is generated.

Review round 1 (2026-09-12)

The adversarial review left three findings, and the reviewer settled the one question they raised. One commit each.

  • Adopted — the "Verify now" button could exceed the edge's 100s ceiling (40c8376). Three sequential 45s renders on the promote path meant an operator saw a 524 on the very press that promoted them, after the row was written. The probe and control renders now start together: worst case 90s. The verdict logic is unchanged — it still reads the probe first, so promote-on-one and demote-after-three are identical. The cost is the control render on a host that fails the probe, inside the three-per-owner budget this ticket already sets.
  • Adopted — the picker's two sample branches disagreed (4111974). The provisional branch still read mount.routing, so a fresh embed on a host reporting path showed three URL shapes for one unchanged host. Both branches now read the derived verdict. This also removes the last read of a script-URL routing value in the repo, which the first acceptance criterion asks for.
  • Settled: do not backfill — the reviewer's call (d43cc56). Every existing embed has to be verified by hand again, so a backfill is not wanted — and the code never did one. What the decision does need is an operator step, because a service publishing path today reshapes to ?atlas= on the deploy and the nightly job can be 8 days out in backoff. That step is now a DEPLOYMENT.md post-deploy subsection, beside feat(translations): adopt availableLocales, per-locale publish status and the English merge for WeMeditate App #709's, with a one-line pointer from docs/rules/api-clients.md. No behaviour changed.

Preview

Contract impact

src/payload-types.ts gains canonical.routing and canonical.verification.routingProbe, both additive. atlas-url-contract.json is byte-identical: this changes which value selects a URL shape, never the shapes themselves.

The consumer half is named in #644's Downstream impact and is not filed — a ticket needs approval, and the trigger comment authorised one (SahajAtlasWordpress#20, below). sydevs/SahajAtlasWeb still has to drop ?routing= (src/loader/config.ts:99,167), add canonical.routing to ClientSchema, and pass it to mountDecision; it runs pnpm types:cms against main, so it is blocked on this merging.

Filed per the trigger comment: sydevs/SahajAtlasWordpress#20 — a query-routed host's SEO takeover never engages, so core's rel_canonical emits a canonical contradicting the one we publish. Independent of this PR, and the strongest argument for promoting to path wherever the probe can see it.

Migration

None, deliberately. routingProbe is an optional key inside the existing canonical_verification JSONB column and routing is virtual. Verified: pnpm db:migrations:create … --skip-empty wrote nothing.

There is a post-deploy step, though, and it is not a migration. No row carries routingProbe yet, so every service reads query until it is probed. Press Verify now on each enabled canonical owner after this deploys — DEPLOYMENT.md carries the detail.

Test results

  • Lean gate: ✓ pnpm lint, pnpm typecheck, pnpm typecheck:tests, pnpm test:unit (1955 passed) — re-run green on 122d393, after merging main in
  • Targeted specs: ✓ client-canonical (37 passed), ✓ region-canonical-url (24 passed)
  • Each new assertion was reverted against its own fix first and watched fail — a new spec that has never been red is not evidence. The round-2 assertion was checked by deleting virtual: true from the field.
  • Build: N/A (Railway builds the preview)

Manual verification

  1. On the preview, press Verify now on a pretty-permalink WordPress service: it should promote to path, and the picker's sample URL should lose its ?atlas=.
  2. Do the same on a plain-permalink service: it stays query. Three presses against a host that has stopped serving the subtree return a promoted service to query.
  3. Time that press. It should answer inside the edge's 100s ceiling now, not at ~135s.
  4. pnpm tsx scripts/verify-embed-live.ts --self-test still drives all four mount outcomes — it is the only thing that exercises the real Cloudflare API, and every test here stubs the render.

Notes for reviewer

  • The judgement call worth checking is the probe's positive condition. The marker under the prefix and its absence at the origin root. The control is what a host mounting the widget on its own 404 page fails — that site answers every unknown path with a running widget, which is indistinguishable from a working rewrite until you ask for a path outside the mount.
  • canonicalTargetForHost's signature change is the one edit beyond the ticket's stated approach. The ticket said buildCanonicalUrl and canonicalUrlBase are untouched, and they are. But a VerifiedEmbed structurally satisfied the old host parameter, so the circularity this ticket exists to remove still compiled and was held out only by comments. It is now a type error.
  • Known cost, not fixed here: an enabled owner costs 3 renders a night instead of 1, and the probe has no cadence of its own — it rides nextVerifyAt. A separate nextRoutingProbeAt watermark would cut steady-state probe renders several-fold, but it needs a stored column and therefore a migration, which this ticket explicitly rules out. Worth its own ticket.
  • One open question in feat(access): derive the routing mode on the server, so the widget stops taking it from the script URL #644 is still open — whether path routing should be reachable with canonical ownership off. It is not, and not by omission: the widget's prefix is canonical.embed, which only exists once ownership is on. This PR delivers the narrower scope the ticket describes.
Detail

Why the verdict is a sibling of verified, not a key inside it. verified is null until the mount verification first succeeds, and the answer has to survive that null: a client should path-route as soon as its host serves the subtree, whether or not it is publishing canonical URLs yet.

Why its own counter. failureCount becomes disable, which switches canonical ownership off and emails the service's manager. A routing negative means the embed is present and publishing, in ?atlas= shape — a real canonical, and what nearly every client publishes today. Sharing the counter would delete working public URLs over a URL-shape preference.

Why the ladder is asymmetric. A wrong path 404s every deep link and puts dead URLs in the sitemap. A wrong query only produces uglier URLs that work. So: promote on one positive, demote after three consecutive negatives.

Where the query default lives, now that nothing wraps it. On the read path, once: the canonical.routing field's afterRead hook, which is what GET /api/clients/me serves the widget. The five other readers never read the field — two hold the verification object across their own raw UPDATE or their own response (VerifyEmbeds, the verifyEmbed endpoint), and two read the row with their own select, which does not run the hook (canonicalOwnerFrom, the admin picker's two branches).

Render budget. Three per enabled owner (mount, token, control), and exactly one for an owner whose mount verification failed — the widget is not on the page at all, so the subtree cannot be serving it. The control render is no longer skipped on a negative probe: overlapping the two is what keeps "Verify now" under the edge's 100s response ceiling, and the ticket's budget is a ceiling of three either way. A mount carrying a query string is still a negative with no render spent, since canonicalUrlBase refuses that combination anyway. An inconclusive mount render changes nothing and spends nothing.

SSRF surface is unchanged. Both probe URLs come from routingProbeUrls, which parses the stored mount key and rebuilds from url.origin + its normalised pathname, behind the same isFetchableMount http(s) guard the verifier already used. A unit case pins that no URL outside that derivation reaches the renderer, and another pins that the probed URL is byte-identical to what a promoted client would publish.

Why the no-backfill decision is documented outside this thread. The consequence lands on whoever deploys, months from now, not on whoever reads the review. DEPLOYMENT.md already holds one post-deploy step of this shape (#709's translations republish), so this one sits beside it rather than inventing a home.

Review passes. Four cleanup lenses (reuse, simplification, efficiency, altitude) ran over the branch diff; their findings are the refactor(access) commit. Dismissed: a suggestion to drop the endpoint's read-modify-write of the whole canonical group in favour of a two-key patch — the group's other keys are enabled and embed, and getting group-merge semantics wrong there would silently switch ownership off. Also dismissed: merging the two integration job-driver helpers, which would rewrite four passing tests for no behavioural gain.

Closes #644

🤖 Generated with Claude Code

https://claude.ai/code/session_013Y24vyrpNax3tfBwQcKECR

Path routing was configured by `?routing=` on the host's script tag, copied
into the readiness marker, and read back out of `verified.routing` to shape
public canonical URLs. That is circular: the widget was repeating what it had
been asked to do, and nothing could verify it.

The CMS now observes the fact instead. `probePathRouting` renders
`<canonical.embed>/<random-token>` and, only when that carries the readiness
marker, the control `<origin>/<random-token>`. A positive needs the marker
under the prefix and its absence at the origin — the control is what a host
mounting the widget on its own 404 page fails, which looks identical to a
working rewrite until you ask for a path outside the mount.

The verdict lands in `canonical.verification.pathProbe`, a sibling of
`verified` rather than a key inside it: `verified` is null until the mount
verification first succeeds, and a client should path-route as soon as its
host serves the subtree, whether or not it is publishing canonical URLs yet.
`effectiveRouting()` is the one reader, consumed by `canonicalOwnerFrom`, the
admin picker's preview, and the widget through a virtual
`canonical.effectiveRouting` field on the `canonical` group it already selects.

`verified.routing` stays on the record, still written from the marker, and now
shapes nothing.

Two rules the ladder exists to keep:

- Promote on one positive, demote only after PATH_PROBE_FAILURE_LIMIT
  consecutive negatives. A wrong `path` 404s every deep link; a wrong `query`
  only produces uglier URLs that work.
- Its own counter, never `failureCount`. That one becomes `disable`, which
  switches canonical ownership off and emails the manager — and a routing
  negative means the embed is present and publishing, not gone.

No migration: `pathProbe` is an optional key in the existing JSONB column and
`effectiveRouting` is virtual.

Refs #644

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Tg5Wb6XAiBgzxYFYRnpmia
…rdict

Unit: the two probe URLs come off the mount key alone, a query-carrying mount
is a negative with no render spent, the control render is spent only after a
positive, and a control that also carries the marker refuses the promotion.
Plus the ladder — promote on one, demote on the Nth, inconclusive is a no-op,
and the probe's strikes move independently of `failureCount`.

Integration: the job promotes, demotes without touching ownership, counts a
negative without a render when the mount itself failed, and leaves everything
alone on an inconclusive run. A row whose verification predates `pathProbe`
still saves — the column is closed and validated on every save of the document.
The on-demand endpoint is driven once so its wiring is exercised, not just its
helpers.

The three existing `path` fixtures now set `pathProbe`, because a `path` self-
report no longer shapes a URL. `canonical-embed-picker` keeps a case for that
directly: the picker previews `?atlas=` for a client whose marker claims path.

Refs #644

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Tg5Wb6XAiBgzxYFYRnpmia
…nvention

Four findings from the review pass, applied as one:

- `canonicalTargetForHost` takes `routing` as its own required argument. A
  `VerifiedEmbed` structurally satisfied its old `host` parameter, so
  `canonicalTargetForHost(verified)` compiled and shaped a public URL from the
  widget's self-report — the exact circularity this branch removes, held out
  only by comments at three call sites. Every caller now has to say where its
  verdict came from.
- The probe's render classification delegates to `resultFromRender` instead of
  repeating its switch. The failed/inconclusive split is what the whole design
  rests on and is pinned by the live Cloudflare error-code fixtures; a parallel
  copy could drift from it with only one side under test.
- `probeForOutcome` moves beside `probePathRouting` and is shared by the job and
  the on-demand endpoint. The endpoint had restated the gate as a ternary that
  already dropped the `detail` the job attaches.
- The probe's reason is logged at the verdict-change site. It was constructed
  five times and read nowhere, and it is the one thing an operator would want
  when their URLs change shape.

Also: drop the unused `PathProbe` alias, the endpoint's hand-drop of the virtual
field (Payload ignores virtual fields on write — now pinned by the fixture that
spreads a read `canonical` straight back into an update), and the single-use
selector argument on the probe's render seam.

Refs #644

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Tg5Wb6XAiBgzxYFYRnpmia
@railway-app

railway-app Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-774 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Sep 13, 2026 at 5:13 pm UTC
1 service not affected by this PR
  • mailpit

@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-774 September 12, 2026 17:50 Destroyed
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 12, 2026
@sydevs-bot

sydevs-bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 17:03Z address-review · attempt 1 · session · done
  • 17:03Z address-review · attempt 1 · session
  • 16:47Z address-review · attempt 1 · session · done
  • 16:47Z address-review · attempt 1 · session
  • 19:43Z address-review · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧐 Adversarial review

The diff is no larger than #644 asks for. Its one edit beyond the ticket, a required routing argument on canonicalTargetForHost, earns its place: it makes the circularity a type error, not a comment. pathProbe as an optional sibling of verified is the right shape.

Unaddressed is the deploy. effectiveRouting defaults to query and nothing backfills, so every live canonical on path today reshapes to ?atlas= until that service is re-probed. The type contract is safe: ClientSchema is a non-strict z.object.

Findings

  • should-fix — no backfill, so live path canonicals flip on deploy (verification.ts:242)
  • should-fix — "Verify now" can exceed the edge's 100s ceiling (verifyEmbed.ts:100)
  • consider — the picker's two sample branches disagree (model.ts:183)

Checked — the diff; verification.ts, verifyEmbed.ts, regionOwners.ts, canonicalUrl.ts, VerifyEmbeds.ts, model.ts whole; #644; RENDER_TIMEOUT_MS; SahajAtlasWeb client.ts and mountDecision; SahajAtlasWordpress embed.php.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread src/lib/clients/verification.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 12, 2026
"Verify now" ran three 45s renders end to end on the promote path — mount,
probe, then control. Cloudflare abandons an origin response at 100s, and the
row is written before the response, so the one press that actually promoted a
service answered the operator with a 524 while the promotion had already
landed. The old ceiling was one render.

Starting the probe and control renders together puts the worst case at 90s,
under that ceiling. The verdict logic is untouched: it still reads the probe
first and returns its verdict unless positive, so promote-on-one and
demote-after-N are byte-identical. Only the render spending changes — a host
that fails the probe now costs the control render too, where it used to be
skipped. #644 budgets three renders an enabled owner, and that is what this
spends.

The alternatives all cost more: leaving the control to the nightly job
weakens the positive condition the ticket makes load-bearing, and a shorter
probe timeout would permanently bar a slow-but-path-routing host from
promotion.

Refs #644

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0121ycjeCPK3qtxWiQkqfhBJ
The picker's two sample branches answered different questions. The verified
branch read the derived verdict; the provisional one still read
`mount.routing`, the widget's report of its own script parameter. So an
operator setting up a fresh embed on a host reporting `path` saw a path-routed
sample, watched it flip to `?atlas=` the moment verification succeeded, then
flip back after the first positive probe — three shapes for one unchanged
host, none of them a promise.

Reading `effectiveRouting(verification)` in both branches means the preview
only ever moves when the verdict moves. It also removes the last read of a
script-URL routing value left in this repo, which #644's first acceptance
criterion asks for.

`sampleIsProvisional` still marks this branch: nothing has verified the mount,
which is a separate fact from which shape it will publish.

Refs #644

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0121ycjeCPK3qtxWiQkqfhBJ
`probePathRouting` no longer skips the control render on a negative probe, so
the rule documented here — "only when that one carries the marker" — was
stale. States the latency reason (Cloudflare's 100s origin ceiling against
three sequential renders) and the render budget it now spends.

Refs #644

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0121ycjeCPK3qtxWiQkqfhBJ
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-774 September 12, 2026 18:15 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Addressed the review — two adopted, one question. Pushed 56084a4.

Adopted

Asked

  • Nothing backfills pathProbe, so every service on path today drops to ?atlas= on deploy. Backfilling writes an unverified self-report into the field that shapes public URLs. Running the job first leaves a bot-challenged host on query forever. Your call, and the last thing before merge.

Lean gate green, client-canonical green. Each new assertion failed first.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 12, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review September 12, 2026 18:23
@sydevs-bot
sydevs-bot requested a review from Ardnived September 12, 2026 18:23
@sydevs-bot sydevs-bot added awaiting bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Sep 12, 2026
The reviewer settled the one open question on #774: do not backfill
`canonical.verification.pathProbe`, because every existing embed has to
be verified by hand again regardless.

That decision has a consequence an operator must act on — a service
publishing `path` canonicals today reshapes to `?atlas=` on the deploy,
and the nightly job can be up to 8 days out in backoff. Left only in a
resolved review thread, nobody deploying this would find it. So it goes
where the last post-deploy step went: a DEPLOYMENT.md subsection, with a
one-line pointer from the routing rule.

No behaviour change. The code already does not backfill.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Cj3GqVy64krrjw4C5gbJgJ

@Ardnived Ardnived left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of separating the path probe from the existing verification. Wouldn't it be cleaner and more efficient to do both of them together as one process?

Comment thread src/collections/Clients/Clients.ts Resolved
Comment thread src/collections/Clients/Clients.ts Resolved
Comment thread src/collections/Clients/Clients.ts Resolved
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-774 September 12, 2026 19:06 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

The last open question is settled. Pushed d43cc56, documentation only.

Settled

Lean gate green (1808 passed). No migration. Nothing is left to decide before merge.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread src/lib/atlas/regionOwners.ts Resolved
Comment thread src/lib/atlas/regionOwners.ts Resolved
Comment thread src/lib/clients/verification.ts Resolved
Comment thread src/lib/clients/verification.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Sep 12, 2026
Review: `verified.routing` duplicated the probe's verdict, and one
question must have one answer on the record.

The verifier no longer copies the readiness marker's `routing` into the
verified snapshot. The routing answer is `routingProbe` alone. Nothing is
lost: the widget's own report is still kept, as a report, per mount, in
`embedMetadata` — which is where a self-report belongs.

The schema key stays as an optional legacy property rather than being
deleted. `verified` is a closed object that Payload validates on every
save of the document, so removing it would make every row verified before
this change unsaveable until the job rewrote its snapshot.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HL2PLXNziNz1N6T3ULwmRe
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-774 September 12, 2026 19:51 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

One adopted, three back to you. Pushed a030a1a — lean gate green (1809 passed).

Adopted

  • Two routing fields is one too many — the verifier stops writing verified.routing, so routingProbe is the record's only routing answer. The widget's report stays where a report belongs, in embedMetadata. The schema key stays optional and legacy: verified is closed and validated on every save, so deleting it strands every row verified before this change.

Back to you — each is a call I should not make alone

  • Stored, not computed and effectiveRouting is indirection — it does read the stored verdict. All that is computed is the ?? 'query' default for an unprobed mount, in one place instead of six. Removing it properly needs a stored column, so a migration.
  • A shared ProbeResult — the two types share only a word: one is flat, the other a union with per-arm payloads.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. awaiting labels Sep 12, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Nothing pushed. The one open thread is a call I should not make alone.

Asked — effectiveRouting is indirection. The default already lives where you point: the canonical.routing afterRead hook, Clients.ts:309. That is the only ?? 'query' on any read path, and it is what the widget reads.

Three call sites never read through Payload. They hold the verification object they are about to write — VerifyEmbeds.ts:222 compares the verdict across its own raw UPDATE, and verifyEmbed.ts:119 answers from that object. Deleting the function relocates ?? 'query' into those three instead of removing it.

Say the word and I push that shape. Stored, not computed rests on the same answer.

Branch unchanged at a030a1a.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. awaiting labels Sep 13, 2026
Deletes `effectiveRouting` and inlines `?? 'query'` where each reader
needs it, as the reviewer asked on #774.

The default is not repeated needlessly: the `canonical.routing`
`afterRead` hook is the only site on a read path, and it is what the
widget reads. The rest hold a verification object they are about to
write or have just written (`VerifyEmbeds`, the `verifyEmbed`
endpoint), or read the row through their own `select`, which does not
run the hook (`canonicalOwnerFrom`, the admin picker).

No behaviour changes. The unit specs that asserted through the function
now read the stored verdict directly; the read-path default stays
pinned by `client-canonical.int.spec.ts`, which already asserts
`canonical.routing` is `query` for an unprobed row.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SWGXpkqshwdPz7wWrC7ghG
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-774 September 13, 2026 17:10 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Adopted and pushed 122d393. Lean gate green (1955 passed), client-canonical 37, region-canonical-url 24.

Adopted — delete the function, inline the default (5bebd53). effectiveRouting is gone. Six readers spell ?? 'query' themselves, and only one sits on a read path: the canonical.routing afterRead hook, which is what the widget reads. The rest hold the object they are about to write, or read the row with their own select, which never runs the hook.

The same commit settles stored, not computed. Both threads resolved.

main is merged in, so CI runs against it.

Still open, your call: should the probe and the mount verification be one process?

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 13, 2026
@sydevs-bot
sydevs-bot merged commit 97630a0 into main Sep 14, 2026
29 of 30 checks passed
@sydevs-bot
sydevs-bot deleted the claude/feat-644-derive-routing branch September 14, 2026 04:25
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 14, 2026

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-774 — 122d3939 Deployed Sep 13, 2026 by railway-app[bot]
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.

feat(access): derive the routing mode on the server, so the widget stops taking it from the script URL

3 participants