惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
腾讯CDC
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
小众软件
小众软件
美团技术团队
Martin Fowler
Martin Fowler
爱范儿
爱范儿
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
J
Java Code Geeks
B
Blog
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
博客园 - Franky

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Audit Deep Dive: Tests and Harness | Auditoria: testes e ...
CrabPascal · 2026-06-04 · via DEV Community

Bilingual post · Post bilíngue

Jump to: English · Português


English {#english}

Audit Deep Dive: Tests and Harness

Series — Part 2: Previous: Audit Deep Dive: RTL, Unicode, Properties (052-audit-rtl-unicode-properties). Report: technical-debt/audit/04-marina-tests-harness.

Marina's audit asks a blunt question: do our tests tell the truth? A compiler can pass cargo test while hiding run/build divergence, flaky Horse harnesses, and outdated README claims. For CrabPascal's sprint-driven roadmap, QA is not a checkbox — it is the contract that each release actually works.

Scope of the audit

Marina reviewed:

  • Rust test suites under tests/*.rs
  • Pascal fixtures in tests/fixtures/*.pas
  • Example harness scripts, especially tests/test_exemplos_completo.ps1
  • Baseline health via cargo test

The full evidence table is in Mintlify at technical-debt/audit/04-marina-tests-harness.

TD-TEST-001 — No run vs build parity tests (P1)

Most integration tests invoke run, not build or build-exe. Example: tests/properties_runtime.rs uses .arg("run") exclusively. The same pattern appears in string_conformance.rs, unicode_conformance.rs, and related suites.

Impact: Codegen regressions — incomplete properties, fake exception stubs (pre-v2.21.0), wrong string helpers — would not fail CI. Developers trust green builds that only exercise the interpreter path.

Fix direction: Sprint 10 (v2.18.0) introduced run_build_parity gates where GCC exists. The audit confirms we need this pattern everywhere parity matters.

# Today: most fixtures only do this
crab-pascal run tests/fixtures/properties_runtime.pas

# Needed: explicit build parity where toolchain available
crab-pascal build-exe tests/fixtures/properties_runtime.pas

Enter fullscreen mode Exit fullscreen mode

TD-TEST-002 — Horse harness depends on live HTTP (P1)

tests/test_exemplos_completo.ps1 starts background jobs running CrabPascal servers, then calls Invoke-WebRequest against http://localhost:9001/api/....

Impact: CI fails offline. Timing flakes when the server is slow to bind. Reproducing failures requires Windows, PowerShell, and a free port.

Fix direction: Offline smoke tests, mock endpoints, or explicit skip with reason when HTTP is unavailable — targeted for Sprint 16.

TD-TEST-003 — Baseline cargo test not fully green (P2)

A unit test in src/semantic/mod.rs (test_undefined_variable) expects error messages containing "Undefined variable". The actual diagnostic text drifted, breaking the assert.

Impact: When baseline tests fail for message wording, teams ignore CI noise — and real regressions slip through.

Fix direction: Sprint 9 (v2.17.0) alignment — either update the expected string or standardize semantic error formatting.

TD-TEST-004 — tests/README.md version drift (P3)

The tests README still references CrabPascal v2.8.0 coverage claims. Post-v2.16.0 reality includes dozens of new fixtures, sprint gates, and parity tests not reflected there.

Impact: Contributors and stakeholders assume coverage that no longer matches the tree.

How tests run today (evidence snapshot)

Suite Command used Gap
properties_runtime.rs run No build comparison
string_conformance.rs run C stubs untested in CI without gcc gate
test_exemplos_completo.ps1 run + HTTP Fragile in headless CI

No existing suite was found calling crab-pascal build as a first-class CI step outside optional parity gates.

Recommended test philosophy

Marina's audit aligns with the squad principle in roadmap/squad: a test must fail if behavior regresses. That means:

  1. Parity tests where run and build-exe should match — skip with explicit reason when GCC is absent, never fake success.
  2. Minimal fixtures — one .pas file per bug, checked into tests/fixtures/.
  3. Harness isolation — Horse demos get offline smoke; full HTTP integration runs manually or in a dedicated pipeline.
  4. Living docs — update tests/README.md when sprint acceptance criteria change.

Contributor quick start

cargo test                          # Rust unit + integration
crab-pascal check examples/crud/crud.dpr
crab-pascal run tests/fixtures/your_new_fixture.pas

Enter fullscreen mode Exit fullscreen mode

Adding a test? Link the PR to a TD-ID (e.g. TD-TEST-001) and the sprint that owns it.

Mintlify reading path

  1. technical-debt/audit-overview — consolidated risk matrix
  2. technical-debt/audit/04-marina-tests-harness — Marina's full report
  3. roadmap/sprints/sprint-10-review — string parity gates
  4. tests/README.md — local harness docs (needs refresh per TD-TEST-004)

Takeaway

Green tests that only exercise run create false confidence in native build paths. Marina's audit turns that into actionable backlog items with owners and recommended fixtures. Honest QA is what makes sprint releases trustworthy.

Next: Audit Deep Dive: IDE, CI, and Docs (054-audit-ide-ci-docs).


Português {#portugus}

Auditoria: testes e harness

Série — Parte 2: Anterior: Auditoria: RTL, Unicode, properties (052-audit-rtl-unicode-properties). Relatório: technical-debt/audit/04-marina-tests-harness.

A auditoria da Marina faz uma pergunta direta: nossos testes dizem a verdade? Um compilador pode passar cargo test enquanto esconde divergência run/build, harness Horse instável e claims desatualizados no README. Para o roadmap por sprints do CrabPascal, QA não é checkbox — é o contrato de que cada release realmente funciona.

Escopo da auditoria

A Marina revisou:

  • Suítes Rust em tests/*.rs
  • Fixtures Pascal em tests/fixtures/*.pas
  • Scripts de harness de exemplos, especialmente tests/test_exemplos_completo.ps1
  • Saúde do baseline via cargo test

A tabela completa de evidências está no Mintlify em technical-debt/audit/04-marina-tests-harness.

TD-TEST-001 — Sem testes de paridade run vs build (P1)

A maioria dos testes de integração invoca run, não build ou build-exe. Exemplo: tests/properties_runtime.rs usa .arg("run") exclusivamente. O mesmo padrão aparece em string_conformance.rs, unicode_conformance.rs e suítes relacionadas.

Impacto: Regressões de codegen — properties incompletas, stubs falsos de exception (pré-v2.21.0), helpers de string errados — não falhariam no CI. Desenvolvedores confiam em builds verdes que só exercitam o interpretador.

Direção de correção: Sprint 10 (v2.18.0) introduziu gates run_build_parity onde GCC existe. A auditoria confirma que precisamos desse padrão onde paridade importa.

# Hoje: a maioria dos fixtures só faz isso
crab-pascal run tests/fixtures/properties_runtime.pas

# Necessário: paridade build explícita quando toolchain disponível
crab-pascal build-exe tests/fixtures/properties_runtime.pas

Enter fullscreen mode Exit fullscreen mode

TD-TEST-002 — Harness Horse depende de HTTP ao vivo (P1)

tests/test_exemplos_completo.ps1 inicia jobs em background rodando servidores CrabPascal, depois chama Invoke-WebRequest em http://localhost:9001/api/....

Impacto: CI falha offline. Flakes de timing quando o servidor demora a bindar. Reproduzir falhas exige Windows, PowerShell e porta livre.

Direção de correção: Smoke offline, endpoints mock ou skip explícito com razão quando HTTP indisponível — alvo Sprint 16.

TD-TEST-003 — Baseline cargo test não 100% verde (P2)

Teste unitário em src/semantic/mod.rs (test_undefined_variable) espera mensagens contendo "Undefined variable". O texto real do diagnóstico derivou, quebrando o assert.

Impacto: Quando testes de baseline falham por wording, times ignoram ruído no CI — e regressões reais passam.

Direção de correção: Alinhamento Sprint 9 (v2.17.0) — atualizar string esperada ou padronizar formatação de erros semânticos.

TD-TEST-004 — Drift de versão em tests/README.md (P3)

O README de testes ainda referencia cobertura CrabPascal v2.8.0. A realidade pós-v2.16.0 inclui dezenas de fixtures novos, gates de sprint e testes de paridade não refletidos lá.

Impacto: Contribuidores e stakeholders assumem cobertura que não corresponde mais à árvore.

Como os testes rodam hoje (snapshot)

Suíte Comando Gap
properties_runtime.rs run Sem comparação build
string_conformance.rs run Stubs C não testados no CI sem gate gcc
test_exemplos_completo.ps1 run + HTTP Frágil em CI headless

Nenhuma suíte existente foi encontrada chamando crab-pascal build como passo de CI de primeira classe fora de gates opcionais de paridade.

Filosofia de testes recomendada

A auditoria da Marina alinha com o princípio da squad em roadmap/squad: teste deve falhar se comportamento regredir. Isso significa:

  1. Testes de paridade onde run e build-exe devem coincidir — skip com razão explícita sem GCC, nunca sucesso falso.
  2. Fixtures mínimos — um .pas por bug, versionado em tests/fixtures/.
  3. Isolamento de harness — demos Horse ganham smoke offline; integração HTTP completa roda manual ou em pipeline dedicado.
  4. Docs vivos — atualizar tests/README.md quando critérios de aceitação de sprint mudarem.

Quick start para contribuidores

cargo test                          # unit + integração Rust
crab-pascal check examples/crud/crud.dpr
crab-pascal run tests/fixtures/seu_novo_fixture.pas

Enter fullscreen mode Exit fullscreen mode

Adicionando teste? Ligue o PR a um TD-ID (ex.: TD-TEST-001) e ao sprint dono.

Trilha de leitura Mintlify

  1. technical-debt/audit-overview — matriz de risco consolidada
  2. technical-debt/audit/04-marina-tests-harness — relatório completo da Marina
  3. roadmap/sprints/sprint-10-review — gates de paridade de strings
  4. tests/README.md — docs locais de harness (precisa refresh por TD-TEST-004)

Conclusão

Testes verdes que só exercitam run criam falsa confiança em caminhos de build nativo. A auditoria da Marina transforma isso em itens de backlog acionáveis com donos e fixtures recomendados. QA honesto é o que torna releases por sprint confiáveis.

Próximo: Auditoria: IDE, CI e documentação (054-audit-ide-ci-docs).


Published on dev.to/@crabpascal · Código em CrabPascal