Skip to content

feat: extract minimal redstone module kernel - #134

Merged
madawei2699 merged 2 commits into
mainfrom
codex/issue-133-redstone-kernel
Oct 3, 2026
Merged

madawei2699 merged 2 commits into
mainfrom
codex/issue-133-redstone-kernel

Conversation

@madawei2699

@madawei2699 madawei2699 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements the bounded, internal static module kernel for CraftDAG #133, using only the verified MinePilot ItemSorterSlice and quasi-connected PistonDoor proofs as evidence. No MinePilot implementation or runtime behavior was changed.

Proof comparison

Repeated structure Kept module-specific
Stable identity/version; canonical facing and bounded local integer coordinates; role-tagged concrete blocks and properties; coordinate/bounds/facing transforms; structural collision/bounds checks; ordinary VoxelPlan lowering with roles in sourceNodeId. ItemSorter inventory initialization, hopper/comparator topology, threshold/routing rules; PistonDoor movement/reset/pullback and Java quasi-connectivity; reference/runtime assertions and receipts.
ItemSorter supplies compass-key wire states; the shared transform rotates those keys as well as horizontal facing. No generic ports, signals, timing, scenario DSL, composition, or target portability.

The helper centralizes only the repeated static mechanics in CraftDAG. The verified MinePilot proofs remain unchanged. See the rewritten docs/REDSTONE_MODULES.md for the comparison matrix and runtime-target boundary.

Files

  • Added internal helper: packages/core/src/redstone/moduleKernel.ts (not exported through the public package entry point).
  • Added static expected-output fixtures: packages/core/test/fixtures/redstone/item-sorter-slice.json and quasi-connected-piston-door.json. Each records canonical topology, N/E/S/W topology, roles, exact block states, and proof provenance. Fixture facing outputs were checked against all eight block blob SHAs in merged MinePilot PRs feat: extract minimal redstone module kernel #134 and #136.
  • Added packages/core/test/redstone-module-kernel.test.ts: canonical equivalence, all four expected orientations, exact states, ordinary VoxelPlan lowering, repeat determinism, and fail-closed structural/state cases. Non-zero rotations reject unknown state properties; zero rotation preserves them unchanged.
  • Rewrote docs/REDSTONE_MODULES.md to distinguish proven shared structure, module-specific behavior, and deferred abstractions.

Validation

  • Focused regression: 6 tests passed.
  • pnpm test: passed; Core 197 tests plus importer (12), exporter (7), adapter-mesh (7), and CLI (10); all builds passed.
  • pnpm typecheck: passed.
  • pnpm lint: passed.
  • git diff --check: passed.

Review state

  • Head: b9d34aec1da3b5a7e8c975cb19cf4cdf1337c675
  • Working tree: clean.
  • Draft PR; not merged.

Closes #133

Copy link
Copy Markdown
Contributor Author

Final review found one small but real kernel-boundary issue.

The two verified fixtures themselves are correct: I independently compared all 8 checked-in expected facings against the merged MinePilot VoxelPlans (ItemSorter N/E/S/W + PistonDoor N/E/S/W), and all 8 match exact block coordinates/states.

The remaining issue is the fail-closed transform contract in moduleKernel.ts.

Today rotateState() rejects only a blacklist:

axis, hinge, orientation, rotation, shape

and silently preserves every other unknown property.

That means a future property with directional semantics that is not on this blacklist could be rotated geometrically while its state is silently left unchanged. That is broader than the evidence and contradicts #133's requirement that unsupported directional transforms fail closed rather than guess.

Please make one narrow change:

  • for a non-zero rotation, explicitly allow only:
    • facing (with the existing horizontal transform / up/down preservation);
    • compass-key properties north/east/south/west (rotate keys);
    • property names already proven invariant by the two verified fixtures (e.g. the exact non-directional properties exercised by ItemSorter + PistonDoor);
  • reject any other previously unseen property during a non-zero rotation with an unsupported-state diagnostic;
  • canonical / zero-turn compilation may preserve properties unchanged;
  • add one negative test using an arbitrary unknown property not present in the current blacklist, proving it fails on rotation.

Do not add a Minecraft-wide state registry or expand scope.

No fixture, VoxelPlan, public API, docs architecture, or runtime behavior change is requested. Existing 8/8 exact fixture outputs should remain unchanged.

Everything else in #134 looks merge-ready.

@madawei2699
madawei2699 marked this pull request as ready for review October 3, 2026 02:05
@madawei2699
madawei2699 merged commit 915a0c7 into main Oct 3, 2026
1 check passed
@madawei2699
madawei2699 deleted the codex/issue-133-redstone-kernel branch October 3, 2026 02:05
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.

Redstone module kernel: extract only concepts repeated by ItemSorter and PistonDoor

2 participants