Repository navigation
Conversation
7356db1 to
1399810
Compare
|
A same-model adversarial review (E2E, with a mocked cyclic wiki graph) found that the cycle prevention was incomplete — fixed in the latest push:
Two regression tests added ( |
|
Follow-up hardening from the adversarial review: the batch import now throttles concurrency ( |
huangruiteng
left a comment
There was a problem hiding this comment.
Thanks for iterating on #3120. I reviewed exact head 858200b4e5464d865afc28a2e235e2dc7398d4ca; these are still blocking:
-
_maybe_enqueue_feishu_batch_add_resource()uses onlylen(expanded) == 1to distinguish a leaf from a batch. A space or directory with exactly one importable document therefore falls through and tries to ingest the original/wiki/settings/<space_id>or directory URL as a single document. The expansion result needs to preserve source kind, with regressions for one-document spaces/directories. -
An explicit
tois reassigned tobatch_parent, but that directory is never created andcreate_parentis not forwarded. A normal new target such asviking://resources/my_wikitherefore makes each child fail target resolution. Please cover this through the real target/finalization path rather than a mockedadd_resourcecall. -
The batch is currently process-local fire-and-forget work: child imports are started with
asyncio.create_task, shutdown cancels them, failures are only logged, and the returned response has no durable batch task/per-item state. This does not satisfy the issue contract for partial-failure visibility, idempotent checkpoint/resume, and restart safety. The(url, title)expansion also discards relative hierarchy, so all documents are flattened. Please route the provider-neutral batch manifest through durable queue/task state and preserve relative paths. -
The changed files do not pass repository formatting/lint:
ruff checkreports import ordering, B017, and F841;ruff format --checkreports four files requiring formatting.
Validation on this head with an isolated no-credential HOME: 45 new focused tests passed; 27 existing Feishu parser tests passed; git diff --check passed; merge-tree against current origin/main (8391d3a) was clean. The passing tests currently mock away the target-resolution/durability failures above.
…get path (volcengine#3120) Address PR volcengine#3543 review blocking points: 1. source_kind dispatch — introduce ExpandedDoc (url/title/source_kind/ rel_path); a one-document space/directory now correctly takes the batch path. Previously len(expanded)==1 mis-classified it as a leaf and tried to ingest the /wiki/settings/<id> URL as a single doc. 2. Real target/finalization path — the batch parent is created through the real FS (mkdir) before fan-out and create_parent is forwarded on every child, so viking://resources/my_wiki resolves each child instead of failing target resolution. Dispatch tests exercise the real FS, not a mocked add_resource. 3. Durable provider-neutral batch manifest — replace process-local asyncio.create_task fire-and-forget with batch_manifest_store (atomic tmp→bak→rename, mirrors watch storage) + per-child AddResourceMsg / TaskTracker (crash-recoverable QueueFS). The response carries batch_id + per-item task_id/status; idempotent resume via deterministic batch_id; wiki hierarchy preserved via rel_path (no flattening). 4. ruff — fix import ordering, B017, F841; format all changed files. 56 tests pass (wiki_batch 34 + dispatch 8 + manifest store 7 + routing); ruff check + format clean on all changed files.
|
Thanks for the thorough review — all four blocking points are addressed in b0090e1. 1. 2. Real target/finalization path 3. Durable provider-neutral batch manifest + hierarchy
The response now carries The manifest module/URI are intentionally provider-neutral ( 4. ruff Validation on b0090e1 (isolated, no-credential HOME): 56 tests pass — |
…get path (volcengine#3120) Address PR volcengine#3543 review blocking points: 1. source_kind dispatch — introduce ExpandedDoc (url/title/source_kind/ rel_path); a one-document space/directory now correctly takes the batch path. Previously len(expanded)==1 mis-classified it as a leaf and tried to ingest the /wiki/settings/<id> URL as a single doc. 2. Real target/finalization path — the batch parent is created through the real FS (mkdir) before fan-out and create_parent is forwarded on every child, so viking://resources/my_wiki resolves each child instead of failing target resolution. Dispatch tests exercise the real FS, not a mocked add_resource. 3. Durable provider-neutral batch manifest — replace process-local asyncio.create_task fire-and-forget with batch_manifest_store (atomic tmp→bak→rename, mirrors watch storage) + per-child AddResourceMsg / TaskTracker (crash-recoverable QueueFS). The response carries batch_id + per-item task_id/status; idempotent resume via deterministic batch_id; wiki hierarchy preserved via rel_path (no flattening). 4. ruff — fix import ordering, B017, F841; format all changed files. 56 tests pass (wiki_batch 34 + dispatch 8 + manifest store 7 + routing); ruff check + format clean on all changed files.
b0090e1 to
fdbd452
Compare
|
Rebased onto current
Ready for re-review. Thanks! |
fdbd452 to
b9bdff4
Compare
|
Rebased onto current main (head b9bdff4) and resolved the merge conflicts against the new resource-service source-plan flow: the batch dispatch now runs before _prepare_standard_source_plan, and the wiki expansion block coexists with the new legacy-doc parsing. All review feedback from earlier rounds remains addressed. Ready for re-review. |
Cross-reference: focused Phase 1 alternativeThank you for the extensive exploration and iteration in this PR. A separate focused Draft PR, #4592, now proposes the first phase of #3120. It carries forward several lessons demonstrated here: recognizing Wiki space URLs, paginated traversal, node/page-token cycle protection, bounded document-fetch concurrency, hierarchy preservation, and visible partial failures. The main boundary is different:
This cross-reference is intended to help maintainers compare the phase boundaries; it is not a request to close this PR. #4592 also uses 交叉说明:更聚焦的第一阶段方案感谢本 PR 中大量的探索与多轮迭代。现在另有一个聚焦的 Draft PR #4592,用于落地 #3120 的第一阶段。 新方案继承了这里已经验证出的多项经验:识别 Wiki 空间 URL、分页遍历、节点与分页游标循环保护、正文抓取并发限制、层级保留和可见的部分失败信息。 两者主要区别在阶段边界:
这条说明用于帮助维护者比较两种阶段拆分,并不是请求关闭本 PR。#4592 同样使用 |
- expand wiki space/directory URLs into per-document batch imports - durable batch manifest routed through queue/task state - cycle prevention (node-token + page-token) and bounded concurrency (8)
b9bdff4 to
44ea9c4
Compare
|
Thanks @viafcccy for the thoughtful cross-reference — and for carrying the hard-won lessons (paginated traversal, node/page-token cycle protection, bounded fetch concurrency, hierarchy preservation, visible partial failures) into a much more focused shape. The Phase 1 boundary reads well: one directory resource through the existing add-resource queue, Two small things from this PR's iteration history that may be worth a look when reviewing #4592:
On the phase split: this PR's remaining differentiated pieces — durable batch manifest, per-child task state, checkpoint/resume — map cleanly onto the deferred follow-ups under #3120. If maintainers prefer landing #4592 first, I'm happy to close this PR and re-propose the durability layer as a focused Phase 2 built on top of #4592's structure. The 45-case suite here (cycles, single-document spaces, concurrency regressions, resume semantics) is available for reuse either way. |
Farewell note for #3543First of all — thank you @viafcccy and the team for taking this on. Seeing #4592 land the focused Phase 1 (Wiki subtree import with hierarchy) is exactly the outcome we hoped for when we opened this PR. The carried-forward lessons are the right calls, and in a couple of places #4592 does better than our draft:
We are closing #3543 to reduce the review queue — the remaining value here is not in the diff but in a few lessons from our implementation that #4592's current scope (one directory resource per subtree) does not need yet, but later phases might:
Our branch We've also left a detailed review on #4592 from our exploration here. Thanks again for carrying this feature home — happy to test any follow-up phase. |
|
Closing this in favor of the focused Phase 1 PR #4592 — see the review comment above for our remaining hardening suggestions (durable manifest, retry/backoff, pagination guards). The branch stays available for cherry-picking, especially the batch manifest store. |
What & why
Closes #3120.
ov add-resourceonly recognized single Feishu doc URLs (.../wiki/<doc_token>or.../docx/<doc_token>); a wiki space root (.../wiki/settings/<space_id>) or a directory node URL was rejected with "must import a document link", so importing a 90+-doc wiki knowledge base meant one link at a time.This extends Feishu URL recognition to dispatch three shapes:
.../wiki/<doc_token>/.../docx/<doc_token>(leaf).../wiki/<token>with children (directory node).../wiki/settings/<space_id>(space root)How
parse/accessors/feishu_accessor.pyclassify_url()— three-shape dispatch (single_doc / wiki_node / wiki_space_root).list_wiki_subtree()— async recursive walk via the reallark-oapiSDK (wiki.v2.space.listwith pagination +wiki.v2.space.get_nodeto detect directory nodes), bounded by max_depth (5) + max_nodes (500), withobj_tokende-dup to prevent cycles and a stale-page-token guard.expand_feishu_url()— flattens a space/directory URL into direct doc URLs (so children don't re-trigger batch dispatch — no infinite recursion).service/resource_service.py—_is_feishu_batch_candidatepredicate +_maybe_enqueue_feishu_batch_add_resource: at the ingestion dispatch point, a batch URL is expanded and each child doc is enqueued through the existing single-doc import path; a batchtobecomes theparentfor all children (each gets its own URI). Single-doc and non-Feishu URLs unchanged. Reusesfeishu_watch_authtokens; no hardcoded credentials. Batch children getwatch_interval=0(watch stays on the outer request).Recursion is bounded + timeout-guarded; unknown URLs still raise the original error.
Tests — 43 new, all pass (97 incl. existing Feishu suite, no regression)
tests/parse/test_feishu_wiki_batch.py(32) +tests/service/test_feishu_batch_dispatch.py(11), all mocklark-oapi(no real Feishu calls): classify_url three-shape + edge cases, leaf passthrough, directory recursion, space-root whole-tree, pagination (has_more+page_token),max_depth/max_nodestruncation, empty subtree,obj_tokende-dup, unknown obj_type skip-but-continue, API failure propagates (no silent degrade), and service-layer dispatch (N child add_resource tasks + summary, single-doc → original path, token passthrough, expand-failure propagation). 43 pass; full Feishu suite 97 pass, 0 regression.Notes
lark-oapiwiki.v2 calls are wired (not TODO); SDK method shapes were probed from the real SDK and aligned with mocked tests. No end-to-end real-Feishu test (no creds in test env).This contribution was developed with AI assistance.
Refs #3120