Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,58 @@ jobs:
if-no-files-found: warn
# Live Studio UI checks are opt-in; hosted OpenGL 3.3 availability is not assumed.

windows-installer:
# ARK Setup (installer/ArkSetup) with a synthetic payload: no native build, no real registration or shortcuts.
runs-on: windows-2022
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Build ARK Setup in the public and self-test configurations
shell: pwsh
run: |
dotnet publish installer/ArkSetup/ArkSetup.csproj -c Release -p:ArkSetupSelfTest=false -o out/installer-ci/public --nologo
if ($LASTEXITCODE -ne 0) { throw 'The public configuration did not build.' }
dotnet publish installer/ArkSetup/ArkSetup.csproj -c Release -p:ArkSetupSelfTest=true -p:ArkTestIsolationId=hosted-ci -o out/installer-ci/self-test --nologo
if ($LASTEXITCODE -ne 0) { throw 'The self-test configuration did not build.' }
- name: Render the setup pages (self-test build, layout only)
shell: pwsh
run: |
$captures = Join-Path $PWD 'out/installer-ci/pages'
$page = Start-Process -FilePath out/installer-ci/self-test/ARK-Setup.exe -ArgumentList @('--screenshot', ('"' + $captures + '"'), '--layout-only') -PassThru
$null = $page.Handle
if (-not $page.WaitForExit(120000)) { $page.Kill(); throw 'The page renderer timed out.' }
$layout = Get-Content -LiteralPath (Join-Path $captures 'layout.txt') -Raw
Write-Output $layout
if ($page.ExitCode -ne 0) { throw "The page renderer returned $($page.ExitCode)." }
foreach ($name in @('welcome','options','installing','done','error','uninstall')) {
if ($layout -notmatch "(?m)^${name}: elements=[1-9][0-9]*; outside=0; overlap=0; clipped=0;") { throw "Page $name failed its layout checks." }
}
- name: Test installer process detection, payload reading and the disk plan
shell: pwsh
run: |
dotnet run --project tests/installer_process_070a -c Release --artifacts-path out/installer-ci/process
if ($LASTEXITCODE -ne 0) { throw 'The installer process, payload or disk plan checks failed.' }
- name: Test the installer engine with a synthetic payload, including a temporary test signature
shell: powershell
run: ./tests/installer_engine_tests.ps1 -OutputDirectory out/installer-ci/engine -Signing
- name: Collect the setup log
if: failure()
shell: pwsh
run: |
$log = Join-Path ([IO.Path]::GetTempPath()) 'ARK-Setup.log'
if (Test-Path -LiteralPath $log) { Copy-Item -LiteralPath $log -Destination out/installer-ci/ARK-Setup.log }
- uses: actions/upload-artifact@v4
if: failure()
with:
name: windows-installer-logs
path: |
out/installer-ci/ARK-Setup.log
out/installer-ci/pages/layout.txt
if-no-files-found: ignore

linux-native-occt:
runs-on: ubuntu-24.04
timeout-minutes: 90
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ jobs:
out/native-release/native-authoring-corpus-v1.receipt.json
out/native-release/drawing-dxf-v1.receipt.json
if-no-files-found: warn
- name: Require a clean source tree for distributable artifacts
shell: pwsh
run: |
# package-release.ps1 and build-installer.ps1 refuse a dirty tree as well; this step names the files.
$changes = @(git status --porcelain --untracked-files=normal)
if ($LASTEXITCODE -ne 0) { throw 'git status failed.' }
if ($changes.Count) { $changes | Write-Output; throw 'The build or the tests changed the source tree; release artifacts need a clean tree.' }
- name: Prepare portable package and update manifest
shell: pwsh
run: ./scripts/package-release.ps1
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ studio.json

# Temporary agent worktrees created by Claude Code; never part of the source.
.claude/worktrees/

# .NET build output of ARK Setup and its test harness
installer/**/bin/
installer/**/obj/
tests/installer_process_070a/bin/
tests/installer_process_070a/obj/
30 changes: 26 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ add_test(NAME rubber-dynamics-059c COMMAND ark-rubber-dynamics-tests)
set_tests_properties(rubber-dynamics-059c PROPERTIES TIMEOUT 180)
add_executable(ark-rubber-runtime-059c-benchmark EXCLUDE_FROM_ALL benchmarks/rubber_runtime_059c.cpp)
target_link_libraries(ark-rubber-runtime-059c-benchmark PRIVATE ark)
add_executable(ark-program-binding-cost-benchmark EXCLUDE_FROM_ALL benchmarks/program_binding_cost.cpp)
target_link_libraries(ark-program-binding-cost-benchmark PRIVATE ark)
target_link_libraries(ark-inertial-056c-tests PRIVATE ark)
add_test(NAME inertial-056c COMMAND ark-inertial-056c-tests)
set_tests_properties(inertial-056c PROPERTIES TIMEOUT 180)
Expand Down Expand Up @@ -434,12 +436,19 @@ if(WIN32)
# MSVC Release builds can exceed the standard COFF section count.
target_compile_options(ark-studio PRIVATE /bigobj)
endif()
# WinMain's frame takes about half of the default 1 MiB main stack, and the UI
# thread also runs document tools. Reserve 8 MiB; pages are committed on demand.
# Explicit 8 MiB stack reserve (address space; pages commit on use). WinMain's
# frame takes about half of a 1 MiB main stack and the UI thread also runs
# document tools (b63e93d). The MSVC
# and llvm-mingw defaults are 1 MiB. Headless self-tests run slow tools on the
# main thread beneath WinMain, and a component configure nests three session
# dispatch frames. Threads created without a size (std::thread) inherit this;
# the session executor requests the same reserve explicitly.
set(ARK_STUDIO_STACK_RESERVE 8388608)
target_compile_definitions(ark-studio PRIVATE ARK_STUDIO_STACK_RESERVE=${ARK_STUDIO_STACK_RESERVE})
if(MSVC)
target_link_options(ark-studio PRIVATE /STACK:8388608)
target_link_options(ark-studio PRIVATE /STACK:${ARK_STUDIO_STACK_RESERVE})
elseif(MINGW)
target_link_options(ark-studio PRIVATE -Wl,--stack,8388608)
target_link_options(ark-studio PRIVATE -Wl,--stack,${ARK_STUDIO_STACK_RESERVE})
endif()
target_include_directories(ark-studio PRIVATE assets/ui)
find_program(ARK_POWERSHELL NAMES powershell pwsh REQUIRED)
Expand Down Expand Up @@ -850,6 +859,11 @@ if(WIN32)
# 048B Parametric HUD overlay; the selftest also checks a 1100x700 layout.
add_test(NAME studio-parametric-hud-ui COMMAND ark-studio --self-test-parametric-hud-ui --settings-file "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/parametric-hud-ui.settings.json" --shot "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/parametric-hud-ui.png" --size 1280 800)
set_tests_properties(studio-parametric-hud-ui PROPERTIES TIMEOUT 180 RUN_SERIAL TRUE)
# Program controls in the Parametric HUD (native bookshelf/flange extrusions need OCCT).
if(ARK_WITH_OCCT)
add_test(NAME studio-program-hud-ui COMMAND ark-studio --self-test-program-hud-ui --settings-file "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/program-hud-ui.settings.json" --shot "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/program-hud-ui.png" --size 1280 800)
set_tests_properties(studio-program-hud-ui PROPERTIES TIMEOUT 300 RUN_SERIAL TRUE)
endif()
add_test(NAME studio-skeleton-editor COMMAND ark-studio --skeleton-editor-test --settings-file "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/skeleton-editor.settings.json" --shot "${ARK_STUDIO_TEST_ARTIFACT_ROOT}/skeleton-editor.png" --size 1440 900)
set_tests_properties(studio-skeleton-editor PROPERTIES TIMEOUT 180 RUN_SERIAL TRUE)
foreach(width 1180 1440)
Expand Down Expand Up @@ -902,6 +916,10 @@ add_executable(ark-sketch-tests tests/sketch_tests.cpp)
target_link_libraries(ark-sketch-tests PRIVATE ark)
add_test(NAME parametric-sketch COMMAND ark-sketch-tests)
set_tests_properties(parametric-sketch PROPERTIES TIMEOUT 60)
if(ARK_WITH_OCCT)
target_compile_definitions(ark-sketch-tests PRIVATE ARK_SKETCH_NATIVE_TESTS=1)
add_dependencies(ark-sketch-tests ark-occt-worker)
endif()

add_executable(ark-live-tests tests/live_session_tests.cpp)
target_link_libraries(ark-live-tests PRIVATE ark)
Expand Down Expand Up @@ -945,6 +963,10 @@ endif()
add_test(NAME part-agents-052d COMMAND ark-part-agents-tests)
set_tests_properties(part-agents-052d PROPERTIES TIMEOUT 60)
set_tests_properties(agent-team PROPERTIES TIMEOUT 45)
add_executable(ark-agent-team-reasoning-tests tests/agent_team_reasoning_tests.cpp)
target_link_libraries(ark-agent-team-reasoning-tests PRIVATE ark)
add_test(NAME agent-team-reasoning COMMAND ark-agent-team-reasoning-tests)
set_tests_properties(agent-team-reasoning PROPERTIES TIMEOUT 30)

add_executable(ark-agent-tool-layer-042d-tests tests/agent_tool_layer_042d_tests.cpp)
target_link_libraries(ark-agent-tool-layer-042d-tests PRIVATE ark)
Expand Down
4 changes: 2 additions & 2 deletions DISTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Build and verify a current package:
./scripts/package-release.ps1
```

release.json determines source identity; packaged binaries retain their generated runtime metadata. Existing archives/releases are not overwritten. No user drawings or private settings are included.
release.json determines source identity; packaged binaries retain their generated runtime metadata. Existing archives/releases are not overwritten. No user drawings or private settings are included. A distributable package and a public setup need a committed source tree: package-release.ps1 and build-installer.ps1 refuse uncommitted or untracked, non-ignored files (and build-installer.ps1 a package whose release evidence records dirty=true), and the release workflow stops before packaging if the build or tests changed the tree. -AllowDirtyTree (also on publish-test-build.ps1, never with -Publish) builds a local test artifact anyway; its evidence then records dirty=true and it must not be distributed.

To create an optional installer, install the .NET 10 SDK and use the archive matching the current source:

Expand All @@ -22,7 +22,7 @@ To create an optional installer, install the .NET 10 SDK and use the archive mat
./scripts/test-distribution.ps1 -PackagePath out/releases/ark-windows-x64-VERSION.zip -InstallerPath out/releases/ARK-CODE-windows-x64-setup.exe
```

Replace VERSION and CODE with the generated identity, not a reused code. The isolated smoke verifies package geometry, STEP, installation receipts and uninstall; it runs the setup with --test-isolated, so the installed ARK's registration and shortcuts are untouched. See docs/WINDOWS_INSTALLER.md. tests/distribution_tests.ps1 covers packaging fixtures; fixture success alone does not qualify a real installer.
Replace VERSION and CODE with the generated identity, not a reused code. The isolated smoke verifies package geometry, STEP, that the public setup has no self-test page renderer, installation receipts and uninstall; it runs the setup with --test-isolated, so the installed ARK's registration and shortcuts are untouched. To sign, pass -SignScript to build-installer.ps1; the signing order (uninstaller stub first, the whole setup after the package is appended) is in docs/WINDOWS_INSTALLER.md. See docs/WINDOWS_INSTALLER.md. tests/distribution_tests.ps1 covers packaging fixtures; fixture success alone does not qualify a real installer.

Actions -> Prepare Windows and Linux release packages -> Run workflow builds and tests both platforms. The installer input additionally builds/tests the Windows setup. Publication is explicit, defaults to false and runs only after both platform jobs succeed. It attaches checksums and pinned OCCT source, and refuses an existing version tag. Hosted native results do not establish interactive Studio acceptance on another computer.

Expand Down
63 changes: 63 additions & 0 deletions benchmarks/program_binding_cost.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// D.02/G.01 synthetic cost of carrying parametric program bindings, with no
// drawing/session input. Eight namespaces each bind one large generated program
// (about 2000 statements, four legacy boxes, ~112 KB source); then one
// unrelated param.set is published repeatedly through doc_apply:
// - "journal": the installing session, whose iteration journal grows by one
// node per run (identical sequence for every executable, so comparable);
// - "bound": a copy of the document without journal, isolating per-apply work;
// - "detached": the same objects after detaching every binding (control).
// Serialization, clone and save/load of the journal-free bound document are
// timed separately. Run baseline and candidate executables alternately on the
// same machine and compare medians; retain every run.
#include "ark/parametric_programs.hpp"
#include "ark/serialize.hpp"
#include <algorithm>
#include <chrono>
#include <cstdlib>
#include <filesystem>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string>
#include <vector>
using namespace ark;
using V=arkjson::Value;
using Clock=std::chrono::steady_clock;
static V data(const V& r){const auto* e=r.find("isError");if(e&&e->b)throw std::runtime_error(r.dump().substr(0,600));return *r.find("structuredContent");}
static V program(int k){
std::string body="[";for(int i=0;i<2000;++i)body+="{\"let\":\"v"+std::to_string(i)+"\",\"value\":\"width*"+std::to_string(i%7+1)+"+sin("+std::to_string(i)+")*height/(1+"+std::to_string(i%5)+")\"},";
body+="{\"for\":\"i\",\"count\":4,\"body\":[{\"emit\":{\"op\":\"feature.add\",\"type\":\"box\",\"name\":\"Block {i+1}\",\"p\":{\"dx\":\"{width}\",\"dy\":\"{height}\",\"dz\":\"{10+i}\"}}}]}]";
V p;if(!arkjson::parse(R"({"format":"ark.parametric-program.v1","name":"Large )"+std::to_string(k)+R"(","parameters":{"width":{"default":20,"min":1,"max":100},"height":{"default":30,"min":1,"max":100}},"body":)"+body+"}",p))throw std::runtime_error("program JSON");return p;
}
static double ms(Clock::time_point a){return std::chrono::duration<double,std::milli>(Clock::now()-a).count();}
static std::string stats(std::vector<double> v){std::sort(v.begin(),v.end());double sum=0;for(double x:v)sum+=x;char buf[160];std::snprintf(buf,sizeof buf,"median %.3f ms, mean %.3f ms, min %.3f ms, max %.3f ms (n=%zu)",v[v.size()/2],sum/v.size(),v.front(),v.back(),v.size());return buf;}
static void applyRuns(AgentSession& s,const char* label,int runs){
std::vector<double> apply;
for(int i=0;i<runs;++i){V a=V::makeObj(),c=V::makeArr(),cmd=V::makeObj();cmd.set("op",V::makeStr("param.set"));cmd.set("name",V::makeStr("unrelated"));cmd.set("expr",V::makeNum(1+i));c.arr.push_back(cmd);a.set("commands",c);a.set("expected_revision",V::makeNum((double)s.revision));
const auto t=Clock::now();data(s.call("doc_apply",a));apply.push_back(ms(t));}
std::cout<<label<<" doc_apply param.set: "<<stats(apply)<<"\n";
}
static void copyRuns(const Document& d,const char* label,int runs){
std::vector<double> serialize,clone;
for(int i=0;i<runs;++i){auto t=Clock::now();const auto json=documentToJson(d);serialize.push_back(ms(t));if(json.empty())throw std::runtime_error("empty");
t=Clock::now();Document copy;std::string error;if(!cloneDocumentAuthoring(d,copy,&error))throw std::runtime_error(error);clone.push_back(ms(t));}
std::cout<<label<<" documentToJson: "<<stats(serialize)<<"\n"<<label<<" cloneDocumentAuthoring: "<<stats(clone)<<"\n";
}
static std::unique_ptr<AgentSession> journalFree(const AgentSession& source){auto s=std::make_unique<AgentSession>();s->document=source.document;s->document.iterationHistory=V{};s->revision=source.revision;s->suppressIterationHistory();return s;}
static void run(AgentSession& s,const V& args){V a=args;a.set("expected_revision",V::makeNum((double)s.revision));const auto preview=data(s.call("parametric_program",a));V apply=V::makeObj();apply.set("candidate_id",*preview.find("candidate_id"));apply.set("expected_revision",V::makeNum((double)s.revision));data(s.call("doc_apply",apply));}
int main(int argc,char** argv){try{
const int runs=argc>1?std::max(5,std::atoi(argv[1])):30;AgentSession s;size_t bytes=0;
auto t=Clock::now();
for(int k=0;k<8;++k){const auto p=program(k);bytes+=p.dump().size();V a=V::makeObj();a.set("action",V::makeStr("prepare"));a.set("mode",V::makeStr("install"));a.set("namespace",V::makeStr("ns"+std::to_string(k)));a.set("program",p);run(s,a);}
std::cout<<"bindings "<<s.document.parametricPrograms.arr.size()<<", program source "<<bytes<<" bytes, features "<<s.document.features.size()<<", eight installs "<<ms(t)<<" ms\n";
{auto boundSession=journalFree(s);auto& bound=*boundSession;applyRuns(bound,"bound",runs);copyRuns(bound.document,"bound",runs);
t=Clock::now();V a=V::makeObj();a.set("action",V::makeStr("prepare"));a.set("mode",V::makeStr("configure"));a.set("namespace",V::makeStr("ns0"));V values=V::makeObj();values.set("width",V::makeNum(25));a.set("values",values);run(bound,a);std::cout<<"bound configure ns0 prepare+apply: "<<ms(t)<<" ms\n";
const auto dir=std::filesystem::temp_directory_path()/("ark-binding-cost-"+std::to_string(Clock::now().time_since_epoch().count()));std::filesystem::create_directory(dir);const auto path=(dir/"bound.ark").string();
std::vector<double> save,load;for(int i=0;i<std::max(5,runs/3);++i){t=Clock::now();if(!saveDocument(bound.document,path.c_str()))throw std::runtime_error("save");save.push_back(ms(t));t=Clock::now();Document d;std::string error;if(!loadDocument(path.c_str(),d,&error))throw std::runtime_error(error);load.push_back(ms(t));}
std::cout<<"bound saveDocument: "<<stats(save)<<"\nbound loadDocument: "<<stats(load)<<"\n";std::error_code ec;std::filesystem::remove_all(dir,ec);
auto detachedSession=journalFree(s);auto& detached=*detachedSession;for(int k=0;k<8;++k){V a=V::makeObj();a.set("action",V::makeStr("prepare"));a.set("mode",V::makeStr("detach"));a.set("namespace",V::makeStr("ns"+std::to_string(k)));run(detached,a);}
std::cout<<"control: bindings "<<(detached.document.parametricPrograms.isNull()?0:detached.document.parametricPrograms.arr.size())<<", features "<<detached.document.features.size()<<"\n";
applyRuns(detached,"detached",runs);copyRuns(detached.document,"detached",runs);}
applyRuns(s,"journal",std::max(5,runs/2));
return 0;
}catch(const std::exception& e){std::cerr<<"FAIL: "<<e.what()<<"\n";return 1;}}
Loading
Loading