Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .tegami/close-source-ledger-module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
packages:
orgmemory: patch
subject: Close the Source Ledger module boundary
---

# Close the Source Ledger module boundary

## Improvements

Source Ledger now enforces a closed public API and an explicit allowlist for
its ACL, storage, organization, permission, and shared dependencies.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

This completes the mechanical closure gate required by the independent
[Claude Fable 5 architecture challenge](../docs/increments/active/2026-07-31-spring-modulith-package-refactor/challenge-verdict.md).
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
*
* <p>Retrieval now implements source-owned visibility and embedding-profile ports, so this
* module no longer depends on Retrieval, Asset, Space, Graph, or Connector. ACL persistence
* is accessed only through ACL-owned facade contracts; the module remains open while its
* broader external consumer surface is reduced for closure.
* is accessed only through ACL-owned facade contracts. The module is closed so external
* consumers can depend only on its public API surface.
*/
@org.springframework.modulith.ApplicationModule(
type = org.springframework.modulith.ApplicationModule.Type.OPEN)
allowedDependencies = {
"knowledge.acl",
"knowledge::storage",
"organization",
"permission",
"shared",
"shared::error"
},
type = org.springframework.modulith.ApplicationModule.Type.CLOSED)
package com.orgmemory.core.knowledge.sourceledger;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.orgmemory.core;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;

Expand Down Expand Up @@ -40,10 +41,23 @@ void knowledgeSpaceIsAnOpenNestedModuleDuringTheRefactor() {
}

@Test
void sourceLedgerIsAnOpenNestedModuleDuringTheRefactor() {
void sourceLedgerIsAClosedNestedModule() {
var sourceLedger = modules.getModuleByName("knowledge.sourceledger").orElseThrow();
var allowedDependencies = sourceLedger.getAllowedDependencies(modules).stream()
.map(Object::toString)
.map(dependency -> dependency.replace(" :: ", "::"))
.collect(TreeSet::new, Set::add, Set::addAll);

assertTrue(sourceLedger.isOpen());
assertFalse(sourceLedger.isOpen());
Comment thread
coderabbitai[bot] marked this conversation as resolved.
assertEquals(
Set.of(
"knowledge.acl",
"knowledge::storage",
"organization",
"permission",
"shared",
"shared::error"),
allowedDependencies);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,19 @@ objects. Source Ledger still consumes ACL-owned command/value contracts in the
intentional one-way direction; an exact Modulith dependency assertion pins
that surface so repositories or entities cannot leak back across the seam.

## First Module Closure

Source Ledger is the first extracted Knowledge slice to move from migration
state to a closed Spring Modulith module. Its outgoing dependency policy names
only ACL's public API, the parent Knowledge storage named interface,
organization, permission, and the shared base/error contracts.

The closed-module verification succeeds without publishing a new named
interface because Source Ledger's intentional consumer contracts already live
in its module base package, while no consumer reaches an internal subpackage.
The closure test and `modules.verify()` make both that API visibility and the
outgoing allowlist executable constraints.

## Strongest Counterargument

Ordinary internal subpackages would reduce directory size immediately and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ required CI checks passed. Its actionable CodeRabbit finding was fixed in
`fc8b3be5`, confirmed by the reviewer, and the only review thread was resolved
before merge.

## Current Pull Request Gates
## Eighteenth Pull Request Evidence

- ACL owns a transactional facade for validation, snapshot/entry/seal
persistence, head advancement, and normalization/promotion readiness.
Expand All @@ -476,3 +476,36 @@ files and 8 mirrored domain pairs; all 37 release-policy tests passed; and the
terminating repository `clean test` gate completed successfully in 5m46s
across 108 tasks. Diff hygiene, the zero Source Ledger-to-ACL-persistence scan,
and the 12-path PR limit check passed.

PR #209 merged as `daeeb75adf3a6396522778ef9f5e7a7c83854935` after all
required CI checks passed. CodeRabbit was rate limited, and direct inspection
confirmed zero inline comments, reviews, or review threads before merge.

## Current Pull Request Gates

- `knowledge.sourceledger` is a closed nested application module rather than
an open migration module.
- Its outgoing allowlist is limited to `knowledge.acl`, `knowledge::storage`,
organization, permission, shared, and `shared::error`.
- `modules.verify()` passes, proving current consumers use only Source Ledger's
public module surface and no undeclared outgoing edge exists.
- Focused Modulith and Source Ledger consumer tests pass; `:core:test` and the
terminating repository `clean test` gate pass.
- The pull request contains production module metadata and tests, remains below
100 files, and completes CI/review/merge before the next Knowledge module is
assessed for closure.

Pre-PR verification completed: the initial closed-module probe passed; the
explicit outgoing allowlist passed `modules.verify()`; focused Source Ledger,
Connector, API, Worker, and Modulith tests passed in 1m47s; `:core:test` passed
in 1m24s; the docs operating-model check passed across 399 Markdown files and
8 mirrored domain pairs; all 37 release-policy tests passed; and the
terminating repository `clean test` gate completed successfully in 6m30s
across 108 tasks. Diff hygiene and the under-100-file scope check passed.

CodeRabbit requested that the regression test pin the exact outgoing allowlist
and that the release note link the existing independent architecture
challenge. Both review findings are addressed without rerunning the settled
challenge or changing the closure outcome. The focused Modulith, docs, and
release gates passed, and the terminating repository `clean test` gate passed
again in 1m23s across 99 tasks using the shared build cache.