Skip to content

Add DD-078 Slice 1A obligation truth model - #178

Open
larimonious wants to merge 6 commits into
mainfrom
feat/dd078-slice-1a-truth-model
Open

Add DD-078 Slice 1A obligation truth model#178
larimonious wants to merge 6 commits into
mainfrom
feat/dd078-slice-1a-truth-model

Conversation

@larimonious

@larimonious larimonious commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the narrow, app-independent Intent truth foundation needed before any test runner or evidence report:

  • source-located explicit IDs for features, scenarios, and outcomes;
  • compatibility-derived IDs that remain visibly rename/reorder-sensitive;
  • hierarchical compatibility identity that preserves exact parent IDs and prevents cross-scope collisions;
  • one obligation per behavioral scenario outcome, with fail-closed cardinality checks;
  • non-vacuous feature truth (zero outcomes != verified);
  • legacy test: cases remain visible and prevent feature verification until represented as stable obligations;
  • explicit documentation-only features with required rationale;
  • typed, referentially checked evidence-to-obligation and canonical obligation-to-feature-to-scenario relationships;
  • parser-owned identity sidecars that preserve the existing public IntentFile/Feature/Scenario AST shapes;
  • externally read-only truth and evidence records, leaving validated ingestion authority to a later slice;
  • duplicate or contradictory in-memory identity state fails closed in feature and coverage predicates;
  • orthogonal declaration, linkage, binding, executability, disposition, freshness, and assertion-resolution dimensions.

Intent / IAL compatibility

  • Existing parsing remains in compatibility mode by default.
  • Durable cross-run evidence must opt into strict parsing and explicit IDs.
  • Legacy Constraint: scenarios remain visible in the parser AST but do not interpret verification-like IDs, become obligations of the preceding feature, alter its identity/metadata/tests, trigger strict-ID requirements, or invalidate a documentation-only feature.
  • Markdown headings, separators, and named declarations close prior parser-section state before enabling their own; blank titles, Constraint:, technical bindings, test-data/invariant sections, and legacy test: blocks cannot swallow or mutate later behavior.
  • Strict orphan scenarios, outcomes, and legacy tests are rejected with source locations.
  • Repeated explicit IDs on one declaration fail with both source locations instead of silently replacing identity; scenario IDs must precede identity-bearing outcomes.
  • Legacy outcome prose beginning with id: remains prose unless it uses the explicit id: outcome.*; statement form.
  • Component, feature, scenario, and outcome compatibility IDs occupy deterministic hierarchical scopes.

Deliberate non-goals

This PR does not add or freeze:

  • a native .tnt unit-test declaration or runner;
  • execution, setup, fixture, resource, or cleanup semantics;
  • a report/JSON serialization contract, schema, renderer, threshold, or exit policy;
  • project manifests, discovery policy, protected CI, purity, providers, or application-specific assumptions;
  • replacement of glossary-driven IAL unit tests.

Those decisions require the revised testing DD and an end-to-end ntnt test vertical slice. PRs #179 and #180 are drafts while that architecture is reconsidered.

Validation

  • 54/54 focused truth tests (40 integration + 14 private model-invariant tests)
  • 2,015/2,015 non-conflicting nextest tests
  • 2/2 fixed-port Intent checks run serially
  • DD-078 plan tests
  • doctests
  • dev-release build
  • rustfmt and git diff --check

cargo clippy --all-targets --all-features remains blocked by pre-existing repository warnings/errors outside this diff, including existing approximate-constant test fixtures.

Comment thread src/intent.rs Outdated
@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR implements DD-078 Slice 1A: stable verification identity and an in-memory truth model for obligation tracking. Two previously flagged parser bugs (the missing !in_constraint guard on the verification: handler and the component id: overwrite by a constraint id:) are both fixed, with dedicated regression tests.

  • Adds IdentifiedIntent, VerificationTruth, and orthogonal truth dimensions (declaration, linkage, binding, executability, disposition, freshness, assertion-resolution) with tamper-resistant canonical snapshots that detect caller-side mutation of the obligation denominator.
  • Introduces StableId with strict and compatibility-derived modes, source-located warnings/errors for missing or duplicate IDs, and the in_constraint flag that isolates legacy Constraint metadata from feature verification state throughout the parser.
  • 17 fixture files and 1,260-line integration test suite cover duplicate IDs, malformed IDs, constraint boundary isolation, documentation-only semantics, and canonical-topology tamper proofing.

Confidence Score: 5/5

Safe to merge. The parser refactor is well-isolated, all previously flagged constraint boundary issues are fixed with targeted regression tests, and the new truth model's tamper-detection design prevents callers from silently zeroing the obligation denominator.

Both constraint boundary parser bugs that were flagged on earlier review rounds are now guarded correctly — !in_constraint on the verification: handler and on the component id: handler — and each has a dedicated regression test. The new VerificationTruth model's canonical snapshot design means any caller-side mutation causes all truth predicates to fail closed. The 1,260-line integration suite and 17 fixture files give strong coverage. No new defects were found in this pass.

Files Needing Attention: No files require special attention.

Important Files Changed

Filename Overview
src/intent.rs Large refactor adding ParsedFeature/ParsedScenario wrappers, in_constraint flag, per-line numbering, and IdentifiedIntent. Both previously flagged constraint boundary bugs are correctly guarded; comprehensive tests cover all regression paths.
src/verification/ids.rs New module: StableId, IdMode, validate_id, and slug. Explicit IDs are validated; compatibility-derived IDs use slug()-capped labels and embed the full parent value for uniqueness. Logic is correct and well-tested.
src/verification/model.rs New module: VerificationTruth with orthogonal dimension enums, canonical topology tamper-detection, and coverage queries. All truth predicates fail closed; linkage and behavioral evidence remain orthogonal.
tests/verification_truth_tests.rs 1,260-line integration suite covering strict/compat ID modes, constraint boundary isolation, documentation-only semantics, canonical topology tampering, and legacy AST backward-compatibility surface.
src/verification/mod.rs New module root re-exporting the Slice 1A public API; clean and minimal.
src/lib.rs One-line addition exposing the verification module.

Reviews (4): Last reviewed commit: "fix: narrow Intent obligation identity s..." | Re-trigger Greptile

Comment thread src/intent.rs Outdated
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.

1 participant