Quick Start
This walks through the fastest path from a fresh clone to a real, contract-verified Spark write — using the example job this repository ships with. It assumes you’ve completed Installation.
-
Run the test harness
Section titled “Run the test harness”From the repository root:
Terminal window ./dev/testThis single command:
- Builds every module in dependency order: the engine (
contract,ir,fingerprint,verification-core,spark-adapter,beam-adapter), the conformance kit, and the demo’s ownpluginandrunner. - Runs a real Spark job —
DemoJobHarness— via actualspark-submit, with Invaract’sContractEnforcementRuleinstalled in theSparkSession. - The job reads
demo/input/sample.csv, runs a small example transformation (InvaractPlugin, which adds two computed columns —value_squaredandvalue_tier), and writes the result todemo/output/result.parquet— a write that Invaract verifies againstdemo/contracts/invaract_output.yamlbefore it’s allowed to happen. - Generates and validates
demo/output/report.json.
Expect output ending like this (from a real run; the duration varies):
Step 7/7: Validating execution report...Status: PASSPlugin Version: 0.1.0Duration: 13660msNotification events: 3 line(s) in demo/output/events.jsonl (CONTRACT_VALIDATION, WRITE, and JOB_SUMMARY all present)✓ All validation passed✓ Plugin JAR is ready: plugin/target/scala-2.12/invaract-spark-plugin-0.2.0.jar✓ Execution report: demo/output/report.jsonExit code
0means the engine actually verified a real Spark write — not just that the code compiled. - Builds every module in dependency order: the engine (
-
View the result
Section titled “View the result”Start the results UI:
Terminal window ./dev/reportOpen
http://localhost:3000. In Codespaces, the port is auto-forwarded — open the forwarded URL, including on your phone, since the UI is responsive down to 375px screens.You’ll see:
- A PASS status badge
- Build info (plugin/Spark/Java versions, duration)
- Input/output schema and sample rows
- The translated Transformation IR — the actual Spark plan Invaract checked
- Contract verification:
PASSED (invaract_demo_output@1.0.0), no violations
-
See it actually block a bad write
Section titled “See it actually block a bad write”Everything so far proves a passing write goes through. To see Invaract reject a violating one:
Terminal window ./dev/regressionThis runs ten real jobs in pairs: each pair has one job that keeps to its contract (it passes and its output file is created) and one that breaks it. For example,
demo/contracts/invaract_output_broken_example.yamlrequires acustomer_namecolumn the demo transformation never produces. Each breaking job exits non-zero, and its output file is never created — the write was aborted before Spark touched disk. See Prove Enforcement with the Regression Pack for the full walkthrough and output.
What’s next
Section titled “What’s next”- Your First Contract — change the contract yourself and watch verification react.
- Infer a Starting Contract with Dry-Run Mode — run
./dev/dry-runto get a contract printed from a real run, instead of writing one from a blank file. - Write a Contract — the full format, from scratch.
- Install the Enforcement Rule on Spark — wire Invaract into your own Spark job, not just the demo.
- Use Invaract with Apache Beam or with Beam Python pipelines — the same contracts, checked before a pipeline runs.