diff --git a/apps/presentation/dashboard/package.json b/apps/presentation/dashboard/package.json index 1b9f9f649..4fe86c367 100644 --- a/apps/presentation/dashboard/package.json +++ b/apps/presentation/dashboard/package.json @@ -49,7 +49,9 @@ "smoke:usage-progress": "rm -rf /tmp/loopx-usage-progress-smoke && tsc --ignoreConfig --target ES2022 --module CommonJS --moduleResolution Node --ignoreDeprecations 6.0 --resolveJsonModule --esModuleInterop --jsx react-jsx --skipLibCheck --strict --outDir /tmp/loopx-usage-progress-smoke smoke/usage-progress-smoke.ts src/features/personal-workspace/personal-workspace-model.ts && node /tmp/loopx-usage-progress-smoke/apps/presentation/dashboard/smoke/usage-progress-smoke.js", "smoke:action-review-plan": "rm -rf .local/action-review-plan-smoke && tsc --ignoreConfig --target ES2022 --module ES2022 --moduleResolution Bundler --skipLibCheck --strict --rootDir ../../.. --outDir .local/action-review-plan-smoke smoke/action-review-plan-smoke.ts ../../../loopx/control_plane/presentation/action_review_plan.ts src/vite-env.d.ts && node .local/action-review-plan-smoke/apps/presentation/dashboard/smoke/action-review-plan-smoke.js", "smoke:attention-details": "tsc --ignoreConfig --target ES2022 --module CommonJS --moduleResolution Node --ignoreDeprecations 6.0 --resolveJsonModule --esModuleInterop --skipLibCheck --strict --outDir /tmp/loopx-attention-details-smoke smoke/attention-details-smoke.ts && NODE_PATH=\"$PWD/node_modules\" node /tmp/loopx-attention-details-smoke/apps/presentation/dashboard/smoke/attention-details-smoke.js", - "smoke:delivery-review": "tsc --ignoreConfig --target ES2022 --module NodeNext --moduleResolution NodeNext --skipLibCheck --strict --rootDir src --outDir node_modules/.cache/delivery-review src/data/delivery-review.ts src/data/goal-acceptance-observation.ts src/features/personal-workspace/delivery-review-copy.ts && node smoke/delivery-review-smoke.mjs" + "smoke:delivery-review": "tsc --ignoreConfig --target ES2022 --module NodeNext --moduleResolution NodeNext --skipLibCheck --strict --rootDir src --outDir node_modules/.cache/delivery-review src/data/delivery-review.ts src/data/goal-acceptance-observation.ts src/features/personal-workspace/delivery-review-copy.ts && node smoke/delivery-review-smoke.mjs", + "smoke:team-artifact-comparison": "tsc --ignoreConfig --target ES2022 --module ES2022 --moduleResolution Bundler --skipLibCheck --strict --rootDir src --outDir node_modules/.cache/team-comparison src/features/personal-workspace/team-artifact-comparison.ts src/vite-env.d.ts && node smoke/team-artifact-comparison-smoke.mjs", + "smoke:team-report": "tsc --ignoreConfig --target ES2022 --module ES2022 --moduleResolution Bundler --jsx react-jsx --skipLibCheck --strict --rootDir src --outDir node_modules/.cache/team-report src/features/personal-workspace/team-artifact-content.tsx src/vite-env.d.ts && node smoke/team-report-smoke.mjs" }, "dependencies": { "@fontsource-variable/geist": "^5.3.0", diff --git a/apps/presentation/dashboard/smoke/team-artifact-comparison-smoke.mjs b/apps/presentation/dashboard/smoke/team-artifact-comparison-smoke.mjs new file mode 100644 index 000000000..5e177dce9 --- /dev/null +++ b/apps/presentation/dashboard/smoke/team-artifact-comparison-smoke.mjs @@ -0,0 +1,33 @@ +import assert from "node:assert/strict"; +import {comparisonSource, changedRange, preferredComparisonIndex} from "../node_modules/.cache/team-comparison/features/personal-workspace/team-artifact-comparison.js"; + +const link = {operation_id: "original", ref: "report.txt", sha256: "a".repeat(64), + input_ref: "input.txt", relation: "revises", state: "current"}; +const source = {operation_id: "original", request_id: "request", agent_id: "author", todo_id: "work", + status: "accepted", worker_active: false, recovery_required: false, + artifacts: [{ref: link.ref, sha256: link.sha256, text: "unchanged\nold\nend"}]}; +assert.equal(comparisonSource(link, source)?.text, "unchanged\nold\nend"); +for (const patch of [{operation_id: "other"}, {status: "rejected"}, {recovery_required: true}, {error: "unavailable"}, + {artifacts: [{ref: link.ref, sha256: "b".repeat(64), text: "new"}]}, + {artifacts: [{ref: "other.txt", sha256: link.sha256, text: "new"}]}, + {artifacts: [...source.artifacts, ...source.artifacts]}]) { + assert.equal(comparisonSource(link, {...source, ...patch}), null); +} +assert.equal(comparisonSource({...link, state: "unavailable"}, source), null); +assert.deepEqual(changedRange("unchanged\nold\nend", "unchanged\nnew\nend"), { + left: ["unchanged", "old", "end"], right: ["unchanged", "new", "end"], start: 1, leftEnd: 2, rightEnd: 2, +}); +const equal = changedRange("one\ntwo", "one\ntwo"); +assert.equal(equal.start, equal.leftEnd); +assert.equal(equal.start, equal.rightEnd); +const inserted = changedRange("one\nend", "one\nadded\nend"); +assert.equal(inserted.leftEnd, 1); assert.equal(inserted.rightEnd, 2); +const removed = changedRange("one\nremoved\nend", "one\nend"); +assert.equal(removed.leftEnd, 2); assert.equal(removed.rightEnd, 1); +const outputs = [{ref: "output.json"}, {ref: "review.md"}, {ref: "report.md"}]; +assert.equal(preferredComparisonIndex("report.md", outputs), 2); +assert.equal(preferredComparisonIndex("analysis.MD", outputs), 1); +assert.equal(preferredComparisonIndex("source.json", outputs), 0); +assert.equal(preferredComparisonIndex("no-extension", outputs), 0); +assert.equal(preferredComparisonIndex("source.txt", outputs), 0); +console.log("team artifact comparison: exact-version rejection and changed-range cases passed"); diff --git a/apps/presentation/dashboard/smoke/team-report-smoke.mjs b/apps/presentation/dashboard/smoke/team-report-smoke.mjs new file mode 100644 index 000000000..ae3e9c236 --- /dev/null +++ b/apps/presentation/dashboard/smoke/team-report-smoke.mjs @@ -0,0 +1,22 @@ +import assert from "node:assert/strict"; +import {createElement} from "react"; +import {renderToStaticMarkup} from "react-dom/server"; +import {MarkdownText} from "../node_modules/.cache/team-report/features/personal-workspace/markdown.js"; +import {TeamArtifactContent} from "../node_modules/.cache/team-report/features/personal-workspace/team-artifact-content.js"; + +const text = '# Research\n\n| Measure | Value |\n|---|---:|\n| **Cash** | 75 |\n| Escaped \\| label | 25 |\n\n[Source](https://example.org/report)\n\n[Unsafe](javascript:alert(1))\n'; +const artifact = {ref: "report.md", sha256: "a".repeat(64), text}; +const html = renderToStaticMarkup(createElement(TeamArtifactContent, {artifact, label: "Report"})); +assert.match(html, /