Files
cdsl-cad/cadfs_to_cdsl/FEATURESCRIPT_QUERY_CAPABILITY_MATRIX.md
T
likang 994d06aaea feat(selector): 增加离线候选遍历与严格回放验证 Demo
- 新增 selector_candidate_demo,移除 provenance intent 后枚举候选 selector
- 对候选分支执行有界重建与严格 STEP 比较
- 仅在候选遍历完整且唯一 strict 通过时生成 selector 映射记录
- 增加 selector 候选搜索、预算限制和记录生成的测试
- 保持生产 selector resolver 不受 Demo 逻辑影响
- 更新 CADFS 能力台账,记录 IMPRINT 派生 profile 的 lineage selector 缺口
2026-09-10 15:12:57 +08:00

13 KiB

FeatureScript Query Capability Matrix

This matrix is the versioned allow-list consumed by the CDSL selector resolver. It records what the current runtime may execute, not what FeatureScript text it can parse. A missing entry is intentionally rejected with selector_query_unsupported; a missing source version is rejected with selector_query_version_unknown. Every registered row currently requires the direct source import onshape/std/geometry.fs@1511.0 in addition to its FeatureScript language version. The lowerer preserves every direct onshape/std/* import as {path, version} metadata, but an unregistered library revision is not treated as compatible merely because its path matches.

Query family FeatureScript version Source evidence CDSL/runtime contract Verified boundary
CAP_FACE 1511 CADFS FeatureScript 1511 exported query history Direct extrude.start / extrude.end builder output role; an immediate up_to_surface reference or a shell face-removal selector may consume that role The consumer must immediately follow a direct extrude_add_blind new_body blind producer, with a complete/proven cap role and no stable-ID, binding-ID, or geometry fallback. 00925274 F3 resolves extrude.start for up_to_surface; 00212904 F2 and 00789939 F2 resolve immediate shell removals through extrude.start and extrude.end, respectively. Fresh pipelines preserve the distinction between execution and similarity: 00212904 executes through F5 but is RP-rejected, while 00789939 executes F2/F5 then preserves the F5 checkpoint when F6 remains unsupported. Later mutations, draft-with-holes, fused/multi-region results and generic CAP queries remain unsupported.
CAP_EDGE 1511 CADFS FeatureScript 1511 exported query history; BRepPrimAPI_MakePrism.FirstShape(source_edge) / LastShape(source_edge) exact cap-edge handles A direct fillet/chamfer consumer of an independent, undrafted, new_body blind prism: one exact direct source-profile edge -> one role-qualified extrude.start or extrude.end cap edge, followed only by complete/proven one-to-one continuations to the active body The selector must name one retained direct source entity and explicit CAP side. The adapter accepts the cap handle only after IsSame verifies it is present in the final snapshot; resolver follows the source anchor and role through boundary, and accepts subsequent continuation only when every relation is complete/proven and operation cardinality remains one-to-one. A direct all-circle annulus with one contained circle is included when both source wires retain exact final-face membership; outer/inner roles remain distinct. A direct analytic region with a solver-split circular hole is included only when all four arcs carry the same explicit logical-circle source marker and that source maps uniquely to one unsplit profile circle; the adapter reconstructs one native wire before the same final-face check. Corpus evidence: 00021014 F2 resolves nine non-hole start/end selectors and is strict/RP passing; hole matrix 00479470, 00501170, 00526649 is RP passing and 00621329 is strict/RP passing. 00694309 F4 resolves F1's start CAP edge through F3's proven primary-cut continuation and is strict/RP passing. 00566233 resolves both F2 selectors before an OCC chamfer feasibility failure, while 00614954/00678961 resolve F2 before later unsupported queries. 00735367 resolves F2 from its line-outer/circular-hole region and executes F3 before an unrelated F4 unsupported query. Incomplete/mixed logical-circle markers do not create a circular-hole anchor; partial/branched continuation, trimmed/split profiles, multi-region-with-hole profiles, draft, multiple/two-sided extents, fused results, and unproven boolean/SPLIT/COPY/pattern continuations are rejected. This is not general CAP_EDGE replay.
SWEPT_BODY 1511 CADFS FeatureScript 1511 exported singleton qUnion([makeQuery(..., SWEPT_BODY, EntityType.BODY)]) history An immediate one-sided up_to_body extent may reference exactly one active body record produced by a preceding independent new_body blind prism The source body must be the immediately preceding extrude_add_blind, with result_mode: new_body, blind undrafted direct-prism semantics, and an active producer body record. Lowering emits only active_body_member evidence with body_member_contract: direct_new_body; resolver proves the active record and producer identity, then returns body_member. 00694309 F3 resolves this reference; its F4 strict/RP pass is separately established by the bounded CAP_EDGE continuation contract, not by widening this body-member contract. Later successors, ADD, cut/revolve/sweep, COPY, boolean/pattern/delete, multiple active bodies, multiple query items, other versions, and all stable-ID, geometry, binding-ID, aggregate/current-body fallbacks are rejected.
OFFSET_FACE 1511 CADFS FeatureScript 1511 exported query history shell.offset_face builder output role plus one TDD source cap Immediate direct shell owner and one explicit extrude.start or extrude.end true dependency.
SWEPT_FACE 1511 CADFS FeatureScript 1511 exported query history; direct-prism BRepPrimAPI_MakePrism.Generated(edge) relation plus final-snapshot BRepAlgoAPI_Cut.Modified/Preserved target history An immediate fillet/chamfer consumer or shell removal, or a one-sided up_to_surface extent: one retained direct source-profile edge -> its generated side face, followed only by complete/proven kernel continuations to one active face Limited end-to-end contract. The source prism must be independent, undrafted, new_body, blind, and retain one exact direct wire/face construction anchor. The extent variant carries no output role, stable ID, binding ID, or geometry hint. For a single-solid primary cut, target-side builder history is registered independently of whether its tool has direct-prism history; transient tool topology remains restricted to the separate source-qualified INTERSECT contract. Resolver traverses only the requested result topology kind, measures cardinality over complete/proven final-snapshot relations of that source/result kind, and still rejects any bound partial, split, merge, or inactive branch. Non-final intermediate handles and cross-type section diagnostics remain diagnostic only. 00925274 resolves F1 E0 through F3, F6, F9 and F12 target continuations and is strict/RP passing. The shell variant accepts only original non-construction lines. Direct all-circle construction includes one annular hole; independently constructed direct circle regions retain one delta per source face only when every generated result remains in the final snapshot. IMPRINT/split source profiles, draft, multiple/two-sided extents, fused source results, unproven/split continuations, revolve, sweep, loft, copy and pattern are rejected. Fresh corpus evidence: 00594348 and 00925274 are strict in output/swept-face-target-continuation-20260910; 00111611 and 00974931 retain rebuild failures. This is not family completion.
SWEPT_EDGE 1511 CADFS FeatureScript 1511 exported query history; direct-prism BRepPrimAPI_MakePrism.Generated(vertex) relation One immediate downstream consumer of an independent, undrafted, new_body blind prism: a source profile vertex, identified by its complete incident source-edge set -> its generated vertical edge Limited end-to-end contract. The source vertex must retain two exact direct-profile edge anchors and the generated relation must be complete and active. One analytic contour region may contain hole wires: all wires are passed once to BRepBuilderAPI_MakeFace, then each retained anchor is checked against the finished face with IsSame. A profile with multiple regions and any hole stays on the established Face.make_holes path with no anchors, preserving its executable geometry. IMPRINT/split or otherwise mutated profiles, draft, multiple/two-sided extents, fused results, boolean/SPLIT successors, revolve, sweep, loft, copy and pattern are rejected; this is not family completion. Corpus evidence: 00000715 F3; 00007264 F2 resolves four selectors by kernel lineage but is comparison-rejected; 00039669 F2 is strict/RP passing; 00151159 F2 is RP passing.
INTERSECT 1511 CADFS FeatureScript 1511 exported query history; OCC boolean SectionEdges() plus exact Generated(face) handles from both inputs One INTERSECT EDGE of exactly two source-qualified direct-prism CAP_FACE/SWEPT_FACE inputs from either one explicit boolean_bodies target/tool pair, or one immediate primary extrude_cut_blind target plus its transient direct-prism tool snapshot The adapter creates a relation only when the same section edge is returned by Generated(face) for exactly one face in each boolean input and IsSame binds all three handles to the input/final snapshots. A primary cut records its tool only as transient historical topology: exactly one active target solid/member, one tool solid, complete direct-prism anchors/history and one immediate consumer are required; the tool itself cannot be selected. Resolver requires one complete relation, the intersection/one policy and final active member. Unqualified SectionEdges(), duplicate output edges, incomplete source snapshots, keep-tools, multiple target/tool members, copied/transformed/patterned/TDD/IMPRINT inputs, non-direct prisms, primary query disambiguationData whose FeatureScript semantics are unverified, and unknown versions remain rejected. This is a contract test boundary; 00020311/00029250 retain their F3 checkpoints because their OD(0/1) selectors are deferred. Real-corpus RP evidence is not yet sufficient to mark general INTERSECT replay complete.

Source Sketch Path Queries (Not Runtime Selector Capabilities)

This section is intentionally outside the resolver allow-list above. The query does not select rebuilt body topology: it selects source sketch reference-wire geometry while lowering a sweep path. It therefore creates no selector_intent, kernel-lineage relation, or stable-ID fallback permission.

Source query / consumer FeatureScript version Source evidence Lowering and runtime boundary Evidence
qUnion([qConstructionFilter(qBodyType(qCreatedBy(sketch, EDGE), WIRE), NO)]) as sweep.path 1511 + direct onshape/std/geometry.fs@1511.0 Local Onshape standard-library mirror query.fs: BodyType.WIRE describes sketch curves (lines or curves), qBodyType retains entities owned by that body type, and qConstructionFilter(..., NO) retains only non-construction entities. The repository does not vendor the exact 1511 standard-library snapshot, so this is source-semantics evidence rather than a claim that all revisions are compatible. The owner must resolve to a source sketch with exactly one non-construction entity, whose exact source type is line or bspline; the outer query must be the exact singleton qUnion wrapper. line paths retain their endpoints. bspline paths retain the exported interpolation points, parameters, and endpoint derivatives; a two-point B-spline is executable only when both derivatives are present. Multiple entities, arcs/circles, construction-only geometry, omitted wrapper/filter, other query composition, other language/library revisions, loft guides, surface/profile consumers, and all runtime-body uses remain rejected or deferred. The fresh seven-sample RP matrix output/qbodytype-direct-sketch-wire-matrix-20260910-v1 rebuilds all direct-path cases: 00191739 is strict, 00726304 is RP-only approximate, 00227428/00287471/00500952/00816123 are comparison-rejected, and two-point B-spline 00896761 is comparison_timeout at 60 seconds. These are execution classifications, not a claim that rejected/timeout models are similar. 00786708 F2 remains deferred because F0 contains multiple non-construction path entities; its independent F5 single-line path still lowers.

Deferred source queries

Every CADFS topology selector now retains a selector_intent, including selectors for query families and source versions not present in this matrix. Such selectors use evidence: "feature_script_query" and a non-executable multiplicity: "none" policy. Their geometry and legacy stable ID remain diagnostic context only: TopologyRegistry.resolve rejects them before either can bind. Direct datum planes are the sole exception; they use query_family: "GEOMETRIC" with evidence: "explicit_datum" and retain the explicit-frame resolution path.

This closes the former legacy path where 1793 loft SWEPT_EDGE selectors in 00005267 F4 could bind from endpoint bounding boxes despite no registered FeatureScript query contract. The current result is a selector_query_unsupported failure with the executable F3 checkpoint exported. Equivalent bounded rejections now cover unproven CAP/SWEPT/OFFSET/COPY/INTERSECT fallbacks; they do not reduce the matrix's direct-prism coverage or claim general query support.

The repository does not currently vendor the FeatureScript standard-library sources for other versions or makeQuery encodings. They are not inferred from a 15xx prefix or a single corpus sample.