Repository navigation
chore(contracts): re-sync copied contracts from SahajCloud - #484
Conversation
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
`atlas-url-contract.json` version 2 widens a slug to any lowercase Unicode letter and states that a canonical URL percent-encodes it, so a parser decodes each segment before matching. `routeFromPathname` returned the encoded form, so `/map/bg/%D1%81%D0%BE%D1%84%D0%B8%D1%8F` was a different route from query mode's `/bg/софия` for the same place, and the fixture's own path case went red. `decodePath` (`path.ts`, beside `safeDecode`) decodes segment by segment, and runs BEFORE `safePath`: an encoded `//`, backslash or TAB has to meet that guard as what it decodes to, rather than as the `%` it arrives as. The fixture's version and emitted-case count are re-pinned to what version 2 carries. Both new `routeFromPathname` assertions were watched failing against the encoded form. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXCcWsqnwFhrGvPn2i
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Holistic assessment
The sync is clean: this repo's copy is byte-identical to SahajCloud@main:src/lib/atlas/atlas-url-contract.json, and version 2's one behaviour change — a non-ASCII slug travels percent-encoded in a pathname and raw in webPath — is met by exactly one adaptation, routeFromPathname decoding before safePath. That order is right, and routing.test.ts pins why. Query mode and the standalone build needed nothing, and the diff correctly adds nothing there. The weak part is the body, which still describes a generated-only change.
Findings
should-fix— the body says "with no hand edits" and writes fix-ci's adaptation as hypothetical, but the branch carries a hand-written routing change inrouting.tsandpath.tsthat no## Summarybullet names. It also cites SahajCloud#1269 while HEAD syncs #1254. (PR body — no inline thread.)should-fix— Streamline:isCanonicalPathshould decode throughdecodePath, leaving one decode rule in the file.src/lib/shape/path.ts:29consider— the docstring's spelled-out case counts duplicate the two assertions below them.src/lib/shape/atlas-url-contract.test.ts:23
What was checked
- Contract identity, against
origin/main:src/lib/atlas/atlas-url-contract.jsonin the SahajCloud checkout: byte-identical. - Read whole on the branch:
path.ts,routing.ts,atlas-url-contract.test.ts,query.ts,atlas-history.ts,router.tsx. - The consumer sides held for a reason:
routeFromParamreads throughURLSearchParams, so query mode'ssafePathalways saw decoded input, and the standaloneBrowserRouterbuild never callsrouteFromPathname. - Ladder: one new piece,
decodePath. Streamliner: 1 covered, 1 kept, 1 finding, which held.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`isCanonicalPath` decoded the whole pathname at once, so a single malformed escape anywhere in it left every segment encoded and the canonicalize comparison came back false. `decodePath`, added on this branch for `routeFromPathname`, already decodes segment by segment, so pointing the predicate at it leaves the file with one decode rule and gives `decodePath` the second caller that stops it being a middle layer. The new assertion was watched failing against the whole-string decode. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVMtpJ5wtbFhvtsUFk
The docstring spelled out how many cases refuse and how many emit, which `expect(refused).toHaveLength(8)` and `expect(emitted).toHaveLength(15)` already pin ten lines below it. Every contract bump had to hand-edit the prose to keep it true, and the sync that bumped to version 2 did exactly that. The ⚠ and the reason stay; the numerals go. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVMtpJ5wtbFhvtsUFk
|
Three points from the adversarial review, all adopted. Pushed a27ee31.
Lean gate green: lint, typecheck, 2420 unit tests. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Not approved automatically: it changes more than the copied contract. It needs a person's review. 🤖 sydevs dispatcher |
`sy-atlas-translations` no longer declares a `compact` group: sydevs/SahajCloud#1268 retired it with the compact card it labelled, and dropped its jsonb column. The generated type arrived in this branch's last re-sync, so `WidgetTranslations` `Pick`ed a key `SyAtlasTranslation` no longer has, and `pnpm typecheck` failed with TS2344 — which took the build and, behind it, the preview the smoke lane reads. The tab list is stated in three places that cannot import one another, and all three lose the member: the constant, the SDK `select`, and the node script. Requesting a field the global has dropped is also a read this widget no longer has any answer for. `translations.en.json` keeps `compact.open`, and the card keeps asking for it. The snapshot is i18next's boot resource, so the one call site still resolves against compiled English while the group is gone upstream. Regenerating it here would pull in `common.map.expand`, `common.map.close` and `countries.place_title`, which nothing in this repo references yet. #466 removes the card and wires those three, running `pnpm sync:translations --write` itself. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX3jiAvDARU96rnGNV
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | a27ee31 | Nov 25 2026, 07:40 PM |
Summary
routeFromPathnamedecodes first.path.ts—isCanonicalPathgoes throughdecodePathtoo.Change outline
The contract bump is what a consumer sees. The decode is what this repo had to change to meet it.
Contract — the shared atlas-URL contract, version 1 → 2
One rule per line, paraphrased from
$commentandslugPattern.Types — what the generated SahajCloud types gained
Additive only, and
review: skipper.claude/workflow.json. Nothing here reads them yet.Flow — routeFromPathname, the only consumer the new rule reaches
routeFromParamneeded nothing: it reads throughURLSearchParams, so query mode always handedsafePathdecoded input. The standaloneBrowserRouterbuild never callsrouteFromPathname.Behaviour — one decode rule in path.ts
Test results
pnpm test:run(191 files, 2420 passed, 1 skipped)path.test.ts,routing.test.ts,atlas-url-contract.test.ts— all greenpnpm sizeNotes for reviewer
Opened by the dispatcher contract sync (
contractSyncin sydevs/claude-workflowloop-config.json), not from a ticket. Two producer merges have synced into this branch:sydevs/SahajCloud#1269, which bumped the atlas-URL contract to version 2,
and sydevs/SahajCloud#1254, which brought the generated types at HEAD. A
later producer merge adds its commit here while this PR is open.
The widened
slugPatternis compiled nowhere in this repo — our half of the contract asserts theversion and the cases, never the pattern. So version 2's Unicode widening needed no code here;
only the encoding rule beside it did.
The two joined commits came from this PR's own adversarial review, not from a reviewer: the
Streamline thread on
src/lib/shape/path.tsand the docstring thread onsrc/lib/shape/atlas-url-contract.test.ts.A branch-level
/security-reviewran, sincesrc/lib/shape/pathandsrc/lib/shape/routingaresecurityReview.triggerPatternpaths. No findings: decoding beforesafePathrejects/%2F%2Fevil.example,/%5Cevil.exampleand/%09/evil.example, each of which passed the guardencoded, so the accepted set is a subset of what
mainaccepted.