generated from coulomb/repo-seed
feat(WP-0016/C2-C3): close build infrastructure workplan
C2: document actual GHC cache behavior (-fbyte-code, no .o files, .hi caching via -fwrite-interface) and correct CLAUDE.md cache claim. C3: create IHUB-WP-0017 error-fix loop workplan (ralph-compatible, 5 tasks E1-E5, runs inside devenv shell). WP-0016 status → done. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -79,11 +79,7 @@ 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
|
||||
```
|
||||
**GHC compilation mode**: IHP uses `-fbyte-code` — GHCi compiles modules to bytecode in memory, not to persistent `.o` files. The `-fwrite-interface` flag writes `.hi` type-info files alongside source modules; these survive session restarts and skip re-type-checking of unchanged modules. Each ghcid restart regenerates bytecode for the full module graph. Expect 20–60 min on first build; restarts are somewhat faster due to `.hi` caching but not dramatically so. `.hi` files are written next to their source files (e.g. `Web/Controller/Sessions.hi`).
|
||||
|
||||
**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.
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ type: workplan
|
||||
title: "Build Infrastructure: Incremental Compilation and Autonomous Error-Fix Loop"
|
||||
domain: inter_hub
|
||||
repo: inter-hub
|
||||
status: open
|
||||
status: done
|
||||
owner: custodian
|
||||
topic_slug: inter_hub
|
||||
created: "2026-04-10"
|
||||
@@ -71,6 +71,12 @@ skips the database startup, port binding, and service orchestration overhead.
|
||||
|
||||
### C1 — Create `scripts/compile-check` script ✓
|
||||
|
||||
```task
|
||||
id: C1
|
||||
status: done
|
||||
priority: high
|
||||
```
|
||||
|
||||
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.
|
||||
@@ -103,19 +109,40 @@ This relies on `.ghci` (already present) which sets up `-j1` and loads the IHP c
|
||||
|
||||
### C2 — Verify GHC object cache persistence
|
||||
|
||||
GHC stores compiled objects in IHP's `.devenv` or a project-local `dist-newstyle/`
|
||||
equivalent. Verify the cache survives between `devenv up` restarts:
|
||||
|
||||
```bash
|
||||
# After first successful build, check cache location:
|
||||
find /home/tegwick/inter-hub -name "*.o" -newer Main.hs 2>/dev/null | head -5
|
||||
```task
|
||||
id: C2
|
||||
status: done
|
||||
priority: medium
|
||||
```
|
||||
|
||||
If the cache is cleared on each `devenv up` restart, add `IHP_BUILD_CACHE` or
|
||||
configure the Nix build dir to persist. Document the location here.
|
||||
**Finding (2026-04-10):** IHP's `applicationGhciConfig` sets `-fbyte-code`. GHCi compiles
|
||||
modules to bytecode in memory — there are **no persistent `.o` object files**. Each ghcid
|
||||
session recompiles all bytecode from source.
|
||||
|
||||
Our `-fwrite-interface` flag (C4) writes `.hi` interface files alongside source modules.
|
||||
These survive session restarts and allow GHCi to skip re-type-checking unchanged modules.
|
||||
This saves some time on restarts but does NOT eliminate full bytecode recompilation.
|
||||
|
||||
**Net result:** No persistent `.o` cache. `.hi` files provide partial speedup (skip
|
||||
type-checking). A single-module change still triggers full bytecode regeneration of that
|
||||
module and its dependents. For true persistent incremental builds, `-fobject-code` would
|
||||
be needed — not worth adding given IHP's design tradeoffs.
|
||||
|
||||
**Action:** No configuration change needed. Expectation documented here and in CLAUDE.md.
|
||||
|
||||
### C3 — Autonomous error-fix loop (ralph-workplan)
|
||||
|
||||
```task
|
||||
id: C3
|
||||
status: done
|
||||
priority: high
|
||||
```
|
||||
|
||||
Delivered as `workplans/IHUB-WP-0017-error-fix-loop.md`. Run inside `devenv shell`:
|
||||
```bash
|
||||
/ralph-workplan workplans/IHUB-WP-0017-error-fix-loop.md
|
||||
```
|
||||
|
||||
Configure a ralph-workplan loop:
|
||||
1. `scripts/compile-check --bg` runs ghcid in background, writing to `/tmp/ihub-compile-errors.txt`
|
||||
2. Monitor tool watches the log file for new error output
|
||||
@@ -130,6 +157,12 @@ Configure a ralph-workplan loop:
|
||||
|
||||
### C4 — Add GHC `-fwrite-interface` and `-keep-going` flags to `.ghci` ✓
|
||||
|
||||
```task
|
||||
id: C4
|
||||
status: done
|
||||
priority: high
|
||||
```
|
||||
|
||||
```
|
||||
-- Continue past errors in other modules (report all errors in one pass)
|
||||
:set -fkeep-going
|
||||
@@ -142,6 +175,12 @@ stopping at the first failure — critical for batch error fixing.
|
||||
|
||||
### C5 — Document module surface constraints in CLAUDE.md ✓
|
||||
|
||||
```task
|
||||
id: C5
|
||||
status: done
|
||||
priority: medium
|
||||
```
|
||||
|
||||
Added "Compilation Layers" section to CLAUDE.md covering:
|
||||
- Never modify Layer 1 during error-fix loops (and why — cascade invalidation)
|
||||
- Layer breakdown with file counts
|
||||
|
||||
120
workplans/IHUB-WP-0017-error-fix-loop.md
Normal file
120
workplans/IHUB-WP-0017-error-fix-loop.md
Normal file
@@ -0,0 +1,120 @@
|
||||
---
|
||||
id: IHUB-WP-0017
|
||||
type: workplan
|
||||
title: "Autonomous Error-Fix Loop: Reach Clean Build"
|
||||
domain: inter_hub
|
||||
repo: inter-hub
|
||||
status: active
|
||||
owner: custodian
|
||||
created: "2026-04-10"
|
||||
updated: "2026-04-10"
|
||||
depends_on: [IHUB-WP-0016]
|
||||
---
|
||||
|
||||
# IHUB-WP-0017 — Autonomous Error-Fix Loop: Reach Clean Build
|
||||
|
||||
## Goal
|
||||
|
||||
Drive the inter-hub codebase to a clean `ghcid` build ("All good, N modules loaded")
|
||||
by fixing compilation errors bottom-up, one module at a time.
|
||||
|
||||
## Pre-conditions
|
||||
|
||||
- Must be run inside `devenv shell` (IHP_LIB must be set, ghcid in PATH)
|
||||
- WP-0016 complete (compile-check scripts and ghci flags in place)
|
||||
|
||||
## How to start
|
||||
|
||||
```bash
|
||||
# Enter devenv shell first:
|
||||
devenv shell
|
||||
|
||||
# Then start this loop:
|
||||
/ralph-workplan workplans/IHUB-WP-0017-error-fix-loop.md
|
||||
```
|
||||
|
||||
## Error-Fix SOP (Standard Operating Procedure)
|
||||
|
||||
```
|
||||
1. Run: scripts/compile-check --bg
|
||||
2. Tail /tmp/ihub-compile-errors.txt
|
||||
3. Parse errors: group by module, order by Layer (1 → 4)
|
||||
4. Fix Layer 1 errors first (rare; usually type/import issues in Web/Types.hs)
|
||||
5. For each failing module in Layer 2–3:
|
||||
a. Read current module state
|
||||
b. Apply targeted fix (one module at a time)
|
||||
c. Wait for ghcid "Reloading..." + result
|
||||
d. If still failing: re-read error, apply next fix
|
||||
e. If 3 attempts fail: escalate — flag_for_human with module name and error
|
||||
6. After Layer 3 clean: fix Layer 4 (FrontController/Routes)
|
||||
7. "All good (N modules)" in log = build clean
|
||||
```
|
||||
|
||||
**Layer discipline** (never violate):
|
||||
- Never modify Layer 1 (`Web/Types.hs`, `build/Generated/*.hs`) during error-fix loops
|
||||
- Layer 1 changes invalidate ALL 59 controllers and 120 views simultaneously
|
||||
- Fix within the layer where the error is reported; escalate if the fix requires Layer 1
|
||||
|
||||
## Tasks
|
||||
|
||||
### E1 — Start compile-check and capture initial error set
|
||||
|
||||
```task
|
||||
id: E1
|
||||
status: todo
|
||||
priority: high
|
||||
```
|
||||
|
||||
Run `scripts/compile-check --bg` and read `/tmp/ihub-compile-errors.txt`. List all
|
||||
failing modules and their layers.
|
||||
|
||||
### E2 — Fix Layer 2 errors (Application/Helper/*.hs)
|
||||
|
||||
```task
|
||||
id: E2
|
||||
status: todo
|
||||
priority: high
|
||||
```
|
||||
|
||||
Fix all errors in `Application/Helper/*.hs`. Verify via ghcid reload. Mark done when
|
||||
Layer 2 shows no errors.
|
||||
|
||||
### E3 — Fix Layer 3 errors (Web/Controller/*.hs and Web/View/**/*.hs)
|
||||
|
||||
```task
|
||||
id: E3
|
||||
status: todo
|
||||
priority: high
|
||||
```
|
||||
|
||||
Fix errors in controllers and views. Work module-by-module, bottom-up. Mark done when
|
||||
Layer 3 shows no errors.
|
||||
|
||||
### E4 — Fix Layer 4 errors (Web/FrontController.hs, Web/Routes.hs)
|
||||
|
||||
```task
|
||||
id: E4
|
||||
status: todo
|
||||
priority: medium
|
||||
```
|
||||
|
||||
Fix wiring errors last. Mark done when `ghcid` reports "All good, N modules loaded".
|
||||
|
||||
### E5 — Commit clean build and close WP-0014/A1
|
||||
|
||||
```task
|
||||
id: E5
|
||||
status: todo
|
||||
priority: medium
|
||||
```
|
||||
|
||||
After "All good" state:
|
||||
1. Commit all fixes with `fix(WP-0017): reach clean build`
|
||||
2. Update `workplans/IHUB-WP-0014-pre-flight-deployment-gaps.md` A1 status to done
|
||||
3. Mark this workplan done
|
||||
|
||||
## Exit Criteria
|
||||
|
||||
- `ghcid` reports "All good, N modules loaded" with no errors
|
||||
- All fixes committed
|
||||
- WP-0014/A1 closed
|
||||
Reference in New Issue
Block a user