Skip to content

Commit 655229c

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-96llpb
Claude-Session: https://claude.ai/code/session_01ADHkmSM46qymk97AyqPzoS Co-authored-by: Claude <noreply@anthropic.com>
2 parents d77374e + 13a0d3f commit 655229c

43 files changed

Lines changed: 2444 additions & 31 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/spec': patch
3+
'@objectstack/rest': patch
4+
'@object-ui/types': patch
5+
---
6+
7+
feat(rest): the record page composite's approval lock says which approval holds the record (`lockSource`), as the lock doors do
8+
9+
Clause-②: yes (widening: the record page composite's published `lock` gains `lockSource`)
10+
Metadata-protocol: none
11+
12+
Widened: `RecordPageApprovalsSchema`'s `lock` (the `approvals` part of `POST /data/:object/:id/page`) gains the optional member `lockSource: 'record' | 'master'`, present on a locked record only; `@object-ui/types`'s `RecordPagePayload.approvals.lock` gains the same optional `lockSource`.
13+
14+
The record page's one read now answers its approval lock through the same projection as `GET /approvals/records/:object/:recordId/lock` and `POST /approvals/records/:object/locks`: `locked`, and on a locked record which approval holds it, `record` (its own) or `master` (the master of a master-detail line; it wins when both hold). A locked answer from a service that names no kind is still served `{ locked: true }` alone, and `null` still means the deployment answers no lock or the record is unreadable or missing. Before this, the composite served `{ locked }` only, so a record page could not tell a line held by its own approval, which may be deleted, from a line of a held master, whose delete the server refuses with `RECORD_LOCKED`. The Console's record page now hides Delete on `lockSource: 'master'`, as the grid's row menu does.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/spec': patch
3+
'@objectstack/core': patch
4+
'@objectstack/service-segmenter': patch
5+
---
6+
7+
feat(service-segmenter): a segmenter service that cuts a Chinese question into real words for the keyword leg
8+
9+
Clause-②: yes
10+
Metadata-protocol: none
11+
12+
New package `@objectstack/service-segmenter`: `SegmenterServicePlugin` registers `ISegmenterService` under the `segmenter` slot. `keywordTerms(query, { purpose, entries })` answers a question's keyword terms in the shape the knowledge adapters' terms have today (distinct, at most 16). The caller's `word` entries are kept whole wherever the question spells them, in any script. A run of Han characters is cut by `@node-rs/jieba` (HMM off, an optional dependency, one instance per process) with the platform's words (年假, 脱密, 应急采购, 超预算, …) in its dictionary; a word equal to a stop word is dropped, and adjacent single characters are joined into two-character words. The query is NFKC-normalised first, a Thai, Lao, Khmer or Myanmar run is cut by `Intl.Segmenter`, and everything else (English, figures, codes, kana and Hangul runs) is cut exactly as before. Without jieba (not installed, or failed to load: the boot log names which, and `status()` reports it), the service answers by sliding windows with the supplied words still kept whole. The purpose `record_search` is reserved and refused with `NOT_IMPLEMENTED`.
13+
14+
Nothing calls the service yet: the knowledge adapters keep their own terms until they read the slot.
15+
16+
`@objectstack/spec/contracts` adds `ISegmenterService`, `SEGMENTER_SERVICE` and their types, and `ServiceSlotContracts` gains the `segmenter` slot (not a `CoreServiceName` member). `@objectstack/core` adds `keywordTerms`, `MAX_KEYWORD_TERMS`, `KEYWORD_SEPARATORS` and `UNSEGMENTED_RUN`: the sliding-window rule the two knowledge adapters each hold a copy of, as one shared copy.

‎.changeset/config.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"@objectstack/service-cluster-redis",
6767
"@objectstack/service-datasource",
6868
"@objectstack/service-i18n",
69+
"@objectstack/service-segmenter",
6970
"@objectstack/service-job",
7071
"@objectstack/service-knowledge",
7172
"@objectstack/service-mailbox",

‎.github/workflows/docs-deploy.yml‎

Lines changed: 129 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,141 @@ jobs:
222222
echo '```'
223223
} >> "$GITHUB_STEP_SUMMARY"
224224
225+
# ## A bounded retry of the upload, and a failure that names what it saw
226+
#
227+
# Read from the logs of the failed runs 46421807466, 46487702664 and
228+
# 46551161614 (2026-11-30 12:46Z to 2026-12-01 01:10Z, CLI 60.1.3,
229+
# Node 22.23.5, the same runner image as the green runs before them):
230+
# each upload stopped with ONE `fetch failed` 301-302 s after its
231+
# `Uploading [---]` line, then `AbortError` for the other uploads in
232+
# flight (one log also shows `Upload aborted` for the queued ones). A
233+
# green upload of the same ~540 MB finishes in about 60 s, so that
234+
# request was not slow: nothing answered it. 300 s is Node fetch's
235+
# default response timeout (undici's headersTimeout / bodyTimeout); that
236+
# it fired is inferred from the timing, since the CLI prints `fetch
237+
# failed` without its cause. The 2026-11-21 failures stopped 56 s and
238+
# 71 s in: another `fetch failed` with no HTTP status. WHY the request
239+
# went unanswered is not shown: the network path, Vercel's upload
240+
# endpoint, or one file that stalls every time are all still open.
241+
#
242+
# The CLI retries a failed file upload only when the error text matches
243+
# ETIMEDOUT, ECONNRESET, ECONNREFUSED, ENOTFOUND, EAI_FAIL, `socket hang
244+
# up` or `network socket disconnected` (`isClientNetworkError` in the
245+
# 60.1.3 bundle). An undici timeout ("Headers Timeout Error") matches
246+
# none of them, and neither did the cause of any failure above, so the
247+
# CLI aborted every other upload and exited 1: one stalled request
248+
# fails the whole deploy.
249+
#
250+
# So this step runs the deploy up to DEPLOY_ATTEMPTS times, and retries
251+
# ONLY when the attempt never got a deployment URL AND either its fatal
252+
# error line (`Error:` / `TypeError:`, not a warning earlier in stderr)
253+
# carries a connection-failure text or it hit its own attempt cap. Each
254+
# attempt is a new CLI process with new connections, and it asks the
255+
# API again which files it lacks (the CLI's `missing_files` exchange)
256+
# and uploads only those; how many that is depends on what Vercel kept
257+
# from the aborted attempt, which no log shows.
258+
#
259+
# Never retried: CLI 60.1.3 prints the deployment URL at `created`,
260+
# before Building, Ready and Aliased, so an attempt that printed a URL
261+
# and then failed (a status poll's `fetch failed`, a cap hit waiting for
262+
# Ready) has a deployment that Vercel goes on to finish; a retry would
263+
# publish a second one. That run fails naming the URL, its final state
264+
# unknown. Also never retried: any other error (a refused token, a
265+
# config error, an HTTP error with a message) and an exit 0 with no URL.
266+
#
267+
# A deploy that needed a retry is green with a warning, so a recovered
268+
# abort stays visible on the run page. When every attempt fails, the
269+
# error lists each attempt's time and failing line. If retries keep
270+
# failing the same way, the next reading is which file the stalled
271+
# request carried: a run with `--debug` logs `File <sha> (<name>)
272+
# uploaded` for each file, and the stalled one never gets that line.
273+
#
274+
# The CLI pin stays at 60.1.3: the same version deployed the ten green
275+
# runs before the first failure, so the logs give no reason to move it.
276+
#
277+
# Budget: the deploy step started 5-6.5 minutes into the failed runs; a
278+
# failed attempt took 307-312 s and a green one 74 s. ATTEMPT_LIMIT caps
279+
# one attempt (`timeout` signals the CLI's whole process group, and
280+
# `--kill-after` follows with SIGKILL 30 s later) so a hang outside the
281+
# upload cannot eat the job: 3 x 6.5 min + the 30 s and 60 s waits is
282+
# 21 minutes, about 27.5 with the build before it, inside the job's 30.
283+
# Exit 137 is that SIGKILL; an out-of-memory kill of the CLI would also
284+
# read 137 and be labelled the cap.
225285
- name: Deploy the prebuilt output to production
226286
id: deploy
227287
env:
228288
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
289+
DEPLOY_ATTEMPTS: '3'
290+
ATTEMPT_LIMIT: '6m'
229291
run: |
230292
set -euo pipefail
231-
# stdout is the deployment URL and nothing else; progress goes to
232-
# stderr. `set -e` fails the step on a non-zero exit before the URL
233-
# is used.
234-
url=$(npx --yes "vercel@${VERCEL_CLI_VERSION}" deploy --prebuilt --prod --token="$VERCEL_TOKEN")
235-
echo "url=${url}" >> "$GITHUB_OUTPUT"
236-
echo "Deployed: ${url}"
293+
url_file="$RUNNER_TEMP/vercel-deploy-url.txt"
294+
err_file="$RUNNER_TEMP/vercel-deploy-stderr.txt"
295+
retry_waits=(30 60)
296+
transient='fetch failed|ECONNRESET|ETIMEDOUT|socket hang up|other side closed'
297+
history=""
298+
for attempt in $(seq 1 "$DEPLOY_ATTEMPTS"); do
299+
echo "Deploy attempt ${attempt} of ${DEPLOY_ATTEMPTS} ($(date -u +%H:%M:%SZ))"
300+
started=$(date +%s)
301+
status=0
302+
# stdout is the deployment URL and nothing else, into url_file.
303+
# Progress and errors go to stderr: shown live in this log
304+
# (its timestamps are how the 300 s stall was read) and kept in
305+
# err_file for the retry decision.
306+
timeout --kill-after=30s "$ATTEMPT_LIMIT" \
307+
npx --yes "vercel@${VERCEL_CLI_VERSION}" deploy --prebuilt --prod --token="$VERCEL_TOKEN" \
308+
2>&1 >"$url_file" | tee "$err_file" >&2 || status=${PIPESTATUS[0]}
309+
elapsed=$(( $(date +%s) - started ))
310+
# Anything on stdout means the CLI reached `created` (it prints
311+
# nothing else there); `url` is the address it printed, for the
312+
# messages and the step output.
313+
created=""
314+
if grep -q '[^[:space:]]' "$url_file"; then created=yes; fi
315+
url=$(grep -oE 'https://[^[:space:]]+' "$url_file" | tail -n 1 || true)
316+
# The CLI's fatal error lines; warnings it carries on past are not
317+
# among them.
318+
fatal=$(grep -E '^(Error|TypeError): ' "$err_file" || true)
319+
first_fatal=${fatal%%$'\n'*}
320+
if [ "$status" -eq 0 ] && [ -n "$url" ]; then
321+
echo "url=${url}" >> "$GITHUB_OUTPUT"
322+
echo "Deployed: ${url}"
323+
if [ "$attempt" -gt 1 ]; then
324+
echo "::warning::Docs deployed on attempt ${attempt} of ${DEPLOY_ATTEMPTS}, after a retry.${history}"
325+
fi
326+
exit 0
327+
fi
328+
if [ -n "$created" ]; then
329+
# A deployment exists: see the header. Never retried.
330+
url=${url:-$(grep -m1 '[^[:space:]]' "$url_file")}
331+
reason=${first_fatal:-no error line}
332+
if [ "$status" -eq 124 ] || [ "$status" -eq 137 ]; then reason="stopped by the ${ATTEMPT_LIMIT} attempt cap"; fi
333+
echo "url=${url}" >> "$GITHUB_OUTPUT"
334+
echo "::error::vercel deploy created the deployment ${url} and then failed (exit ${status} after ${elapsed} s: ${reason}). Its final state (Ready, aliased to production) is unknown: open it in the Vercel dashboard. Not retried, since a retry would publish a second deployment."
335+
exit 1
336+
fi
337+
if [ "$status" -eq 0 ]; then
338+
echo "::error::vercel deploy exited 0 but printed no deployment URL, so whether it created a deployment is unknown: check the Vercel dashboard. Not retried, since a retry could publish a second deployment."
339+
exit 1
340+
fi
341+
if [ "$status" -eq 124 ] || [ "$status" -eq 137 ]; then
342+
cause="stopped by the ${ATTEMPT_LIMIT} attempt cap, exit ${status}"
343+
elif line=$(grep -m1 -E "$transient" <<<"$fatal"); then
344+
cause="${line}"
345+
else
346+
first=$(grep -m1 . <<<"$fatal" || tail -n 1 "$err_file" || true)
347+
echo "::error::vercel deploy failed (exit ${status}) before printing a deployment URL, with an error that is not a connection failure, so it is not retried: ${first:-no stderr}"
348+
exit 1
349+
fi
350+
history="${history} Attempt ${attempt} failed after ${elapsed} s (${cause})."
351+
echo "Attempt ${attempt} failed after ${elapsed} s: ${cause}."
352+
if [ "$attempt" -lt "$DEPLOY_ATTEMPTS" ]; then
353+
wait_s=${retry_waits[$(( attempt - 1 ))]:-60}
354+
echo "Retrying in ${wait_s} s."
355+
sleep "$wait_s"
356+
fi
357+
done
358+
echo "::error::The Vercel upload failed on all ${DEPLOY_ATTEMPTS} attempts.${history} No attempt got a deployment URL back (CLI ${VERCEL_CLI_VERSION} prints it the moment a deployment is created), so this run created no deployment that the CLI knows of. A stop about 300 s after the Uploading line is one upload request that got no answer within Node fetch's 300 s timeout; a stop a minute or so in is a dropped connection. Why is not shown: if this repeats, find which file the stalled request carried (see the comment above this step)."
359+
exit 1
237360
238361
- name: Publish the run to the summary
239362
if: always()

0 commit comments

Comments
 (0)