Newer
Older
express-blog-posts / docs / hexascript / html / testing_plans.html
<h1>Testing Plan</h1>
<ul>
  <li>
    <h2>1. C++ Pybindings Validation (GTest &amp; Pytest)</h2>
    <ul>
      <li>
        <b>Test Cases:</b>
        <ul>
          <li>
            <code>test_safe_assign_binding_integrity</code>: Pass Boolean,
            Integer, and Enum string types from Python dictionaries into C++
            <code>hexa::RunConfig</code> via Pybind11.
          </li>
          <li>
            <code>TestManifestBridge</code>: Validate C++
            <code>hexa::CompilationResult</code> properties correctly reflect
            into Python <code>ManifestModel</code> schema.
          </li>
          <li>
            <code>ConfigSafetyTest.HandlesMalformedJSONInjection</code>: Inject
            deeply nested or malformed JSON payloads into
            <code>RunConfig::from_json</code>.
          </li>
        </ul>
      </li>
      <li>
        <b>Expected Outcomes:</b> C++ layer extracts Python variables without
        segmentation faults. Type mismatches or overflows trigger controlled
        fallbacks or raise caught <code>std::invalid_argument</code> exceptions
        passed back to Python. <code>Manifest</code> generation strictly
        enforces mandatory fields.
      </li>
      <li>
        <b>Verification Methods:</b> Pytest assertions on data type mapping
        (<code>isinstance</code>). GTest <code>EXPECT_NO_THROW</code> and
        <code>EXPECT_EQ</code> ensuring safe fallback values (e.g.,
        <code>SEEDLESS_VALUE</code>).
      </li>
    </ul>
  </li>
  <li>
    <h2>2. Class Object Integrity (C++, Python, TypeScript)</h2>
    <ul>
      <li>
        <b>Test Cases:</b>
        <ul>
          <li>
            <i>C++ Core:</i> <code>OptimizerLogicTest</code> for dead code
            elimination and constant folding; <code>LinearizerTest</code> for
            nested math AST translation; <code>VMTest</code> for memory bound
            checks (<code>HighRegisterPressure</code>), loop termination, and
            stack underflow logic.
          </li>
          <li>
            <i>Python Backend:</i> <code>TestOracle</code> and
            <code>HexaASTSerializer</code> for validating accurate translation
            of native Python <code>ast</code> nodes to JSON.
          </li>
          <li>
            <i>TypeScript Frontend:</i> <code>BaseCRUD</code> memento pattern
            tests (<code>isDirty</code> flag logic).
            <code>BaseLibrary</code> collection hydration.
          </li>
        </ul>
      </li>
      <li>
        <b>Expected Outcomes:</b> Optimizer reduces AST complexity without
        altering deterministic output. VM halts predictably on stack underflow
        or type mismatch (<code>ThrowsOnTypeMismatch</code>). TS models track
        local state mutations and revert cleanly.
      </li>
      <li>
        <b>Verification Methods:</b> GTest executing bytecode and validating
        literal extraction (<code>get_double</code>). Pytest validating
        dictionary structure of serialized AST. Vitest verifying Svelte
        <code>$state</code> reactivity and dirty flags.
      </li>
    </ul>
  </li>
  <li>
    <h2>3. Backend Endpoint &amp; Pydantic Structure Validation</h2>
    <ul>
      <li>
        <b>Test Cases:</b>
        <ul>
          <li>
            <code>TestCompilerConfigDynamicOrchestration</code>: Verify FastAPI
            endpoint schema matches the dynamically generated C++
            <code>SchemaBuilder</code> payload.
          </li>
          <li>
            <code>test_dispatch_pipeline_success</code>: Post
            <code>CommandPayload</code> to <code>/api/dispatch</code> triggering
            database entry and background worker queue.
          </li>
          <li>
            <code>TestCompileJobOrchestration</code>: Validate DB integrity and
            cascading foreign keys across <code>AST</code>,
            <code>CompilerConfig</code>, and <code>CompileJob</code>.
          </li>
        </ul>
      </li>
      <li>
        <b>Expected Outcomes:</b> API endpoints correctly enforce
        <code>BatchConfig</code> and <code>CommandPayload</code> Pydantic
        contracts. Missing required fields yield
        <code>422 Unprocessable Entity</code>. Authorized requests insert SQLite
        records and spawn multiprocessing tasks successfully.
      </li>
      <li>
        <b>Verification Methods:</b> Pytest <code>TestClient</code> executing
        HTTP requests. SQLAlchemy <code>inspect(CompilerConfig)</code> asserting
        exact column parity with C++ configuration definitions.
      </li>
    </ul>
  </li>
  <li>
    <h2>4. Frontend Data Dispatch Accuracy</h2>
    <ul>
      <li>
        <b>Test Cases:</b>
        <ul>
          <li>
            <code>BaseCRUD.Validation</code>: Pass invalid/incomplete forms into
            TS model before dispatch.
          </li>
          <li>
            <code>getValidPayload</code>: Verify stripping of UI-only properties
            (e.g., <code>isEditing</code>) before network transmission.
          </li>
        </ul>
      </li>
      <li>
        <b>Expected Outcomes:</b> Zod schemas intercept malformed data
        client-side, throwing <code>ValidationError</code> and halting
        <code>fetch</code>. Generated payloads strictly match the backend's
        expected JSON format.
      </li>
      <li>
        <b>Verification Methods:</b> Vitest
        <code>expect(() =&gt; getValidPayload(true)).toThrow()</code>. Spying on
        internal <code>apiFetch</code> calls to assert the shape of the
        intercepted HTTP body.
      </li>
    </ul>
  </li>
  <li>
    <h2>5. End-to-End API Integration &amp; Telemetry Synchronization</h2>
    <ul>
      <li>
        <b>Test Cases:</b>
        <ul>
          <li>
            <code>runIntegrationSuite</code>: Execute chained sequence creating
            <code>ResearchTier</code> -&gt; <code>LLMServer</code> -&gt;
            <code>Prompt</code> -&gt; <code>LLMModel</code> -&gt;
            <code>PromptConfig</code>.
          </li>
          <li>
            <code>FullChainTest</code>: Inject Python AST payload, execute
            compiler pass, and await trace result.
          </li>
        </ul>
      </li>
      <li>
        <b>Expected Outcomes:</b> System maintains state synchronization across
        the network boundary. C++ execution yields physical
        <code>.hex</code> and <code>.meta.json</code> files. Database accurately
        links execution <code>Manifest</code> to the original
        <code>CompileJob</code>. WebSocket/Polling loops hydrate the UI
        <code>RegisterGrid</code> and <code>ASTViewer</code> with zero data
        mutation.
      </li>
      <li>
        <b>Verification Methods:</b> Vitest polling tests resolving simulated
        backend responses. GTest <code>fs::exists</code> verifying absolute file
        paths of generated artifacts in the scoped temporary workspace.
      </li>
    </ul>
  </li>
</ul>