Skip to content

feat(dataop): lower a model into Specy .dataop (M25) - #56

Merged
jgrodziski merged 6 commits into
mainfrom
feat/m25-dataop
Dec 1, 2026
Merged

jgrodziski merged 6 commits into
mainfrom
feat/m25-dataop

Conversation

@jgrodziski

Copy link
Copy Markdown
Contributor

M25 (PLAN.md §26): codegraph dataop prints a model as a Specy Data & Operation model (.dataop) at the observed level: what data exists, what operations exist over it, and what each one depends on, uses, reads, writes and raises.

struct Owner {
  // NOTE: the schema flattens the fields of …Person, …BaseEntity: Specy has no inheritance
  schema {
    address: string
    pets: array<Pet>
    …
  }
  operation addPet(pet: Pet)
    // FINDING: branching: cyclomatic 7
    depends on { …BaseEntity.getId, …BaseEntity.isNew, Owner.getPets }
    uses { java.util.List, java.util.Objects }

(Spring PetClinic's Owner, evidence lines removed.)

Commits

Commit What
docs(plan) §26, with the as-built notes of the four steps under §26.8. Milestones and Decisions move to §27 and §28.
feat(core) Contract 1.2.0. MM-7: optional typeExpr on TTypedEntity (a closed union, surrogates on the wire). MM-8: marker trait TWithReceiver and optional receiver: self | other on access edges. The analyzer stores both (model.db version 6) and checks receiver in conformance. Schemas, METAMODEL.md and the website reference pages regenerated.
feat(extractor-java) The Java extractor emits all three. One fixture source line changes to get a wildcard case (archive(List<? extends Order>)); its snapshots and the explain goldens follow.
feat(dataop) The new pure package @codegraph/dataop (lower, print, type tables as data) and the command. Snapshot: fixtures/java/expected/model.dataop.
docs docs/dataop.md, docs/cli.md, README, CLAUDE.md.

Compatibility

  • Files at contract 1.0.0 and 1.1.0 still decode.
  • No other extractor's fixture snapshot moved (all compared by sha256 before and after the contract change).
  • The other five extractors emit neither typeExpr nor the marker. Their models lower through a stated fallback: every field is a schema field, every method attached, and the output's header says so.

Verification

  • TypeScript: build and typecheck clean; 5,503 tests pass run one package at a time (175 in the new package).
  • Java: ./mvnw package exits 0, 255 tests, on the committed tree.
  • PetClinic (500158f, spring stack table): 25 structs, 109 operations, 36 entry. Owner, OwnerRepository and OwnerController were read against their source by hand and match: fields, flattened supertype fields, every call, the three cyclomatic counts.
  • Not run: commons-lang (no checkout on the machine), and the .NET, Rust and Elixir suites, which this PR does not touch.
  • analyzer/test/scale.test.ts timed out once (5.8 s against 5 s) when the whole workspace ran in parallel. It takes 1.25 s alone, and the same on a tree without this work.

Read these before merging

  • The target grammar is not published yet. The output uses seven changes to Specy's Data & Operation metamodel (@"…" quoted names, uses { … }, = opaque, on module, parameter writes, coded // FINDING: lines, the "observable effect" rule). They are written in the Specy metamodels repository but not committed there. Until they are, docs/dataop.md points at a grammar that the published one does not match.
  • Overlap with feat(extractor-java): charge inherited calls #55. this.owners.save(owner) appears in no clause on PetClinic, because the model holds no edge for it. feat(extractor-java): charge inherited calls #55 adds that edge. Both PRs regenerate fixtures/java/expected/model.jsonl, its metrics snapshot and the explain goldens, and both edit EdgeExtractor.java, Main.java, the Java profile and PLAN.md, so the second to land needs a rebase and a regeneration (model.dataop included). The paragraph on that call in docs/dataop.md §4 goes away then.
  • packages/dataop was written code-first. Its tests came after the code; six mutants, all caught, stood in for the failing-test step. It deserves a reviewer's eye more than the rest.
  • No .dataop parser exists. Three properties stand in for one on every fixture model: every token is legal, every reference resolves, every clause item is backed by an edge and every edge is declared or counted.

Decisions taken

  • Supertype fields are flattened into the struct, each with its own anchor, and a // NOTE: names the supertypes.
  • A constructor is operation new(…): Struct on module.
  • With --boundaries, an uncalled operation that no rule names is not marked entry?; stderr counts those rows. Specy says the mark does not mean "nothing calls it".
  • Lambdas and anonymous invocables fold into the nearest named operation.

Deferred (§26.10)

Flows, contracts, states and descriptions (for a walk to write); candidate lineage; typeExpr and the receiver in the other five extractors; the website page.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PKCVgyFAm1UifToEYGcjCy

jgrodziski and others added 5 commits November 30, 2026 16:36
Section 26: a code graph lowered into a Specy Data & Operation
model at the observed level. MM-7 typeExpr, MM-8 TWithReceiver and
receiver on access edges, the lowering rules, the three properties
that stand in for a .dataop parser, and what is deferred. Milestones
and Decisions move to sections 27 and 28. The as-built notes of the
four steps are under 26.8.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKCVgyFAm1UifToEYGcjCy
Contract 1.2.0. MM-7: an optional typeExpr on TTypedEntity, a closed
union (named, primitive, array, nullable, function, union, variable,
unevaluated) whose references are file-scoped surrogates on the wire.
MM-8: the marker trait TWithReceiver and an optional receiver
(self | other) on access edges. The Java profile licenses the marker
on attribute, method and constructor.

The analyzer stores both (model.db version 6, the dep view gains
receiver) and validates receiver in conformance. Files at 1.0.0 and
1.1.0 still decode; no fixture snapshot moves. Schemas, METAMODEL.md
and the website reference pages are regenerated.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKCVgyFAm1UifToEYGcjCy
The Java extractor writes the type as written (generics, arrays,
primitives, wildcards as unevaluated), marks instance members with
TWithReceiver and states self or other on each field access.

The fixture gains one wildcard case: OrderService.archive takes
List<? extends Order>. Its snapshots and the explain goldens that
read it are regenerated.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKCVgyFAm1UifToEYGcjCy
New package @codegraph/dataop and the command codegraph dataop:
a model printed as a Specy Data & Operation model at the observed
level. Types become structs, fields schema fields or globals,
invocables operations with depends on, uses, reads, writes and
errors read from the edges. What the model does not hold is said as
opaque, ? or a FINDING, never guessed.

--boundaries marks entries from the entry inventory. An uncalled
operation that no rule names is left unmarked and counted on stderr.

No .dataop parser exists: three properties (lexical, closure,
agreement with the graph) run on every fixture model, and
fixtures/java/expected/model.dataop is the snapshot.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKCVgyFAm1UifToEYGcjCy
docs/dataop.md: what becomes what, entries, what the output says
when the model does not hold a fact, what is not lowered. The
command enters docs/cli.md, the README table and CLAUDE.md.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKCVgyFAm1UifToEYGcjCy
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
codegraph cc869eb Commit Preview URL

Branch Preview URL
Dec 01 2026, 11:02 AM

Conflicts: Main.java keeps both the ancestor-call stats and the
degraded type-node note; the Java profile keeps main's MM-6 wording
and adds MM-7/MM-8. Generated files regenerated from the merged
sources, not hand-merged: the Java snapshot and its metrics twin (+1
`post` edge on top of `receiver`), the explain goldens, profiles.md,
and model.dataop (`LedgerAdapter.post` now uses LedgerClient via its
super call).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKCVgxrF7im9Dw2aPPefkD
@jgrodziski
jgrodziski merged commit 784dca1 into main Dec 1, 2026
56 checks passed
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