@buaa_smat/hometrans 26.0.7 → 26.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/a2h-executor.md +37 -0
- package/env-requirements.json +15 -1
- package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +2 -2
- package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +1 -1
- package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +13 -6
- package/i18n/skills/a2h-app-migrate/SKILL.md +2 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +27 -4
- package/i18n/skills/a2h-app-migrate/scripts/opencode_depth.mjs +418 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +7 -7
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +20 -2
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +3 -3
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +3 -1
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +10 -6
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +13 -9
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +59 -7
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +3 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/interactions.mjs +186 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +33 -7
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +83 -22
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +39 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +25 -1
- package/i18n/skills/a2h-page-specgen/SKILL.md +1 -1
- package/i18n/skills/a2h-page-specgen/references/gates.md +3 -1
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +11 -11
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +3 -3
- package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +40 -3
- package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +73 -5
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +144 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +10 -10
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +45 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +100 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +132 -3
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +36 -1
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +1 -1
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +16 -0
- package/i18n/skills/a2h-utg-static/SKILL.md +2 -0
- package/package.json +1 -1
- package/platforms/atomcode/agents/a2h-executor.frontmatter.md +6 -0
- package/platforms/codebuddy/agents/a2h-executor.frontmatter.md +5 -0
- package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +2 -2
- package/platforms/deveco/agents/a2h-executor.frontmatter.md +7 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +0 -2
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +0 -2
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +0 -2
- package/platforms/deveco/agents/model-worker.frontmatter.md +0 -2
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +0 -2
- package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +1 -1
- package/platforms/opencode/agents/a2h-executor.frontmatter.md +7 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +0 -2
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +0 -2
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +0 -2
- package/platforms/opencode/agents/model-worker.frontmatter.md +0 -2
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +0 -2
- package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +13 -6
- package/skills/a2h-app-migrate/SKILL.md +29 -3
- package/skills/a2h-app-migrate/references/host-rules.md +33 -0
- package/skills/a2h-app-migrate/references/workflow.yaml +24 -4
- package/skills/a2h-app-migrate/scripts/opencode_depth.mjs +418 -0
- package/skills/a2h-app-migrate/test/test_executor_header_sync.mjs +78 -0
- package/skills/a2h-app-migrate/test/test_opencode_depth.mjs +312 -0
- package/skills/a2h-app-migrate/tools/dag.mjs +267 -0
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -0
- package/skills/a2h-batch-ui-align/SKILL.md +7 -7
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -1
- package/skills/a2h-batch-ui-align/references/cards/state.md +20 -2
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +2 -2
- package/skills/a2h-batch-ui-align/references/checker-rules.md +3 -3
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +3 -1
- package/skills/a2h-batch-ui-align/references/host-dispatch.md +5 -5
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +2 -2
- package/skills/a2h-batch-ui-align/references/step3-capture.md +10 -6
- package/skills/a2h-batch-ui-align/references/step5-convert.md +13 -9
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +59 -7
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +3 -0
- package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +3 -2
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +139 -23
- package/skills/a2h-batch-ui-align/scripts/host_env.mjs +32 -8
- package/skills/a2h-batch-ui-align/scripts/interactions.mjs +186 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +33 -7
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +83 -22
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +39 -5
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +82 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +25 -1
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +184 -2
- package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +33 -0
- package/skills/a2h-batch-ui-align/scripts/tests/interactions.test.mjs +258 -0
- package/skills/a2h-page-specgen/SKILL.md +1 -1
- package/skills/a2h-page-specgen/references/evidence.md +15 -0
- package/skills/a2h-page-specgen/references/gates.md +3 -1
- package/skills/a2h-page-specgen/references/scenario-authoring.md +10 -10
- package/skills/a2h-page-specgen/references/spec-template.md +2 -2
- package/skills/a2h-page-specgen/scripts/contract-calls.mjs +40 -3
- package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +73 -5
- package/skills/a2h-page-specgen/scripts/gate.mjs +141 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +1 -1
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +45 -1
- package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +100 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +104 -3
- package/skills/a2h-resource-convert/references/conversion-rules.md +2 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +36 -1
- package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +42 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +1 -1
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +16 -0
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +5 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +2 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +3 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-v2-observation-cn.md +105 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-v2-observation-en.md +122 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +4 -4
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIV2ObservationCheck.js +1862 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +2 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +15 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +20 -4
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_v2_observation.ts +284 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +32 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +22 -1
- package/skills/a2h-utg-static/SKILL.md +2 -0
- package/skills/a2h-utg-static/references/extractors.md +16 -0
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +22 -1
- package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +4 -0
- package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +15 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_attachments.mjs +330 -0
- package/skills/a2h-utg-static/scripts/view_attachments.mjs +465 -0
- package/platforms/codebuddy/agents/build-fixer.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/model-worker.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +0 -5
|
@@ -26,7 +26,7 @@ import path from "node:path";
|
|
|
26
26
|
import { canonicalSourcePath, stableDigest } from "./behavior-model.mjs";
|
|
27
27
|
import { stripJsComments, stripSourceComments } from "./lib/source-text.mjs";
|
|
28
28
|
|
|
29
|
-
export const CONTRACT_CALLS_SCHEMA_VERSION =
|
|
29
|
+
export const CONTRACT_CALLS_SCHEMA_VERSION = 3; // v3: `targets` is projected per (file, symbol); each target carries `target_symbols`.
|
|
30
30
|
export const DEFAULT_MAX_CONTRACT_TARGETS = 128;
|
|
31
31
|
const MAX_SOURCE_BYTES = 1_000_000;
|
|
32
32
|
|
|
@@ -277,7 +277,7 @@ function emptyResult(pageId) {
|
|
|
277
277
|
omitted: [],
|
|
278
278
|
source_contracts: sourceContracts,
|
|
279
279
|
counts: {
|
|
280
|
-
calls: 0, kept: 0, deferred: 0, not_contract: 0,
|
|
280
|
+
calls: 0, targets: 0, kept: 0, deferred: 0, not_contract: 0,
|
|
281
281
|
reviewed_scope: 0, contract_path: 0, omitted: 0,
|
|
282
282
|
},
|
|
283
283
|
};
|
|
@@ -373,6 +373,33 @@ function callSortKey(call) {
|
|
|
373
373
|
].join("\u0000");
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
+
/**
|
|
377
|
+
* One evidence record per (file, symbol). A service file often exposes several transport
|
|
378
|
+
* functions; the file-level target kept only the first symbol, so the projection expands it back.
|
|
379
|
+
*
|
|
380
|
+
* `kinds` and `signals` stay file-level summaries (the transport classification runs on the file);
|
|
381
|
+
* `call_sites` are narrowed to the symbol so each record still points at its own calls. A call site
|
|
382
|
+
* with a null `target_symbol` cannot be attributed to one symbol, so it is copied into every
|
|
383
|
+
* expanded record (the payload may show that site more than once).
|
|
384
|
+
*/
|
|
385
|
+
function expandTargetSymbols(targets) {
|
|
386
|
+
const out = [];
|
|
387
|
+
for (const target of targets) {
|
|
388
|
+
const symbols = Array.isArray(target.target_symbols) && target.target_symbols.length > 0
|
|
389
|
+
? [...new Set(target.target_symbols)]
|
|
390
|
+
: [target.target_symbol];
|
|
391
|
+
for (const symbol of symbols) {
|
|
392
|
+
out.push({
|
|
393
|
+
...target,
|
|
394
|
+
target_symbol: symbol,
|
|
395
|
+
call_sites: (target.call_sites ?? []).filter(site =>
|
|
396
|
+
site.target_symbol === undefined || site.target_symbol === null || site.target_symbol === symbol),
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return out;
|
|
401
|
+
}
|
|
402
|
+
|
|
376
403
|
/**
|
|
377
404
|
* Collect contract-only calls for one page.
|
|
378
405
|
*
|
|
@@ -573,6 +600,7 @@ export function collectContractCalls({
|
|
|
573
600
|
targets.set(target, {
|
|
574
601
|
locator: target,
|
|
575
602
|
target_symbol: targetSymbol,
|
|
603
|
+
target_symbols: [],
|
|
576
604
|
platform: classification.platform,
|
|
577
605
|
kinds: [...classification.kinds],
|
|
578
606
|
signals: [...classification.signals],
|
|
@@ -580,11 +608,15 @@ export function collectContractCalls({
|
|
|
580
608
|
});
|
|
581
609
|
}
|
|
582
610
|
const targetRecord = targets.get(target);
|
|
611
|
+
if (targetSymbol !== null && !targetRecord.target_symbols.includes(targetSymbol)) {
|
|
612
|
+
targetRecord.target_symbols.push(targetSymbol);
|
|
613
|
+
}
|
|
583
614
|
targetRecord.kinds = [...new Set([...targetRecord.kinds, ...classification.kinds])].sort(cmp);
|
|
584
615
|
targetRecord.signals = [...new Set([...targetRecord.signals, ...classification.signals])].sort(cmp);
|
|
585
616
|
targetRecord.call_sites.push({
|
|
586
617
|
from,
|
|
587
618
|
kind,
|
|
619
|
+
target_symbol: targetSymbol,
|
|
588
620
|
line: Number.isInteger(row.line) ? row.line : null,
|
|
589
621
|
col: Number.isInteger(row.col) ? row.col : null,
|
|
590
622
|
});
|
|
@@ -616,6 +648,7 @@ export function collectContractCalls({
|
|
|
616
648
|
for (const target of kept) {
|
|
617
649
|
dispose(target.locator, "kept", "contract-signal", {
|
|
618
650
|
target_symbol: target.target_symbol,
|
|
651
|
+
target_symbols: target.target_symbols,
|
|
619
652
|
kinds: target.kinds,
|
|
620
653
|
signals: target.signals,
|
|
621
654
|
});
|
|
@@ -623,6 +656,7 @@ export function collectContractCalls({
|
|
|
623
656
|
for (const target of omitted) {
|
|
624
657
|
dispose(target.locator, "omitted", "contract-evidence-limit", {
|
|
625
658
|
target_symbol: target.target_symbol,
|
|
659
|
+
target_symbols: target.target_symbols,
|
|
626
660
|
kinds: target.kinds,
|
|
627
661
|
signals: target.signals,
|
|
628
662
|
});
|
|
@@ -691,18 +725,21 @@ export function collectContractCalls({
|
|
|
691
725
|
const sourceContracts = extractSourceContracts(contracts);
|
|
692
726
|
|
|
693
727
|
const dispositionList = [...dispositions.values()].sort((a, b) => cmp(a.locator, b.locator));
|
|
728
|
+
const expandedKept = expandTargetSymbols(kept);
|
|
694
729
|
const payload = {
|
|
695
730
|
schema_version: CONTRACT_CALLS_SCHEMA_VERSION,
|
|
696
731
|
page_id: pageId,
|
|
697
732
|
calls: keptCalls,
|
|
698
|
-
targets:
|
|
733
|
+
targets: expandedKept,
|
|
699
734
|
dispositions: dispositionList,
|
|
700
735
|
deferred: deferredCalls,
|
|
701
736
|
omitted,
|
|
702
737
|
source_contracts: sourceContracts,
|
|
703
738
|
counts: {
|
|
704
739
|
calls: callCount,
|
|
740
|
+
// kept/omitted describe the file-level budget; targets counts the expanded (file, symbol) evidence.
|
|
705
741
|
kept: kept.length,
|
|
742
|
+
targets: expandedKept.length,
|
|
706
743
|
deferred: dispositionList.filter(item => item.disposition === "deferred").length,
|
|
707
744
|
not_contract: dispositionList.filter(item => item.disposition === "not-contract").length,
|
|
708
745
|
reviewed_scope: dispositionList.filter(item => item.disposition === "reviewed-scope").length,
|
|
@@ -832,6 +832,63 @@ function dbImplementations(db, targetPage, targetOrigin) {
|
|
|
832
832
|
return implementations;
|
|
833
833
|
}
|
|
834
834
|
|
|
835
|
+
/** File part of a `path:line` locator. */
|
|
836
|
+
function locatorFile(locator) {
|
|
837
|
+
const value = normalizeLocator(locator);
|
|
838
|
+
if (value === null) return null;
|
|
839
|
+
const match = /^(.*):\d+$/.exec(value);
|
|
840
|
+
return match === null ? value : match[1];
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/** The name part of a `kind:name` node id. */
|
|
844
|
+
function pageIdName(pageId) {
|
|
845
|
+
const value = firstString(pageId);
|
|
846
|
+
return value === null ? null : value.replace(/^[^:]*:/, "");
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Implementation identities recoverable from `declared_at` and the page-body source unit when the
|
|
851
|
+
* page/origin registers no `fqn` (e.g. UTG nodes for sheets/overlays carry only `declared_at`).
|
|
852
|
+
* The node is looked up by file + the origin/page label, so the same exact `qualified_name` +
|
|
853
|
+
* `file_path` contract as `explicitImplementations` still governs the match.
|
|
854
|
+
*/
|
|
855
|
+
function derivedImplementations({ targetPage, targetOrigin, db }) {
|
|
856
|
+
if (!db || typeof db.prepare !== "function") return [];
|
|
857
|
+
const pageBody = targetPage?.behavior && Array.isArray(targetPage.behavior.source_units)
|
|
858
|
+
? targetPage.behavior.source_units.filter(unit => unit?.role === "page-body").map(unit => unit?.locator)
|
|
859
|
+
: [];
|
|
860
|
+
const files = uniqueStrings([
|
|
861
|
+
locatorFile(targetOrigin?.declared_at),
|
|
862
|
+
locatorFile(targetPage?.declared_at),
|
|
863
|
+
...pageBody.map(locatorFile),
|
|
864
|
+
]);
|
|
865
|
+
const names = new Set(uniqueStrings([
|
|
866
|
+
targetOrigin?.label, targetPage?.label,
|
|
867
|
+
pageIdName(targetOrigin?.page_id), pageIdName(targetPage?.page_id),
|
|
868
|
+
]).map(name => String(name).trim()).filter(name => name !== ""));
|
|
869
|
+
if (files.length === 0 || names.size === 0) return [];
|
|
870
|
+
let statement;
|
|
871
|
+
try {
|
|
872
|
+
statement = db.prepare("SELECT name, qualified_name, file_path FROM nodes WHERE file_path = ?");
|
|
873
|
+
} catch {
|
|
874
|
+
return [];
|
|
875
|
+
}
|
|
876
|
+
const out = [];
|
|
877
|
+
for (const file of files) {
|
|
878
|
+
let rows = [];
|
|
879
|
+
try { rows = statement.all(file); } catch { continue; }
|
|
880
|
+
for (const row of rows) {
|
|
881
|
+
const name = firstString(row?.name);
|
|
882
|
+
const qualifiedName = firstString(row?.qualified_name);
|
|
883
|
+
const filePath = normalizeLocator(row?.file_path);
|
|
884
|
+
if (name !== null && names.has(name) && qualifiedName !== null && filePath !== null) {
|
|
885
|
+
out.push({ qualified_name: qualifiedName, file_path: filePath });
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return out;
|
|
890
|
+
}
|
|
891
|
+
|
|
835
892
|
function readableCurrentSource(sourceProject, locator) {
|
|
836
893
|
if (typeof sourceProject !== "string" || sourceProject === "" || locator === null) return false;
|
|
837
894
|
try {
|
|
@@ -843,15 +900,15 @@ function readableCurrentSource(sourceProject, locator) {
|
|
|
843
900
|
}
|
|
844
901
|
|
|
845
902
|
/** Resolve only a qualified callee independently backed by the target implementation. */
|
|
846
|
-
function implementationMatch({ item, targetPage, targetOrigin, db, sourceProject }) {
|
|
903
|
+
function implementationMatch({ item, targetPage, targetOrigin, db, sourceProject, implementations = null }) {
|
|
847
904
|
if (dynamicDispatch(item)) return null;
|
|
848
905
|
const identity = calleeIdentity(item);
|
|
849
906
|
if (identity === null || !readableCurrentSource(sourceProject, identity.file_path)) return null;
|
|
850
|
-
const
|
|
907
|
+
const pool = implementations ?? [
|
|
851
908
|
...explicitImplementations(targetPage, targetOrigin),
|
|
852
909
|
...dbImplementations(db, targetPage, targetOrigin),
|
|
853
910
|
];
|
|
854
|
-
return
|
|
911
|
+
return pool.some(implementation =>
|
|
855
912
|
implementation.qualified_name === identity.qualified_name
|
|
856
913
|
&& implementation.file_path === identity.file_path)
|
|
857
914
|
? identity
|
|
@@ -896,9 +953,18 @@ function outboundFor({ pages, pageById, db, query, sourceProject }) {
|
|
|
896
953
|
const fromDb = dbCallees(db, edge);
|
|
897
954
|
const items = [...(fromQuery?.items ?? []), ...(fromDb?.items ?? [])];
|
|
898
955
|
const partial = [fromQuery, fromDb].find(result => result?.status === "partial") ?? null;
|
|
956
|
+
const implementations = [
|
|
957
|
+
...explicitImplementations(targetPage, targetOrigin),
|
|
958
|
+
...dbImplementations(db, targetPage, targetOrigin),
|
|
959
|
+
];
|
|
960
|
+
// The derived fallback exists only for origins that register no FQN. With an FQN present,
|
|
961
|
+
// a same-named node in the declared_at file must not weaken the exact identity check.
|
|
962
|
+
if (targetQualifiedNames(targetPage, targetOrigin).length === 0) {
|
|
963
|
+
implementations.push(...derivedImplementations({ targetPage, targetOrigin, db }));
|
|
964
|
+
}
|
|
899
965
|
const matches = items.map(item => ({
|
|
900
966
|
item,
|
|
901
|
-
implementation: implementationMatch({ item, targetPage, targetOrigin, db, sourceProject }),
|
|
967
|
+
implementation: implementationMatch({ item, targetPage, targetOrigin, db, sourceProject, implementations }),
|
|
902
968
|
}));
|
|
903
969
|
const validated = matches.find(match => match.implementation !== null) ?? null;
|
|
904
970
|
const dynamic = items.some(dynamicDispatch);
|
|
@@ -906,7 +972,9 @@ function outboundFor({ pages, pageById, db, query, sourceProject }) {
|
|
|
906
972
|
const status = resolved ? "resolved" : "partial";
|
|
907
973
|
const reason = status === "resolved" ? null
|
|
908
974
|
: partial?.reason ?? (items.length === 0 ? "outbound-callees-missing"
|
|
909
|
-
: dynamic && validated === null ? "outbound-dynamic-dispatch-unresolved"
|
|
975
|
+
: dynamic && validated === null ? "outbound-dynamic-dispatch-unresolved"
|
|
976
|
+
: implementations.length === 0 ? "outbound-implementation-unavailable"
|
|
977
|
+
: "outbound-target-unresolved");
|
|
910
978
|
const record = {
|
|
911
979
|
source: page.page_id,
|
|
912
980
|
target: edge.target,
|
|
@@ -108,6 +108,125 @@ function factPattern(token) {
|
|
|
108
108
|
return null;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Parameters that must appear in the four-label field table: `query` and `body`.
|
|
113
|
+
* A path/header-only endpoint stays prose (its values are positional or metadata, not selectable fields).
|
|
114
|
+
*
|
|
115
|
+
* @param {object|null|undefined} contracts
|
|
116
|
+
* @returns {object[]}
|
|
117
|
+
*/
|
|
118
|
+
function endpointTableParams(contracts) {
|
|
119
|
+
if (contracts === null || typeof contracts !== "object" || Array.isArray(contracts)) return [];
|
|
120
|
+
const endpoints = Array.isArray(contracts.endpoints) ? contracts.endpoints : [];
|
|
121
|
+
const out = [];
|
|
122
|
+
for (const endpoint of endpoints) {
|
|
123
|
+
if (endpoint === null || typeof endpoint !== "object" || Array.isArray(endpoint)) continue;
|
|
124
|
+
const params = Array.isArray(endpoint.params) ? endpoint.params : [];
|
|
125
|
+
for (const param of params) {
|
|
126
|
+
if (param === null || typeof param !== "object" || Array.isArray(param)) continue;
|
|
127
|
+
if ((param.in === "query" || param.in === "body") && typeof param.name === "string" && param.name.trim() !== "") out.push(param);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** The field name of one field-table row, or "" when the line is not a row. */
|
|
134
|
+
function fieldTableRowName(line) {
|
|
135
|
+
const match = /\bfield\s*[::]\s*([^\s ]+)/.exec(line);
|
|
136
|
+
return match === null ? "" : match[1];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const BODY_TABLE_LABELS = ["field:", "type/encoding:", "default:", "send:"];
|
|
140
|
+
// Word boundaries keep prose such as "response field:" from counting as a table label.
|
|
141
|
+
const BODY_TABLE_LABEL_RES = [
|
|
142
|
+
/\bfield\s*[::]/,
|
|
143
|
+
/\btype\/encoding\s*[::]/,
|
|
144
|
+
/\bdefault\s*[::]/,
|
|
145
|
+
/\bsend\s*[::]/,
|
|
146
|
+
];
|
|
147
|
+
const BODY_TABLE_ROW_RE = /\bfield\s*[::]/;
|
|
148
|
+
const BODY_TABLE_SEND_RE = /\bsend\s*[::]/;
|
|
149
|
+
const BODY_SEND_VALUES = ["required", "optional", "never"];
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* A declared request (`query` / `body`) must be written as the four-label field table
|
|
153
|
+
* (`field:` / `type/encoding:` / `default:` / `send:`).
|
|
154
|
+
*
|
|
155
|
+
* Checked only for scenarios that declare at least one `in: "query"` or `in: "body"` parameter,
|
|
156
|
+
* so a path/header-only endpoint is never required to carry a table.
|
|
157
|
+
*
|
|
158
|
+
* @param {object|null|undefined} contracts
|
|
159
|
+
* @param {unknown} steps
|
|
160
|
+
* @returns {string[]} one entry per missing label, row, or send rule
|
|
161
|
+
*/
|
|
162
|
+
function missingFieldTable(contracts, steps) {
|
|
163
|
+
const params = endpointTableParams(contracts);
|
|
164
|
+
if (params.length === 0) return [];
|
|
165
|
+
const text = (Array.isArray(steps) ? steps : []).map((step) => String(step ?? "")).join("\n");
|
|
166
|
+
const missing = [];
|
|
167
|
+
for (let i = 0; i < BODY_TABLE_LABELS.length; i++) {
|
|
168
|
+
if (!BODY_TABLE_LABEL_RES[i].test(text)) missing.push(`missing "${BODY_TABLE_LABELS[i]}"`);
|
|
169
|
+
}
|
|
170
|
+
if (missing.length > 0) return missing;
|
|
171
|
+
const rows = text.split(/\r?\n/).filter((line) => BODY_TABLE_ROW_RE.test(line) && BODY_TABLE_SEND_RE.test(line));
|
|
172
|
+
const rowNames = new Set(rows.map(fieldTableRowName).filter((name) => name !== ""));
|
|
173
|
+
for (const param of params) {
|
|
174
|
+
const name = param.name.trim();
|
|
175
|
+
if (!rowNames.has(name)) missing.push(`missing field row "${name}"`);
|
|
176
|
+
}
|
|
177
|
+
for (const line of rows) {
|
|
178
|
+
const name = fieldTableRowName(line);
|
|
179
|
+
const send = /\bsend\s*[::]\s*([^\s ]+)/.exec(line);
|
|
180
|
+
if (send === null || !BODY_SEND_VALUES.some((value) => send[1].startsWith(value))) {
|
|
181
|
+
missing.push(`row "${name === "" ? "?" : name}" send segment does not start with ${BODY_SEND_VALUES.join("/")}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return missing;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const BODY_REQUEST_VERB_RE = /\b(?:POST|PUT|PATCH)\b/i;
|
|
188
|
+
const BODY_REQUEST_URL_RE = /https?:\/\//i;
|
|
189
|
+
const BODY_REQUEST_LANGUAGE_RE = /(请求体|请求参数|\bbody\b|表单|request\s+parameters?|\bforms?\b)/i;
|
|
190
|
+
const BODY_REQUEST_NO_BODY_RE = /(不携带[^。;;,,\n]{0,12}请求体|无请求体|不带请求体|没有请求体|不携带[^。;;,,\n]{0,12}请求参数|无请求参数|不带请求参数|没有请求参数|no\s+(?:request\s+)?body|without\s+(?:a\s+)?(?:request\s+)?body|does\s+not\s+(?:carry|send|include)\s+(?:a\s+)?(?:request\s+)?body)/i;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Warnings for a body-shaped request described in steps without a declared body contract.
|
|
194
|
+
*
|
|
195
|
+
* The hard check (`missingFieldTable`) owns scenarios that declare `in: "query"`/`in: "body"`
|
|
196
|
+
* params. This warning targets the case where no body contract is projected at all (e.g. operations
|
|
197
|
+
* owned by `external`, which the ledger does not project): the steps still describe a request body
|
|
198
|
+
* (or carry a request-parameter field table) that no `contracts.endpoints[]` backs. Warn-only
|
|
199
|
+
* because prose detection is a heuristic; an explicit "不携带请求体" statement closes it.
|
|
200
|
+
*
|
|
201
|
+
* @param {object|null|undefined} contracts
|
|
202
|
+
* @param {unknown} steps
|
|
203
|
+
* @returns {string[]}
|
|
204
|
+
*/
|
|
205
|
+
function bodyRequestWarnings(contracts, steps) {
|
|
206
|
+
if (endpointTableParams(contracts).length > 0) return [];
|
|
207
|
+
const endpoints = contracts !== null && typeof contracts === "object" && !Array.isArray(contracts)
|
|
208
|
+
&& Array.isArray(contracts.endpoints) ? contracts.endpoints : [];
|
|
209
|
+
const hasEndpoints = endpoints.length > 0;
|
|
210
|
+
const out = [];
|
|
211
|
+
for (const raw of Array.isArray(steps) ? steps : []) {
|
|
212
|
+
const step = String(raw ?? "");
|
|
213
|
+
if (BODY_REQUEST_NO_BODY_RE.test(step)) continue;
|
|
214
|
+
const hasTable = step.split(/\r?\n/).some((line) => BODY_TABLE_ROW_RE.test(line) && BODY_TABLE_SEND_RE.test(line));
|
|
215
|
+
if (hasTable) {
|
|
216
|
+
out.push(hasEndpoints
|
|
217
|
+
? "steps carry a request parameter field table but contracts.endpoints[].params declares no matching query/body parameter"
|
|
218
|
+
: "steps carry a request parameter field table but scenarios[].contracts.endpoints is not declared");
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (BODY_REQUEST_VERB_RE.test(step) && BODY_REQUEST_URL_RE.test(step) && BODY_REQUEST_LANGUAGE_RE.test(step)) {
|
|
222
|
+
out.push(hasEndpoints
|
|
223
|
+
? "steps describe a request body but contracts.endpoints[].params has no matching body parameter"
|
|
224
|
+
: "steps describe a request body but scenarios[].contracts.endpoints is not declared");
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return Array.from(new Set(out));
|
|
228
|
+
}
|
|
229
|
+
|
|
111
230
|
/**
|
|
112
231
|
* Fact tokens from a scenario's `contracts` that never made it into the merged steps.
|
|
113
232
|
*
|
|
@@ -464,6 +583,31 @@ function runGates(opts, { partial }) {
|
|
|
464
583
|
hint: "Write each fact naturally into the step that consumes it; keep the existing step count and order",
|
|
465
584
|
});
|
|
466
585
|
}
|
|
586
|
+
|
|
587
|
+
// A declared request (`query` / `body`) must be a four-label field table
|
|
588
|
+
// (spec-template.md). Only scenarios that declare those parameters are checked; a
|
|
589
|
+
// path/header-only endpoint is not required to carry a table.
|
|
590
|
+
const missingFieldTableIssues = missingFieldTable(scenarioDraft?.contracts, scenarioDraft?.steps);
|
|
591
|
+
if (missingFieldTableIssues.length > 0) {
|
|
592
|
+
failures.push({
|
|
593
|
+
gate: "G2",
|
|
594
|
+
spec_id,
|
|
595
|
+
message: `scenario ${scenarioNumber} declares query/body parameters but its steps lack the four-label field table: ${missingFieldTableIssues.join("; ")}`,
|
|
596
|
+
hint: "Write query and body parameters as the four-label table (field:/type/encoding:/default:/send:), one row per field, with send: starting with required/optional/never followed by the condition",
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// A body-shaped request described in steps without any body contract (e.g. an `external`
|
|
601
|
+
// operation that the ledger does not project) is a warning, not a failure: prose detection
|
|
602
|
+
// is a heuristic and "不携带请求体" closes it.
|
|
603
|
+
for (const alert of bodyRequestWarnings(scenarioDraft?.contracts, scenarioDraft?.steps)) {
|
|
604
|
+
warnings.push({
|
|
605
|
+
gate: "G2",
|
|
606
|
+
spec_id,
|
|
607
|
+
message: `scenario ${scenarioNumber}: ${alert}`,
|
|
608
|
+
hint: "If the request truly has no body, state 不携带请求体 in the steps; otherwise add the endpoint/body parameters or explain why they are not projected",
|
|
609
|
+
});
|
|
610
|
+
}
|
|
467
611
|
}
|
|
468
612
|
for (let i = draftScenarios.length; i < zones.scenarios.length; i++) {
|
|
469
613
|
failures.push({
|
package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md
CHANGED
|
@@ -306,18 +306,18 @@ Review every lifecycle-signal candidate and choose one of three: a user-observab
|
|
|
306
306
|
|
|
307
307
|
Timing wording follows the source: "refreshes immediately" when it takes effect on completion, "re-read on return" or "re-read on next entry" when it waits until the page is visible again — never mix the two. An axis scenario's trigger sequence starts from the timing event, and its last step lands on an assertable observable outcome.
|
|
308
308
|
|
|
309
|
-
### Request
|
|
309
|
+
### Request Parameters and Responses
|
|
310
310
|
|
|
311
|
-
When a scenario performs a network request, write the request body as a **tree-shaped field table inside the request step that sends it
|
|
311
|
+
When a scenario performs a network request, write the request parameters (`query` and `body`) as a **tree-shaped field table inside the request step that sends it**; list path parameters and request headers explicitly with their `in`. Write the response key by key.
|
|
312
312
|
|
|
313
313
|
The table has four fixed, labelled segments in a fixed order and is a top-level fenced code block, so every renderer keeps its line breaks:
|
|
314
314
|
|
|
315
315
|
```text
|
|
316
|
-
<Request
|
|
316
|
+
<Request parameter name>
|
|
317
317
|
├─ field:<path> type/encoding:<type> default:<value> send:<rule>
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
-
- **Write every key**: list each key of the source's request
|
|
320
|
+
- **Write every key**: list each key of the source's request construction (`query` or `body`), including keys that are **always the default**, **always sent**, or **never sent on this page**; dropping one is a failure, and fields may not be picked by scenario. **A field with a default is not necessarily sent** — whether it appears must be confirmed from the source's serializer or request-construction site.
|
|
321
321
|
- `field:` a top-level field is written with its plain name; a nested leaf is `a.b`; an array element is `a[].b`; the array itself is `a[]` (type `array<T>`). A parent object appears together with its children; give it its own `object` row only when the parent itself carries a send rule.
|
|
322
322
|
- `type/encoding:` only the closed vocabulary `string`, `int`, `int64`, `float`, `double`, `bool`, `object`, `array<T>`; put a time format, a byte encoding or a radix in parentheses (`string(yyyy-MM-dd HH:mm)`, `string(Base64)`, `int(>=1)`). Never write "text" or "number" as loose prose, and keep the token byte-identical to the contract's `type`.
|
|
323
323
|
- `default:` `—` means the field has no default value; strings are quoted; write only the value, never whether the key is sent.
|
|
@@ -325,22 +325,22 @@ The table has four fixed, labelled segments in a fixed order and is a top-level
|
|
|
325
325
|
- `required`: the key is always present. Stop there when a missing source value is a defect; add ", falls back to the default" when the default fills it, and name the source or failure when it matters, for example ", falls back to the default unknown when it cannot be read";
|
|
326
326
|
- `optional`: the key may be absent, immediately followed by a decidable condition written as ", not sent when <condition>" or ", sent only when <condition>", for example ", not sent when it has no value", ", not sent when the array is empty", ", not sent when it equals the default 0", ", not sent when the source cannot be determined", ", not sent when the user specifies no insert position";
|
|
327
327
|
- `never`: never appears; the field stays in the data model and is skipped when serializing.
|
|
328
|
-
- Whether a key is sent follows the source's serializer or request-construction site: a nullable field, a field with a default, and a model-required field do not mean "always sent"
|
|
328
|
+
- Whether a key is sent follows the source's serializer or request-construction site: a nullable field, a field with a default, and a model-required field do not mean "always sent", and `"nullable": false` only means the value cannot be empty. **None of these is equivalent to `required`** — a field with a default may be omitted when it equals the default, and may also always be sent.
|
|
329
329
|
- The condition must be writable as a single `if`: name a concrete condition such as "has no value", "the array is empty", "equals the default", "the control is off", "nothing is selected", "cannot be read", "the source cannot be determined". Never write "as needed", "depending on", "generally", "maybe"; list every condition separately instead of "except in special cases".
|
|
330
330
|
- `required` and `optional` differ only in whether the key is always present; the `default:` segment says what value fills a missing value and never whether the key appears, so the two segments never substitute for each other. A boolean that uses `false` for "the user set nothing" must say "not sent when it equals the default false", not "not sent when it has no value".
|
|
331
331
|
- When writing a condition, "no value" means unassigned or `null`; for strings and arrays a length of 0 also counts as no value; `0` and `false` count as values.
|
|
332
|
-
- Start the step with an executable action, not a caption such as "the structure is as follows": "the request
|
|
332
|
+
- Start the step with an executable action, not a caption such as "the structure is as follows": "the request parameters are serialized field by field from the table below and then sent; the key order follows the table's row order and whether a key appears follows the send segment".
|
|
333
333
|
- Separate the segments with at least one space: the path after `field:` must not be glued to the next segment, or the path and `default:` read as a `file:line`; write `default:false`, never `default=false`; no table line starts with `#`.
|
|
334
|
-
- Name the table root in business terms (for example "sync request body"), never with the request type name from the source.
|
|
334
|
+
- Name the table root in business terms (for example "sync request body" or "weather query parameters"), never with the request type name from the source.
|
|
335
335
|
- When a field's value does not come from this page's input (local storage, the previous response, a fixed value, a computed value), add one line after the table naming each such field, for example: "Value sources: `userId` is the current signed-in user number in local storage, `deviceId` is the device identifier in local storage, and `payload` is the pending-queue record count." Fields fed by page input need no entry.
|
|
336
336
|
|
|
337
|
-
**Relation to the contracts.** Each table row is also declared once in that scenario's `contracts.endpoints[].params` with `in: "body"`, byte-identical. The contracts are the audited fact base: G2 compares every parameter name, default and value source against the step text, and one missing token fails the gate. The table is what the reader and the downstream coder see.
|
|
337
|
+
**Relation to the contracts.** Each table row is also declared once in that scenario's `contracts.endpoints[].params` with `in: "query"` or `in: "body"`, byte-identical. The contracts are the audited fact base: G2 compares every parameter name, default and value source against the step text, and one missing token fails the gate. The table is what the reader and the downstream coder see. Path parameters and headers are listed with their own `in` (no table required); key names, defaults and fixed values follow the source — never guess, and never drop a key that has a default.
|
|
338
338
|
|
|
339
339
|
**Response.** List one field path per string in `response_fields[]` (`current_temperature`, `hourly.temperatures[]`); the envelope (code/data/message), types, nullability and the handling of a missing or default-valued field go into that endpoint's `note` and are merged into the step — never into a `response_fields` element, because G2 requires each element to appear verbatim in the step.
|
|
340
340
|
|
|
341
341
|
**G2 checks verbatim.** A method, URL, parameter name, parameter default, value source or response field present in the contracts but absent from the steps fails the gate. The envelope, types, nullability and missing-value handling are outside that check and must still be written into the steps, not left in `contracts` alone.
|
|
342
342
|
|
|
343
|
-
When the same request appears in several scenarios, each scenario repeats the complete table; never write "same as above" or "see scenario 1". The send condition lives only in the table; the steps state the server behaviour or the user-visible result once the condition holds. When the body is an object or an array, state the nesting and every child key; never write "other fields", "etc.", or a single sample value.
|
|
343
|
+
When the same request appears in several scenarios, each scenario repeats the complete table; never write "same as above" or "see scenario 1". The send condition lives only in the table; the steps state the server behaviour or the user-visible result once the condition holds. When the body (or a nested query object) is an object or an array, state the nesting and every child key; never write "other fields", "etc.", or a single sample value.
|
|
344
344
|
|
|
345
345
|
### Platform-Neutral Body Text
|
|
346
346
|
|
|
@@ -436,9 +436,9 @@ Before submission, confirm all of the following:
|
|
|
436
436
|
- Numeric inputs state integer versus decimal and whether a negative value is accepted, with no “accepts digits only” standing in for the type; the decimal places, bounds, whitespace and invalid-character handling the source implements are written out, and no unimplemented constraint is written as existing behavior.
|
|
437
437
|
- Every data boundary names both sides — present (source and destination) and absent (what it does not carry, write or send, and where empty, missing or default goes); entries over one data set line up item by item, absent items are written out, and absence is never written as -1, 0 or an empty string.
|
|
438
438
|
- Every value answers where it comes from (including the field’s origin in the consuming code), how it is processed (including the inputs that change the result and the difference after they change), and where it is consumed; missing any of the three leaves the scenario incomplete.
|
|
439
|
-
- Every branch states how its condition is determined and both outcomes; every step traces to a source location or an evidence entry; whether a key is sent follows the source serializer, never
|
|
439
|
+
- Every branch states how its condition is determined and both outcomes; every step traces to a source location or an evidence entry; whether a key is sent follows the source serializer, never nullability (for example `"nullable": false`), a default value, or a model-required flag.
|
|
440
440
|
- Scenarios that create, read, update, or delete data, or synchronize state or data, list every affected piece of data and how it changes, with no vague “related data updates in sync.”
|
|
441
|
-
- Network scenarios write the request body as a field table inside the sending step, each row carrying the four labelled segments `field:`, `type/encoding:`, `default:` and `send:`; declare the same fields in `contracts.endpoints[].params`, list every value source that is not page input, start every send segment with `required`/`optional`/`never` and follow it with a decidable condition (never "as needed" or "depending on"), describe the response structure as fully as possible, and keep all of these facts in that same step.
|
|
441
|
+
- Network scenarios write the request parameters (`query` and `body`) as a field table inside the sending step, each row carrying the four labelled segments `field:`, `type/encoding:`, `default:` and `send:`; path parameters and headers are listed with their `in` (no table required); declare the same fields in `contracts.endpoints[].params`, list every value source that is not page input, start every send segment with `required`/`optional`/`never` and follow it with a decidable condition (never "as needed" or "depending on"), describe the response structure as fully as possible, and keep all of these facts in that same step.
|
|
442
442
|
- No vague phrase such as “handle all other errors uniformly” substitutes for concrete branches.
|
|
443
443
|
- Every scenario is independently readable, with no abbreviated cross-scenario references and no unsupported copy, branches, thresholds, or outcomes added to fill gaps.
|
|
444
444
|
- Each scenario is exactly one normal or one edge/boundary case, with no success/failure mix.
|
package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md
CHANGED
|
@@ -241,18 +241,18 @@ Review every lifecycle-signal candidate and choose one of three: a user-observab
|
|
|
241
241
|
|
|
242
242
|
Timing wording follows the source: "refreshes immediately" when it takes effect on completion, "re-read on return" or "re-read on next entry" when it waits until the page is visible again — never mix the two. An axis scenario's trigger sequence starts from the timing event, and its last step lands on an assertable observable outcome.
|
|
243
243
|
|
|
244
|
-
### Request
|
|
244
|
+
### Request Parameters and Responses
|
|
245
245
|
|
|
246
|
-
When a scenario performs a network request, write the request body as a **tree-shaped field table inside the request step that sends it
|
|
246
|
+
When a scenario performs a network request, write the request parameters (`query` and `body`) as a **tree-shaped field table inside the request step that sends it**; list path parameters and request headers explicitly with their `in`. Write the response key by key.
|
|
247
247
|
|
|
248
248
|
The table has four fixed, labelled segments in a fixed order and is a top-level fenced code block, so every renderer keeps its line breaks:
|
|
249
249
|
|
|
250
250
|
```text
|
|
251
|
-
<Request
|
|
251
|
+
<Request parameter name>
|
|
252
252
|
├─ field:<path> type/encoding:<type> default:<value> send:<rule>
|
|
253
253
|
```
|
|
254
254
|
|
|
255
|
-
- **Write every key**: list each key of the source's request
|
|
255
|
+
- **Write every key**: list each key of the source's request construction (`query` or `body`), including keys that are **always the default**, **always sent**, or **never sent on this page**; dropping one is a failure, and fields may not be picked by scenario. **A field with a default is not necessarily sent** — whether it appears must be confirmed from the source's serializer or request-construction site.
|
|
256
256
|
- `field:` a top-level field is written with its plain name; a nested leaf is `a.b`; an array element is `a[].b`; the array itself is `a[]` (type `array<T>`). A parent object appears together with its children; give it its own `object` row only when the parent itself carries a send rule.
|
|
257
257
|
- `type/encoding:` only the closed vocabulary `string`, `int`, `int64`, `float`, `double`, `bool`, `object`, `array<T>`; put a time format, a byte encoding or a radix in parentheses (`string(yyyy-MM-dd HH:mm)`, `string(Base64)`, `int(>=1)`). Never write "text" or "number" as loose prose, and keep the token byte-identical to the contract's `type`.
|
|
258
258
|
- `default:` `—` means the field has no default value; strings are quoted; write only the value, never whether the key is sent.
|
|
@@ -260,22 +260,22 @@ The table has four fixed, labelled segments in a fixed order and is a top-level
|
|
|
260
260
|
- `required`: the key is always present. Stop there when a missing source value is a defect; add ", falls back to the default" when the default fills it, and name the source or failure when it matters, for example ", falls back to the default unknown when it cannot be read";
|
|
261
261
|
- `optional`: the key may be absent, immediately followed by a decidable condition written as ", not sent when <condition>" or ", sent only when <condition>", for example ", not sent when it has no value", ", not sent when the array is empty", ", not sent when it equals the default 0", ", not sent when the source cannot be determined", ", not sent when the user specifies no insert position";
|
|
262
262
|
- `never`: never appears; the field stays in the data model and is skipped when serializing.
|
|
263
|
-
- Whether a key is sent follows the source's serializer or request-construction site: a nullable field, a field with a default, and a model-required field do not mean "always sent"
|
|
263
|
+
- Whether a key is sent follows the source's serializer or request-construction site: a nullable field, a field with a default, and a model-required field do not mean "always sent", and `"nullable": false` only means the value cannot be empty. **None of these is equivalent to `required`** — a field with a default may be omitted when it equals the default, and may also always be sent.
|
|
264
264
|
- The condition must be writable as a single `if`: name a concrete condition such as "has no value", "the array is empty", "equals the default", "the control is off", "nothing is selected", "cannot be read", "the source cannot be determined". Never write "as needed", "depending on", "generally", "maybe"; list every condition separately instead of "except in special cases".
|
|
265
265
|
- `required` and `optional` differ only in whether the key is always present; the `default:` segment says what value fills a missing value and never whether the key appears, so the two segments never substitute for each other. A boolean that uses `false` for "the user set nothing" must say "not sent when it equals the default false", not "not sent when it has no value".
|
|
266
266
|
- When writing a condition, "no value" means unassigned or `null`; for strings and arrays a length of 0 also counts as no value; `0` and `false` count as values.
|
|
267
|
-
- Start the step with an executable action, not a caption such as "the structure is as follows": "the request
|
|
267
|
+
- Start the step with an executable action, not a caption such as "the structure is as follows": "the request parameters are serialized field by field from the table below and then sent; the key order follows the table's row order and whether a key appears follows the send segment".
|
|
268
268
|
- Separate the segments with at least one space: the path after `field:` must not be glued to the next segment, or the path and `default:` read as a `file:line`; write `default:false`, never `default=false`; no table line starts with `#`.
|
|
269
|
-
- Name the table root in business terms (for example "sync request body"), never with the request type name from the source.
|
|
269
|
+
- Name the table root in business terms (for example "sync request body" or "weather query parameters"), never with the request type name from the source.
|
|
270
270
|
- When a field's value does not come from this page's input (local storage, the previous response, a fixed value, a computed value), add one line after the table naming each such field, for example: "Value sources: `userId` is the current signed-in user number in local storage, `deviceId` is the device identifier in local storage, and `payload` is the pending-queue record count." Fields fed by page input need no entry.
|
|
271
271
|
|
|
272
|
-
**Relation to the contracts.** Each table row is also declared once in that scenario's `contracts.endpoints[].params` with `in: "body"`, byte-identical. The contracts are the audited fact base: G2 compares every parameter name, default and value source against the step text, and one missing token fails the gate. The table is what the reader and the downstream coder see.
|
|
272
|
+
**Relation to the contracts.** Each table row is also declared once in that scenario's `contracts.endpoints[].params` with `in: "query"` or `in: "body"`, byte-identical. The contracts are the audited fact base: G2 compares every parameter name, default and value source against the step text, and one missing token fails the gate. The table is what the reader and the downstream coder see. Path parameters and headers are listed with their own `in` (no table required); key names, defaults and fixed values follow the source — never guess, and never drop a key that has a default.
|
|
273
273
|
|
|
274
274
|
**Response.** List one field path per string in `response_fields[]` (`current_temperature`, `hourly.temperatures[]`); the envelope (code/data/message), types, nullability and the handling of a missing or default-valued field go into that endpoint's `note` and are merged into the step — never into a `response_fields` element, because G2 requires each element to appear verbatim in the step.
|
|
275
275
|
|
|
276
276
|
**G2 checks verbatim.** A method, URL, parameter name, parameter default, value source or response field present in the contracts but absent from the steps fails the gate. The envelope, types, nullability and missing-value handling are outside that check and must still be written into the steps, not left in `contracts` alone.
|
|
277
277
|
|
|
278
|
-
When the same request appears in several scenarios, each scenario repeats the complete table; never write "same as above" or "see scenario 1". The send condition lives only in the table; the steps state the server behaviour or the user-visible result once the condition holds. When the body is an object or an array, state the nesting and every child key; never write "other fields", "etc.", or a single sample value.
|
|
278
|
+
When the same request appears in several scenarios, each scenario repeats the complete table; never write "same as above" or "see scenario 1". The send condition lives only in the table; the steps state the server behaviour or the user-visible result once the condition holds. When the body (or a nested query object) is an object or an array, state the nesting and every child key; never write "other fields", "etc.", or a single sample value.
|
|
279
279
|
|
|
280
280
|
### Platform-Neutral Body Text
|
|
281
281
|
|
|
@@ -371,9 +371,9 @@ Before submission, confirm all of the following:
|
|
|
371
371
|
- Numeric inputs state integer versus decimal and whether a negative value is accepted, with no “accepts digits only” standing in for the type; the decimal places, bounds, whitespace and invalid-character handling the source implements are written out, and no unimplemented constraint is written as existing behavior.
|
|
372
372
|
- Every data boundary names both sides — present (source and destination) and absent (what it does not carry, write or send, and where empty, missing or default goes); entries over one data set line up item by item, absent items are written out, and absence is never written as -1, 0 or an empty string.
|
|
373
373
|
- Every value answers where it comes from (including the field’s origin in the consuming code), how it is processed (including the inputs that change the result and the difference after they change), and where it is consumed; missing any of the three leaves the scenario incomplete.
|
|
374
|
-
- Every branch states how its condition is determined and both outcomes; every step traces to a source location or an evidence entry; whether a key is sent follows the source serializer, never
|
|
374
|
+
- Every branch states how its condition is determined and both outcomes; every step traces to a source location or an evidence entry; whether a key is sent follows the source serializer, never nullability (for example `"nullable": false`), a default value, or a model-required flag.
|
|
375
375
|
- Scenarios that create, read, update, or delete data, or synchronize state or data, list every affected piece of data and how it changes, with no vague “related data updates in sync.”
|
|
376
|
-
- Network scenarios write the request body as a field table inside the sending step, each row carrying the four labelled segments `field:`, `type/encoding:`, `default:` and `send:`; declare the same fields in `contracts.endpoints[].params`, list every value source that is not page input, start every send segment with `required`/`optional`/`never` and follow it with a decidable condition (never "as needed" or "depending on"), describe the response structure as fully as possible, and keep all of these facts in that same step.
|
|
376
|
+
- Network scenarios write the request parameters (`query` and `body`) as a field table inside the sending step, each row carrying the four labelled segments `field:`, `type/encoding:`, `default:` and `send:`; path parameters and headers are listed with their `in` (no table required); declare the same fields in `contracts.endpoints[].params`, list every value source that is not page input, start every send segment with `required`/`optional`/`never` and follow it with a decidable condition (never "as needed" or "depending on"), describe the response structure as fully as possible, and keep all of these facts in that same step.
|
|
377
377
|
- No vague phrase such as “handle all other errors uniformly” substitutes for concrete branches.
|
|
378
378
|
- Every scenario is independently readable, with no abbreviated cross-scenario references and no unsupported copy, branches, thresholds, or outcomes added to fill gaps.
|
|
379
379
|
- Each scenario is exactly one normal or one edge/boundary case, with no success/failure mix.
|
package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md
CHANGED
|
@@ -306,18 +306,18 @@ Review every lifecycle-signal candidate and choose one of three: a user-observab
|
|
|
306
306
|
|
|
307
307
|
Timing wording follows the source: "refreshes immediately" when it takes effect on completion, "re-read on return" or "re-read on next entry" when it waits until the page is visible again — never mix the two. An axis scenario's trigger sequence starts from the timing event, and its last step lands on an assertable observable outcome.
|
|
308
308
|
|
|
309
|
-
### Request
|
|
309
|
+
### Request Parameters and Responses
|
|
310
310
|
|
|
311
|
-
When a scenario performs a network request, write the request body as a **tree-shaped field table inside the request step that sends it
|
|
311
|
+
When a scenario performs a network request, write the request parameters (`query` and `body`) as a **tree-shaped field table inside the request step that sends it**; list path parameters and request headers explicitly with their `in`. Write the response key by key.
|
|
312
312
|
|
|
313
313
|
The table has four fixed, labelled segments in a fixed order and is a top-level fenced code block, so every renderer keeps its line breaks:
|
|
314
314
|
|
|
315
315
|
```text
|
|
316
|
-
<Request
|
|
316
|
+
<Request parameter name>
|
|
317
317
|
├─ field:<path> type/encoding:<type> default:<value> send:<rule>
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
-
- **Write every key**: list each key of the source's request
|
|
320
|
+
- **Write every key**: list each key of the source's request construction (`query` or `body`), including keys that are **always the default**, **always sent**, or **never sent on this page**; dropping one is a failure, and fields may not be picked by scenario. **A field with a default is not necessarily sent** — whether it appears must be confirmed from the source's serializer or request-construction site.
|
|
321
321
|
- `field:` a top-level field is written with its plain name; a nested leaf is `a.b`; an array element is `a[].b`; the array itself is `a[]` (type `array<T>`). A parent object appears together with its children; give it its own `object` row only when the parent itself carries a send rule.
|
|
322
322
|
- `type/encoding:` only the closed vocabulary `string`, `int`, `int64`, `float`, `double`, `bool`, `object`, `array<T>`; put a time format, a byte encoding or a radix in parentheses (`string(yyyy-MM-dd HH:mm)`, `string(Base64)`, `int(>=1)`). Never write "text" or "number" as loose prose, and keep the token byte-identical to the contract's `type`.
|
|
323
323
|
- `default:` `—` means the field has no default value; strings are quoted; write only the value, never whether the key is sent.
|
|
@@ -325,22 +325,22 @@ The table has four fixed, labelled segments in a fixed order and is a top-level
|
|
|
325
325
|
- `required`: the key is always present. Stop there when a missing source value is a defect; add ", falls back to the default" when the default fills it, and name the source or failure when it matters, for example ", falls back to the default unknown when it cannot be read";
|
|
326
326
|
- `optional`: the key may be absent, immediately followed by a decidable condition written as ", not sent when <condition>" or ", sent only when <condition>", for example ", not sent when it has no value", ", not sent when the array is empty", ", not sent when it equals the default 0", ", not sent when the source cannot be determined", ", not sent when the user specifies no insert position";
|
|
327
327
|
- `never`: never appears; the field stays in the data model and is skipped when serializing.
|
|
328
|
-
- Whether a key is sent follows the source's serializer or request-construction site: a nullable field, a field with a default, and a model-required field do not mean "always sent"
|
|
328
|
+
- Whether a key is sent follows the source's serializer or request-construction site: a nullable field, a field with a default, and a model-required field do not mean "always sent", and `"nullable": false` only means the value cannot be empty. **None of these is equivalent to `required`** — a field with a default may be omitted when it equals the default, and may also always be sent.
|
|
329
329
|
- The condition must be writable as a single `if`: name a concrete condition such as "has no value", "the array is empty", "equals the default", "the control is off", "nothing is selected", "cannot be read", "the source cannot be determined". Never write "as needed", "depending on", "generally", "maybe"; list every condition separately instead of "except in special cases".
|
|
330
330
|
- `required` and `optional` differ only in whether the key is always present; the `default:` segment says what value fills a missing value and never whether the key appears, so the two segments never substitute for each other. A boolean that uses `false` for "the user set nothing" must say "not sent when it equals the default false", not "not sent when it has no value".
|
|
331
331
|
- When writing a condition, "no value" means unassigned or `null`; for strings and arrays a length of 0 also counts as no value; `0` and `false` count as values.
|
|
332
|
-
- Start the step with an executable action, not a caption such as "the structure is as follows": "the request
|
|
332
|
+
- Start the step with an executable action, not a caption such as "the structure is as follows": "the request parameters are serialized field by field from the table below and then sent; the key order follows the table's row order and whether a key appears follows the send segment".
|
|
333
333
|
- Separate the segments with at least one space: the path after `field:` must not be glued to the next segment, or the path and `default:` read as a `file:line`; write `default:false`, never `default=false`; no table line starts with `#`.
|
|
334
|
-
- Name the table root in business terms (for example "sync request body"), never with the request type name from the source.
|
|
334
|
+
- Name the table root in business terms (for example "sync request body" or "weather query parameters"), never with the request type name from the source.
|
|
335
335
|
- When a field's value does not come from this page's input (local storage, the previous response, a fixed value, a computed value), add one line after the table naming each such field, for example: "Value sources: `userId` is the current signed-in user number in local storage, `deviceId` is the device identifier in local storage, and `payload` is the pending-queue record count." Fields fed by page input need no entry.
|
|
336
336
|
|
|
337
|
-
**Relation to the contracts.** Each table row is also declared once in that scenario's `contracts.endpoints[].params` with `in: "body"`, byte-identical. The contracts are the audited fact base: G2 compares every parameter name, default and value source against the step text, and one missing token fails the gate. The table is what the reader and the downstream coder see.
|
|
337
|
+
**Relation to the contracts.** Each table row is also declared once in that scenario's `contracts.endpoints[].params` with `in: "query"` or `in: "body"`, byte-identical. The contracts are the audited fact base: G2 compares every parameter name, default and value source against the step text, and one missing token fails the gate. The table is what the reader and the downstream coder see. Path parameters and headers are listed with their own `in` (no table required); key names, defaults and fixed values follow the source — never guess, and never drop a key that has a default.
|
|
338
338
|
|
|
339
339
|
**Response.** List one field path per string in `response_fields[]` (`current_temperature`, `hourly.temperatures[]`); the envelope (code/data/message), types, nullability and the handling of a missing or default-valued field go into that endpoint's `note` and are merged into the step — never into a `response_fields` element, because G2 requires each element to appear verbatim in the step.
|
|
340
340
|
|
|
341
341
|
**G2 checks verbatim.** A method, URL, parameter name, parameter default, value source or response field present in the contracts but absent from the steps fails the gate. The envelope, types, nullability and missing-value handling are outside that check and must still be written into the steps, not left in `contracts` alone.
|
|
342
342
|
|
|
343
|
-
When the same request appears in several scenarios, each scenario repeats the complete table; never write "same as above" or "see scenario 1". The send condition lives only in the table; the steps state the server behaviour or the user-visible result once the condition holds. When the body is an object or an array, state the nesting and every child key; never write "other fields", "etc.", or a single sample value.
|
|
343
|
+
When the same request appears in several scenarios, each scenario repeats the complete table; never write "same as above" or "see scenario 1". The send condition lives only in the table; the steps state the server behaviour or the user-visible result once the condition holds. When the body (or a nested query object) is an object or an array, state the nesting and every child key; never write "other fields", "etc.", or a single sample value.
|
|
344
344
|
|
|
345
345
|
### Platform-Neutral Body Text
|
|
346
346
|
|
|
@@ -436,9 +436,9 @@ Before submission, confirm all of the following:
|
|
|
436
436
|
- Numeric inputs state integer versus decimal and whether a negative value is accepted, with no “accepts digits only” standing in for the type; the decimal places, bounds, whitespace and invalid-character handling the source implements are written out, and no unimplemented constraint is written as existing behavior.
|
|
437
437
|
- Every data boundary names both sides — present (source and destination) and absent (what it does not carry, write or send, and where empty, missing or default goes); entries over one data set line up item by item, absent items are written out, and absence is never written as -1, 0 or an empty string.
|
|
438
438
|
- Every value answers where it comes from (including the field’s origin in the consuming code), how it is processed (including the inputs that change the result and the difference after they change), and where it is consumed; missing any of the three leaves the scenario incomplete.
|
|
439
|
-
- Every branch states how its condition is determined and both outcomes; every step traces to a source location or an evidence entry; whether a key is sent follows the source serializer, never
|
|
439
|
+
- Every branch states how its condition is determined and both outcomes; every step traces to a source location or an evidence entry; whether a key is sent follows the source serializer, never nullability (for example `"nullable": false`), a default value, or a model-required flag.
|
|
440
440
|
- Scenarios that create, read, update, or delete data, or synchronize state or data, list every affected piece of data and how it changes, with no vague “related data updates in sync.”
|
|
441
|
-
- Network scenarios write the request body as a field table inside the sending step, each row carrying the four labelled segments `field:`, `type/encoding:`, `default:` and `send:`; declare the same fields in `contracts.endpoints[].params`, list every value source that is not page input, start every send segment with `required`/`optional`/`never` and follow it with a decidable condition (never "as needed" or "depending on"), describe the response structure as fully as possible, and keep all of these facts in that same step.
|
|
441
|
+
- Network scenarios write the request parameters (`query` and `body`) as a field table inside the sending step, each row carrying the four labelled segments `field:`, `type/encoding:`, `default:` and `send:`; path parameters and headers are listed with their `in` (no table required); declare the same fields in `contracts.endpoints[].params`, list every value source that is not page input, start every send segment with `required`/`optional`/`never` and follow it with a decidable condition (never "as needed" or "depending on"), describe the response structure as fully as possible, and keep all of these facts in that same step.
|
|
442
442
|
- No vague phrase such as “handle all other errors uniformly” substitutes for concrete branches.
|
|
443
443
|
- Every scenario is independently readable, with no abbreviated cross-scenario references and no unsupported copy, branches, thresholds, or outcomes added to fill gaps.
|
|
444
444
|
- Each scenario is exactly one normal or one edge/boundary case, with no success/failure mix.
|