generated from coulomb/repo-seed
feat(WP-0016/C5): compilation layers docs and -fwrite-interface flag
- CLAUDE.md: add "Compilation Layers" section (C5) — layer map, compile-check tool usage, cache location, error-fix discipline - .ghci: add -fwrite-interface so interface files are cached even on partial-success builds (completes C4 spec) - WP-0016: mark C5 done; annotate C4 ✓ note in workplan Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2
.ghci
2
.ghci
@@ -7,4 +7,6 @@
|
|||||||
-- Report errors from all modules in one pass (don't stop at first failure).
|
-- Report errors from all modules in one pass (don't stop at first failure).
|
||||||
-- Critical for batch error fixing — see IHUB-WP-0016 C4.
|
-- Critical for batch error fixing — see IHUB-WP-0016 C4.
|
||||||
:set -fkeep-going
|
:set -fkeep-going
|
||||||
|
-- Write interface files even on partial success so cached modules are not re-compiled.
|
||||||
|
:set -fwrite-interface
|
||||||
import IHP.Prelude
|
import IHP.Prelude
|
||||||
37
CLAUDE.md
37
CLAUDE.md
@@ -50,6 +50,43 @@ deploy-to-nixos production # NixOS deploy
|
|||||||
|
|
||||||
Schema editing: use the IHP IDE at `localhost:8001` or edit `Application/Schema.sql` directly. Code generation via `localhost:8001/Generators`.
|
Schema editing: use the IHP IDE at `localhost:8001` or edit `Application/Schema.sql` directly. Code generation via `localhost:8001/Generators`.
|
||||||
|
|
||||||
|
## Compilation Layers
|
||||||
|
|
||||||
|
IHP compiles ~180 Haskell modules as one GHC target. Module changes are incremental — only changed modules and their dependents recompile. **Never modify Layer 1 during error-fix loops** — a change to `Web/Types.hs` or `Generated/Types.hs` invalidates all 59 controllers and 120 views simultaneously.
|
||||||
|
|
||||||
|
```
|
||||||
|
Layer 1 — stable core (compile once):
|
||||||
|
build/Generated/Types.hs IHP auto-generated from Schema.sql
|
||||||
|
Web/Types.hs controller type definitions
|
||||||
|
|
||||||
|
Layer 2 — helpers (only touch if Layer 1 is clean):
|
||||||
|
Application/Helper/*.hs 12 helper modules
|
||||||
|
|
||||||
|
Layer 3 — working surface (most errors live here):
|
||||||
|
Web/Controller/*.hs 59 controllers
|
||||||
|
Web/View/**/*.hs 120 views
|
||||||
|
|
||||||
|
Layer 4 — wiring (fix last):
|
||||||
|
Web/FrontController.hs
|
||||||
|
Web/Routes.hs
|
||||||
|
```
|
||||||
|
|
||||||
|
**Compile tools** (run inside `devenv shell`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scripts/compile-check # full build via ghcid (all layers), log → /tmp/ihub-compile-errors.txt
|
||||||
|
scripts/compile-check --bg # same, background-friendly (no colour/title)
|
||||||
|
scripts/compile-check-core # Layer 1+2 only — verify clean base before touching Layer 3
|
||||||
|
```
|
||||||
|
|
||||||
|
**GHC object cache**: compiled `.o`/`.hi` files persist in `.devenv/` between restarts. After the first full build (20–60 min on constrained hardware), subsequent single-module rebuilds take 5–30 seconds. Cache location:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find /home/tegwick/inter-hub -name "*.hi" 2>/dev/null | head -5
|
||||||
|
```
|
||||||
|
|
||||||
|
**Error-fix discipline**: fix bottom-up (Layer 1 → 4). Fix one module at a time; wait for ghcid to reload before moving on. See `workplans/IHUB-WP-0016-build-infrastructure-and-error-loop.md` for the full SOP.
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
### Core Domain Model (Phase 1)
|
### Core Domain Model (Phase 1)
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ skips the database startup, port binding, and service orchestration overhead.
|
|||||||
|
|
||||||
### C1 — Create `scripts/compile-check` script ✓
|
### C1 — Create `scripts/compile-check` script ✓
|
||||||
|
|
||||||
|
Also created `scripts/compile-check-core` and `.ghci-core` to compile Layer 1+2
|
||||||
|
in isolation (no Main.hs, no Layer 3). Resolves the architecture gap where Layer
|
||||||
|
2 correctness could not be verified independently.
|
||||||
|
|
||||||
A shell script at `scripts/compile-check` that runs ghcid in isolation (no postgres, no tailwind):
|
A shell script at `scripts/compile-check` that runs ghcid in isolation (no postgres, no tailwind):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -124,7 +128,7 @@ Configure a ralph-workplan loop:
|
|||||||
- Do NOT make speculative changes to stable layers while fixing working-surface errors
|
- Do NOT make speculative changes to stable layers while fixing working-surface errors
|
||||||
- Maximum 3 fix attempts per module before escalating to user
|
- Maximum 3 fix attempts per module before escalating to user
|
||||||
|
|
||||||
### C4 — Add GHC `-fwrite-interface` and `-keep-going` flags to `.ghci`
|
### C4 — Add GHC `-fwrite-interface` and `-keep-going` flags to `.ghci` ✓
|
||||||
|
|
||||||
```
|
```
|
||||||
-- Continue past errors in other modules (report all errors in one pass)
|
-- Continue past errors in other modules (report all errors in one pass)
|
||||||
@@ -136,12 +140,14 @@ Configure a ralph-workplan loop:
|
|||||||
`-fkeep-going` lets GHC report errors from all modules in one pass rather than
|
`-fkeep-going` lets GHC report errors from all modules in one pass rather than
|
||||||
stopping at the first failure — critical for batch error fixing.
|
stopping at the first failure — critical for batch error fixing.
|
||||||
|
|
||||||
### C5 — Document module surface constraints in CLAUDE.md
|
### C5 — Document module surface constraints in CLAUDE.md ✓
|
||||||
|
|
||||||
Add a "Compilation Layers" section to CLAUDE.md noting:
|
Added "Compilation Layers" section to CLAUDE.md covering:
|
||||||
- Never modify Layer 1 during error-fix loops
|
- Never modify Layer 1 during error-fix loops (and why — cascade invalidation)
|
||||||
|
- Layer breakdown with file counts
|
||||||
- Each layer's expected compile time after first build
|
- Each layer's expected compile time after first build
|
||||||
- Cache location and how to verify it's warm
|
- Cache location and how to verify it's warm
|
||||||
|
- References to `scripts/compile-check` and `scripts/compile-check-core`
|
||||||
|
|
||||||
## Error-Fix Loop SOP (Standard Operating Procedure)
|
## Error-Fix Loop SOP (Standard Operating Procedure)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user