Skip to content

Feature/save current work 2026 07 01#456

Open
zhangtianqides wants to merge 94 commits into
pascalorg:mainfrom
lytech2020:feature/save-current-work-2026-07-01
Open

Feature/save current work 2026 07 01#456
zhangtianqides wants to merge 94 commits into
pascalorg:mainfrom
lytech2020:feature/save-current-work-2026-07-01

Conversation

@zhangtianqides

@zhangtianqides zhangtianqides commented Jul 1, 2026

Copy link
Copy Markdown

What does this PR do?

How to test

Screenshots / screen recording

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

Note

High Risk
Large feature surface touching scene persistence, external APIs (Anthropic vision, Madori, ComfyUI), and optional catalog source mutation; misconfiguration or API key handling could affect imports and deployed data.

Overview
Adds an end-to-end DXF floor-plan import path: canvas preview/validation UI, file-based job APIs under PASCAL_DATA_DIR, optional vision analysis (/api/vision-analyze + prompt file), geo+AI merge run recording, scene build (/api/dxf-import-scene), and an alternate 3dMadori pipeline (/api/dxf-jobs/.../madori). Entry points include /import-dxf, home/scenes modals, and supporting components (ImportDxfTool, progress/settings/feedback).

Also wires AI agent proxy (/api/ai/[...path]), expands env for Azure/OpenRouter and PASCAL_DATA_DIR, and registers Pascal MCP in .mcp.json / Codex / Claude settings.

Catalog dev workflow: POST/PATCH/DELETE /api/catalog-items (optional source writes via PASCAL_ALLOW_CATALOG_SOURCE_WRITE) plus dev overlay API; docs in CATALOG_ITEMS.md.

Image → 3D via ComfyUI (/api/pic-to-3d/* and /pic-to-3d page). Editor shell gains sidebar tabs (AI, Add catalog, 360, walkthrough) and MeasureNavi theming (Inter/JetBrains, measurenavi-editor-theme.css).

Documentation/skills: .agents/skills/dxf-import/SKILL.md, DXF job rules in AGENTS.md, SAVE_BUILD_JSON.md, WINDOWS_DEPLOY_RUNBOOK.md; gitignore for reverse-proxy build artifacts.

Reviewed by Cursor Bugbot for commit 02f8436. Bugbot is set up for automated code reviews on this repo. Configure here.

chou-kyoku and others added 30 commits June 3, 2026 11:25
- Add ImportDxfButton to CommunityViewerToolbarLeft; opens ImportDxfTool
  in a fixed overlay (click backdrop to dismiss)
- Add optional `badge` slot to TreeNodeWrapper rendered between label and
  actions
- WallTreeNode reads metadata.needsReview and shows an amber AlertCircle
  with a tooltip when the DXF merge engine flagged a position mismatch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…print, mm units, command palette entry

- Fix $INSUNITS from 6 (m) to 4 (mm); all coordinates ×1000
- Break walls at door/window openings (solidSegments algorithm)
- Export Item nodes as rotated rectangle footprints (PASCAL_FURNITURE layer)
- Improve door: sill line + 90° swing arc oriented to wall angle
- Improve window: two face lines + jamb lines (proper gap rectangle)
- Add "Export AutoCAD (DXF)" to Ctrl+K command palette (Export & Share group)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…es on export

Pascal stores wall Y = -DXF_Y (same flip applied during DXF import in
madori-xml-parser.ts). Without the inverse flip on export the floor plan
was mirrored vertically. Fix:
- Negate Y in point2d() and dxfPolyline() vertex loop
- Swap and negate arc start/end angles in dxfArc() (CCW [s→e] → CCW [-e→-s])

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AutoCAD rejected the file with "group code 90 undefined at line 20" because:
1. LWPOLYLINE's vertex-count (code 90) requires a preceding "100 AcDbPolyline"
   subclass marker — without it AutoCAD can't identify the code
2. No $ACADVER header → AutoCAD fell back to R12 (AC1009) which predates LWPOLYLINE
3. Missing TABLES / BLOCKS / OBJECTS sections required by AC1015 structure

Fix:
- Add $ACADVER=AC1015 to HEADER section
- Add 100-subclass markers to all entity types (AcDbEntity + AcDbLine /
  AcDbPolyline / AcDbText / AcDbCircle + AcDbArc), with layer (code 8)
  placed after AcDbEntity per spec
- Add empty TABLES, BLOCKS, OBJECTS sections to complete the 6-section layout

Online viewers were unaffected because they use lenient parsers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
DXF import:
- Expand SiteNode polygon to building bbox + 2m margin (fixes 30m default square)
- Hide import warnings from UI, log to console only
- Remove auto-created slab (was not requested)

DXF export (AutoCAD compatibility):
- Add AC1015 version, handles, AcDbSymbolTable markers, TABLES/BLOCKS structure
- Fix Y-axis mirror (negate Y on output, swap arc angles)
- Wall breaks at door/window openings
- Furniture footprint export
- Add to Ctrl+K command palette

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three separate counters (th for tables, bh for blocks, nextH for entities)
could generate overlapping handles, causing AutoCAD's eHandleInUse error.

Fix:
- Replace makeHandleGen(start) with makeHandleGen() starting at 1
- Use the single nextH() counter for tables, blocks, and entities
- Pre-compute APPID table/entry handles before building the string to
  avoid the evaluation-order bug where body args run before tbl() assigns
  the TABLE handle (so owner references were pointing to wrong entities)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
} catch (err) {
setErrorMsg(err instanceof Error ? err.message : 'Failed to write scene.')
setPhase('error')
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job marked merged too early

Medium Severity

In the geo+ai path, saveRunOutput (which sets job status to merged) runs before importSceneViaServer finishes. If scene persistence fails afterward, the audit trail shows merged with no sceneId or imported status, contradicting actual outcome.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0473177. Configure here.

sceneResult = await buildAndSaveScene(mergeResult, coords, {
name: job.jobId, // caller can rename the scene later
operation: 'madori_import',
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Madori rerun duplicates scenes

Medium Severity

Each POST .../madori (including ?rerun=1) always calls buildAndSaveScene and sets a new sceneId on the job. Re-running import without re-calling Madori creates another published scene instead of updating the existing one.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0473177. Configure here.

zhangtianqides and others added 12 commits July 10, 2026 17:14
{ error: 'ANTHROPIC_API_KEY not configured' },
{ status: 503 },
)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vision API route unauthenticated

High Severity

POST /api/vision-analyze accepts arbitrary image payloads and calls Anthropic when ANTHROPIC_API_KEY is set, with no auth or rate limit. Any client that can reach the editor can trigger paid vision usage.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9f7ff3a. Configure here.

zhangtianqides and others added 2 commits July 14, 2026 15:14
…豁免衣柜 + eval 合并空间语义/几何断言/碰撞明细

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, mergeResult, coords, guideImageUrl }),
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Geo AI import missing auth

High Severity

The geo+AI path posts to /api/dxf-import-scene with only Content-Type, while that route uses guardSceneApiRequest. When PASCAL_SCENE_API_TOKEN is set, the import fails with 401/503 even though Madori import can still succeed via other routes.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 10882b5. Configure here.

} catch (err) {
console.error('[dxf-jobs] createJob failed:', err)
return NextResponse.json({ error: 'Failed to create job' }, { status: 500 })
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DXF job API unauthenticated writes

Medium Severity

POST /api/dxf-jobs accepts arbitrary dxfText and preview payloads with no auth or size cap, writing under PASCAL_DATA_DIR/dxf-imports/. Related job routes can trigger Madori calls and status updates with only a guessable 8-hex jobId.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ff040f2. Configure here.


export async function POST(request: NextRequest): Promise<NextResponse> {
const guard = guardSceneApiRequest(request)
if (guard) return guard

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Geo import missing scene token

Medium Severity

dxf-import-scene requires guardSceneApiRequest, but the geo+ai client fetch to that route sends only Content-Type, not Authorization or x-pascal-scene-token. With PASCAL_SCENE_API_TOKEN set on a non-trusted host, import fails after merge.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ff040f2. Configure here.

return NextResponse.json(
{ error: 'metadata is invalid.', details: parsed.error.flatten() },
{ status: 400 },
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid catalog metadata returns 500

Low Severity

JSON.parse(metadataRaw) runs inside the broad try without a dedicated catch. Malformed metadata JSON yields a 500 instead of a 400 validation error.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 02a405a. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

There are 32 total unresolved issues (including 31 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f239c3e. Configure here.

}

const confidence = typeof r['confidence'] === 'number' ? r['confidence'] : 0
if (confidence < MIN_CONFIDENCE) return fallback('confidence_too_low')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing confidence rejects vision

Medium Severity

normalizeSemanticResponse treats a missing top-level confidence as 0, then returns valid: false when below 0.55. A well-formed model payload with rooms and openings but no confidence field is discarded and merge falls back to geometry-only.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f239c3e. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants