diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 4a673f7..fbcfb36 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -1,6 +1,7 @@ {"_type":"issue","id":"homemaker-py-ju3","title":"Programme codes share a namespace with the generic c/o/s type prefixes: 14% of harbor-house is silently optional and cr1's declared targets are all discarded","description":"Urb's type system is prefix-based (a type starting with 'c' is circulation, 'o'/'s' is outside) and programme room codes live in the SAME namespace, so any code whose name happens to start with c, o or s is silently reinterpreted as a generic type. Three separate consequences, none announced anywhere in the output:\\n\\n1. graph.check_space_counts line ~530 does 'if code[0].lower() in (\"c\",\"o\",\"s\"): continue' -- the code is SKIPPED ENTIRELY. Never required, never counted, no missing fail, no too-many fail.\\n2. Fitness.get_space_params returns the generic *_circulation / *_outside params BEFORE consulting self.spaces, so declared size/width/proportion are overridden.\\n3. dom.is_circulation / is_outside become true, changing the leaf's value rate, exempting it from crinkliness, and making it supply daylight to neighbours.\\n\\nharbor-house is affected; maple-court, health-centre and programme-house are namespace-clean.\\n\\n cr1 'Common Room with Fireplace' (c): size 80.0 -\u003e 0.0/14.0, width 6.0 -\u003e 2.4, proportion 2.0 -\u003e 1.5, ALL THREE overridden; is_circulation=True so value_rate 50 not 300.\\n of 'Staff Office' x2 (o): width/proportion overridden; is_outside=True; value_rate 100.\\n st1/st2 'Storage' (s): width/proportion overridden; is_outside AND is_circulation True; value_rate 100.\\n\\n5 of 37 room instances (14%) are silently optional. MEASURED CONSEQUENCE: in a 20k-eval run the two cr1 leaves converged to 32.9 and 17.1 m2 against a declared 80 m2, and produced no too-many-spaces fail despite count:1; of/st1/st2 are absent from the result entirely with zero fails, because nothing ever asked for them. Compounds with homemaker-py-2v1: cr1 is the single largest room in the programme and is classified circulation, so the x6 value gap pays the search to shrink it.","design":"Separate the namespaces. Cleanest is an explicit per-space 'class:' key in patterns.config (inside/circulation/outside) defaulting to inside, with the prefix rule used ONLY for untyped generic leaves the search creates -- programme codes then never collide regardless of spelling. A cheaper stopgap is a load-time validation error in programme.load_programme_dir that refuses a programme code starting with c/o/s, which at least converts a silent misread into a loud one. Renaming harbor's four codes would fix that one programme but leaves the trap armed for the next author.","acceptance_criteria":"A programme declaring a code starting with c/o/s either honours its declared params and count, or fails loudly at load. harbor-house re-baselined against its real 37-instance programme, and every DESIGN.md harbor fail count re-stated or annotated as measured against the 32-instance effective programme.","status":"closed","priority":0,"issue_type":"bug","assignee":"Claude","owner":"noreply@anthropic.com","created_at":"2026-08-26T08:26:37Z","created_by":"Claude","updated_at":"2026-08-26T09:05:11Z","started_at":"2026-08-26T08:55:30Z","closed_at":"2026-08-26T09:05:11Z","close_reason":"Shipped as loud validation + harbor rename rather than the class: key (DESIGN.md §39.3). The class: key was deliberately not built: auditing the prefix rule showed l/k/b/t carry adjacency semantics too, so re-plumbing the type system would invalidate the whole corpus for a problem whose damage is the silence, not the convention. programme.validate_codes raises on c/o/s codes from both parse paths; harbor cr1/of/st1/st2 renamed to fr1/ao/gs1/gs2 (neutral unused prefixes, prefix-sharing preserved); migrate_ju3_rename.py migrates pre-rename .dom files. Re-baselined at seed 1/20k: 57 fails on the 32-instance effective programme -\u003e 55 on the real 37-instance one, with all five previously-lost room instances now placed inside their declared sigma bands and zero fails naming them.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"homemaker-py-2v1","title":"Connectivity is under-priced ~3x against the circulation-\u003ehabitable value gap: the objective is net-positive on severing the spine","description":"Sharper root cause than homemaker-py-ssz, isolated by the 38.6 A/B (which showed none of the three crinkliness modes removes the deletion incentive). Deleting a circulation leaf merges it into its sibling, converting corridor into habitable area. value_circulation=50 vs value_inside=300, so that is a flat 6x value gain. The only counter-pressure is the 'level N not connected' fail, worth 0.5x under value *= 0.5**len(failures). Break-even needs 0.5^k \u003c 50/300, i.e. k \u003e 2.58 -- severing must cost AT LEAST 3 fails to be net-negative, and it costs 1. Net incentive to sever = 6 * 0.5 = 3.0x in favour; measured 4.06x on a well-lit (q_crink=0.736) circulation leaf, so this is NOT the zero-exposure effect and is not fixable inside quality_uncrinkliness. This is the cleanest explanation of why 'level 0 not connected' and 'level 1 not connected' are still present in evolved-3M-nols-3, the best layout found after 1.7M evals: the search is being paid 3-4x to create them.","design":"Options: (a) emit connectivity fails with a multiplicity \u003e= 3 (cheapest, but stacks with the 1i8 cascade-weighting problem and is a magic number); (b) make the connectivity penalty multiplicative and explicit rather than riding the generic 0.5^n (a dedicated building_factor term, sized from the value-rate gap so it tracks value_circulation/value_inside instead of being hard-coded); (c) revalue circulation as infrastructure -- its worth is that it makes other rooms reachable, which the current per-leaf value rate cannot express; the principled version credits circulation with the access it provides rather than its own floor area. (c) is the architecturally correct one and the biggest change. Recommend measuring (a) first purely to confirm the mechanism (does the 3x threshold flip the deletion test?), then designing (b) or (c) properly.","acceptance_criteria":"Deletion test (experiments/diag_exposure_frontage.py value + the ssz A/B harness) shows lit and buried C/O deletions are no longer rewarded; then harbor-house reaches the 15-fail floor in materially fewer than 1.7M evals AND without 'level 0/1 not connected' in the result.","status":"closed","priority":0,"issue_type":"bug","assignee":"Claude","owner":"noreply@anthropic.com","created_at":"2026-08-26T07:37:39Z","created_by":"Claude","updated_at":"2026-08-26T14:13:53Z","started_at":"2026-08-26T14:09:32Z","closed_at":"2026-08-26T14:13:53Z","close_reason":"MEASURED NULL — premise retracted (DESIGN.md §39.8). The arithmetic was right and the premise was wrong. Shipped connectivity_weight (EXPERIMENTAL, default 1.0 = flat rule, byte-identical) with connectivity_weight_for() deriving w=3 from value_inside/value_circulation rather than hard-coding it. At auto the §38.2 deletion test does not move AT ALL: 5/25 rewarded either way, median x0.26 vs x0.27 — because the connectivity fail count is UNCHANGED in every rewarded deletion (measured: 115-\u003e107 fails but 5-\u003e5 connectivity; 107-\u003e99 but 3-\u003e3; etc). Weighting a fail that never fires changes nothing. And when a deletion DOES break connectivity it is already punished: harbor 2 such deletions of 32, both punished (x0.00, x0.01); maple 5 of 32, all punished (x0.58..x0.07). Severing already costs 1-2 connectivity fails plus the cascade after them, which outweighs the x6 value gain. The x4.06 'well-lit circulation leaf' that motivated the bead was a deletion that did not change connectivity at all — it was rewarded for removing its own quality fails (§38.1's zero-value finding) and I misread it as a pricing mechanism. Flag kept default-off with the write-up per house style for a null lever.","dependency_count":0,"dependent_count":2,"comment_count":0} -{"_type":"issue","id":"homemaker-py-yql","title":"Why do level-not-connected fails persist in the best layout, if severing is already punished?","description":"Re-opened by homemaker-py-2v1 closing NULL (DESIGN.md §39.8). §38.2 claimed the search was PAID to sever the circulation spine; measurement refuted that — every deletion that actually breaks connectivity is already punished (x0.00 to x0.58 across harbor-house and maple-court, 0 of 7 rewarded). So the incentive is correct, yet 'level 0 not connected' and 'level 1 not connected' still survive in evolved-3M-nols-3, the best layout after 1.7M evals.\\n\\nThe evidence now points at REACHABILITY rather than incentive: connected topologies may be hard to construct and hard to hold onto under mutation, not insufficiently rewarded. Worth checking:\\n - what fraction of constructed seeds start connected at all (§39.7 measured 4/3/5 inaccessible-usable-space fails per 3 seeds, so: not many)\\n - whether a connected layout, once found, survives mutation or is quickly lost\\n - whether the constructive seeder's circulation dominating set actually guarantees connectivity, or only approximates it\\n - whether the §39.7 usage change (39% of adjacency edges now trimmed) makes connectivity materially harder to achieve, which would be a cost of that fix worth quantifying\\n\\nNOTE this is now measurable in a way it was not before §39.7: the fails actually fire on constructed seeds instead of being hidden by routes through store cupboards.","acceptance_criteria":"A measurement distinguishing 'rarely constructed' from 'constructed then lost' for level connectivity, and a named lever for whichever it is.","status":"open","priority":1,"issue_type":"task","owner":"noreply@anthropic.com","created_at":"2026-08-26T14:13:54Z","created_by":"Claude","updated_at":"2026-08-26T14:13:54Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"homemaker-py-3z0","title":"Preserve circulation connectivity DURING the resize, instead of repairing after it","description":"Named by homemaker-py-yql / DESIGN.md §39.9. The constructive seeder picks circulation as a CONNECTED dominating set and succeeds every time; _size_divisions_from_targets then moves every wall to hit the programme's area targets and destroys it. Measured: 41 of 49 circulation-to-circulation edges lost on health-centre, surviving shared walls squeezed to 0.54-1.11 m against door_width=1.2, taking fully-connected constructed seeds to 1/20, 1/20 and 0/20 across the corpus (100% with the resize disabled).\\n\\nRepairing AFTER the fact was measured and is a net loss (§39.9): operators.repair_circulation_settled restores 100% connectivity but raises missing-room fails by 5.0-8.5 per seed, because every leaf retyped to C displaces a required room at a 3-5 fail cascade. Kept default off.\\n\\nThe fix belongs upstream: constrain the resize so a shared boundary between two circulation leaves cannot fall below door_width. That is an added constraint on an existing solve rather than a new repair pass, and it keeps the programme intact — nothing is displaced, the wall simply is not allowed to close up.\\n\\nWorth checking while there: solver.py already has min_width_generic (default 1.2) keeping generic leaves from collapsing to slivers, which is the same idea applied to leaf WIDTH rather than to a shared BOUNDARY between two specific leaves. The new constraint may belong in the same place.","acceptance_criteria":"Constructed seeds stay \u003e=90% level-connected WITH the resize enabled, without raising missing-room fails; corpus re-baselined.","status":"open","priority":1,"issue_type":"feature","owner":"noreply@anthropic.com","created_at":"2026-08-26T14:37:48Z","created_by":"Claude","updated_at":"2026-08-26T14:37:48Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"homemaker-py-yql","title":"Why do level-not-connected fails persist in the best layout, if severing is already punished?","description":"Re-opened by homemaker-py-2v1 closing NULL (DESIGN.md §39.8). §38.2 claimed the search was PAID to sever the circulation spine; measurement refuted that — every deletion that actually breaks connectivity is already punished (x0.00 to x0.58 across harbor-house and maple-court, 0 of 7 rewarded). So the incentive is correct, yet 'level 0 not connected' and 'level 1 not connected' still survive in evolved-3M-nols-3, the best layout after 1.7M evals.\\n\\nThe evidence now points at REACHABILITY rather than incentive: connected topologies may be hard to construct and hard to hold onto under mutation, not insufficiently rewarded. Worth checking:\\n - what fraction of constructed seeds start connected at all (§39.7 measured 4/3/5 inaccessible-usable-space fails per 3 seeds, so: not many)\\n - whether a connected layout, once found, survives mutation or is quickly lost\\n - whether the constructive seeder's circulation dominating set actually guarantees connectivity, or only approximates it\\n - whether the §39.7 usage change (39% of adjacency edges now trimmed) makes connectivity materially harder to achieve, which would be a cost of that fix worth quantifying\\n\\nNOTE this is now measurable in a way it was not before §39.7: the fails actually fire on constructed seeds instead of being hidden by routes through store cupboards.","acceptance_criteria":"A measurement distinguishing 'rarely constructed' from 'constructed then lost' for level connectivity, and a named lever for whichever it is.","status":"closed","priority":1,"issue_type":"task","assignee":"Claude","owner":"noreply@anthropic.com","created_at":"2026-08-26T14:13:54Z","created_by":"Claude","updated_at":"2026-08-26T14:37:30Z","started_at":"2026-08-26T14:31:19Z","closed_at":"2026-08-26T14:37:30Z","close_reason":"ANSWERED (DESIGN.md §39.9): constructed, then lost — at construction time, in the resize. _assign_adjacency_aware picks circulation as a CONNECTED dominating set and succeeds every time; _size_divisions_from_targets then moves every wall and destroys it. Measured, 20 seeds/programme: fully-connected seeds harbor 1/20, health-centre 1/20, maple 0/20. Control with proportion_aware=False (no resize): 100% connected on all three. Mechanism confirmed on health-centre: 41 of 49 circulation-to-circulation edges destroyed by the resize, surviving shared walls squeezed to 0.54-1.11 m against door_width=1.2. Same failure mode §37.7 recorded for CP-SAT assignment, never looked for in connectivity, worth 35-95 points.\n\n§39.7 COST CHECK: zero. Identical rates under prefix-inferred vs declared usages — has_circulation never trims C-C edges, so the usage change did not make connectivity harder.\n\nREPAIR MEASURED NEGATIVE: operators.repair_circulation_settled (§37.7's alternating-minimisation fix, bridging by retyping to C after geometry settles) restores 100% connectivity on all three programmes but is a net loss — connectivity fails -0.8..-1.7 while missing-room fails +5.0..+8.5, because each retyped leaf displaces a required room at a 3-5 fail cascade. Kept default off with the write-up.\n\nNEXT LEVER NAMED: preserve the connection during the resize (constrain _size_divisions_from_targets so a shared C-C boundary cannot fall below door_width) rather than rebuild it afterwards at the programme's expense.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"homemaker-py-sel","title":"Usage prefixes (b/t/l/k) are a second implicit namespace: 4 corpus rooms get another room's connectivity rules from their spelling","description":"§39.4 separated programme codes from the GENERIC structural types (C/O/S). It did not touch the other namespace sharing the first character: the USAGE prefixes b=bedroom, t=toilet, l=living, k=kitchen. These classify programme codes by first letter and are still prefix-based BY DESIGN (it is how Urb encodes room usage, and unlike the generic rule they never discard a requirement) -- but they are not inert.\\n\\ngraph.has_circulation deletes graph edges from them: a 'bedroom' loses its edges to living/kitchen/bedroom/toilet, a 'toilet' loses its edges to outside/living/kitchen/toilet, and b/t keep their LEAST popular circulation neighbour while l/k keep their MOST popular. fitness.access and the public-access check read them too. So a code that picks one up by accident is silently given another room's connectivity rules -- and connectivity is exactly where §38 located the residual.\\n\\nFour corpus rooms are misclassified by spelling alone:\\n la1 'Laundry Room' -\u003e living (harbor-house, harbor-house-l0, maple-court)\\n li1 'Library Corner' -\u003e living (harbor-house, maple-court)\\n br1 'Staff Room' -\u003e bedroom (health-centre)\\n tr1 'Treatment Room' -\u003e toilet (health-centre)\\n\\nMeasured on a constructed health-centre seed: tr1 (as a toilet) has its edge to the adjacent outside space O stripped from the circulation graph; br1 (as a bedroom) has its edge to t10 'Staff WC' stripped. Both feed has_circulation and therefore the 'N inaccessible usable space' / 'level N not connected' fails.\\n\\nReport it with: python experiments/audit_programme_config.py (usage-prefix section).","design":"FINAL SHAPE. usage is a plain ATTRIBUTE of the space definition, mandatory on every declared code, no prefix fallback and NO mapping table.\n\n spaces:\n ws1:\n name: Workshop Space # free text, building-specific\n usage: living # controlled, drives engine behaviour\n\nThe earlier 'usage_classes:' indirection table (binding author-coined names like craft-\u003eliving) is WITHDRAWN. It was wrong three ways: (a) an indirect name-\u003ebehaviour mapping living apart from the thing it describes is exactly the shape of the first-character prefix rule that §39 exists to remove, not relocate; (b) it is inconsistent with the schema — every other space property is a plain attribute (name/size/width/proportion/adjacency/level/requires_below/count/share/interchange/co_locate) and no key in patterns.config is an indirection table; (c) the need it served is already met, because 'programmes are building specific' is about what a room is CALLED and name: is already free text, whereas usage: records ACCESS REQUIREMENTS, which are not building-specific — a craft room and a lounge have the same ones, which is the entire reason the key exists.\n\nRULE THAT FALLS OUT: a usage value exists if and only if the engine treats it differently somewhere. Config selects among behaviours; it cannot invent them. A genuinely new access class means writing code, and at that point the value joins the controlled set for everyone. utility passes this test — not on edge-stripping (identical to bedroom today) but because it is intended to drive derive_interchange_classes; distinct behaviour in a second subsystem is a real difference, an alias is not.\n\nVocabulary: living, kitchen, bedroom, toilet, utility, none. Missing usage on a declared code = load error naming the code. Unknown value = load error.\n\nMutation-safety (the original objection): usage is CODE-level, so usage_of(leaf.type) is looked up fresh on every read exactly as size/width/adjacency already are. Never stamp it on a leaf — 51 sites assign leaf.type, and share/share_type plus the r5a resurrection bug are the precedent for why leaf-level attributes go stale.\n\nAssignments for all 52 corpus codes: experiments/usage_map_proposal.yaml (living 12, bedroom 17, utility 11, toilet 7, kitchen 2, none 3; zero unresolved).","acceptance_criteria":"A programme can declare a room's usage explicitly; the prefix rule applies only where nothing is declared; audit_programme_config reports no unintended usage classification across the corpus; re-baselined with an A/B.","notes":"ALL 52 CORPUS CODES NOW ASSIGNED (experiments/usage_map_proposal.yaml): living 12, bedroom 17, utility 11, toilet 7, kitchen 2, none 3. Zero unresolved.\n\nRulings received: li1 Library Corner + br1 Staff Room -\u003e living (same access requirements); tr1 Treatment Room -\u003e bedroom; la1 Laundry -\u003e utility; zt1 Sterilisation -\u003e utility; ph1 Pharmacy -\u003e bedroom (private room, not public, like an office); n 'Neighborhood' -\u003e bedroom (a communal sleeping area, much like a dormitory); gh1 Greenhouse -\u003e living (grows plants but a living area like a conservatory); ws1 Workshop -\u003e living CONDITIONALLY (building-specific: communal craft room vs maintenance area; both corpus programmes carrying it are communal living facilities).\n\nDESIGN DECISION 1 — utility is a DISTINCT value, not an alias for bedroom. Same edge-stripping today (identical access requirements) but separately declared, because (a) they are very different uses and the config should read truthfully, and (b) it gives programme.derive_interchange_classes (§13/§26, homemaker-py-9o5) a natural axis: bedroom-class and utility-class leaves could be interchangeable DURING search and collapse to their real use at scoring time — exactly the superposition relaxation that machinery already implements. Worth building the usage key with that hook in mind.\n\nDESIGN DECISION 2 — vocabulary controlled but NOT closed. The earlier 'closed enum, unknown value errors' recommendation is withdrawn ('programmes are building specific, so it would be nice to have a controlled vocabulary, but not entirely necessary'). Proposed: the six known names drive engine behaviour; a programme may coin its own (usage: craft) provided it binds it in the same file via usage_classes: {craft: living}. An unbound name is a load error, so naming stays free without ever letting an unrecognised usage fall through to a silent default.\n\nVERIFIED — Brand adjacency point is NOT an engine bug. fitness._evaluate_full runs check_adjacency against graph_base_pre, the UNFILTERED graph, so a declared adjacency requirement is satisfied by a neighbouring room regardless of what has_circulation strips. The stripping only denies ROUTING, which is correct. So 'a toilet adjacent to a bedroom is a positive even if there is no door' is already expressible -- but it is only scored where DECLARED, and 3 of 4 real programmes never declare it: only programme-house has t1 -\u003e adjacency [b1]. harbor-house (t vs r/n), maple-court (t/tt vs r/n) and health-centre (t9/t10 vs tr1) do not. Filed separately as homemaker-py-adj.","status":"closed","priority":1,"issue_type":"bug","owner":"noreply@anthropic.com","created_at":"2026-08-26T10:06:54Z","created_by":"Claude","updated_at":"2026-08-26T13:38:20Z","closed_at":"2026-08-26T13:38:20Z","close_reason":"SHIPPED (DESIGN.md §39.7). usage: is a mandatory plain attribute of the space definition; vocabulary living/kitchen/bedroom/toilet/utility/none; missing or unknown is a load error from both parse paths. Code-level so it survives retype, never stamped on a leaf. has_circulation, fitness.access and the public-access check all key on declared usage; fitness._t0 deleted — no first-character type test remains anywhere. All 107 corpus entries migrated. MEASURED: connectivity model was ~4x too permissive; edges trimmed prefix-inferred vs declared, 3 seeds: harbor 18(9%)-\u003e79(39%), health-centre 12(8%)-\u003e59(40%), maple 53(17%)-\u003e123(39%); inaccessible fails 0-\u003e4, 2-\u003e3, 1-\u003e5. Harbor re-baseline seed 1/20k: 58 (15h/43s) -\u003e 61 (16h/45s), now reporting inaccessible-usable-space x2 plus level 0 and level 1 not connected — the count rose because the objective got honest.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"homemaker-py-ut5","title":"Update the 2v1 acceptance target: harbor's 15-fail reference was measured pre-ju3 against the 32-instance effective programme","description":"DESIGN.md 38.7 fixes the acceptance test for homemaker-py-2v1 as 'harbor-house reaches its known 15-fail floor in materially fewer than 1.7M evals, and without level 0/1 not connected'. That 15-fail figure comes from evolved-3M-nols-3, measured before homemaker-py-ju3 against the 32-instance EFFECTIVE programme (cr1/of/st1/st2 silently dropped or mis-parameterised). Against the real 37-instance programme the number will differ, so the target as written is not measurable any more.\\n\\nNeeded: migrate evolved-3M*.dom with experiments/migrate_ju3_rename.py, rescore against the renamed programme, and restate the 2v1 acceptance figure. The 39.3 re-baseline (55 fails, seed 1, 20k evals) is the new near-term reference but is not the long-budget floor.","acceptance_criteria":"evolved-3M*.dom committed and migrated; its post-ju3 fail count recorded in DESIGN.md; the 2v1 acceptance figure restated against it.","status":"open","priority":1,"issue_type":"task","owner":"noreply@anthropic.com","created_at":"2026-08-26T09:05:23Z","created_by":"Claude","updated_at":"2026-08-26T09:05:23Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"homemaker-py-hxi","title":"Buried circulation and outside space are negative-value: search is rewarded for deleting the circulation spine","description":"Direct consequence of the zero-exposure bug. Measured on a constructed harbor-house seed: deleting a buried O leaf improved the raw score 85x and removed 7 fails; deleting a buried C leaf improved it 62x and removed 6 fails. Programme rooms are held in place ONLY by the missing-space fail cascade, not by contributing value -- deleting a buried k1/da1/m costs +15 fails, so they stay, but nothing positive keeps them. Circulation and outside leaves carry no missing-space requirement, so nothing keeps them at all. Observed live: in a 20k-eval harbor-house run, undivide/core_undivide account for a large share of recorded improvements (16 occurrences in the log) -- the search is literally deleting circulation to score better. This explains three prior negative results as a single mechanism: 18 graded circulation-connectivity (a tie-break signal cannot beat a 60x scalar gradient), 21/22 bridge_circulation (the operator inserts corridor leaves the objective immediately punishes), and the 'level N not connected' hard fails surviving \u003e1M evals in the 3M run.","notes":"Depends on the zero-exposure fix; may need no separate fix if (a)/(c) there restores a value gradient for circulation. Worth re-running the 18 and 21/22 A/Bs afterwards -- both may have been measuring a broken gradient rather than a bad idea.","status":"open","priority":1,"issue_type":"bug","owner":"noreply@anthropic.com","created_at":"2026-08-25T23:14:40Z","created_by":"Claude","updated_at":"2026-08-25T23:14:40Z","dependencies":[{"issue_id":"homemaker-py-hxi","depends_on_id":"homemaker-py-ssz","type":"blocks","created_at":"2026-08-25T23:15:12Z","created_by":"Claude","metadata":"{}"},{"issue_id":"homemaker-py-hxi","depends_on_id":"homemaker-py-2v1","type":"blocks","created_at":"2026-08-26T07:37:47Z","created_by":"Claude","metadata":"{}"}],"dependency_count":2,"dependent_count":0,"comment_count":0} diff --git a/DESIGN.md b/DESIGN.md index d7c95c8..c71525b 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -5494,3 +5494,86 @@ question (`homemaker-py-yql`) — the evidence now says it is a reachability pro (connected topologies are hard to construct and hold onto), not an incentive one. It is newly measurable: §39.7 made the fails fire on constructed seeds instead of being hidden by routes through store cupboards. + +### 39.9 Why `level N not connected` persists: the resize destroys it (`homemaker-py-yql`) + +§39.8 closed `2v1` NULL — severing circulation is already punished, so the fail +is not something the search is paid to create. That left the real question: is a +connected layout **rarely constructed**, or **constructed and then lost**? + +**Answer: constructed, then lost — at construction time, in the resize.** + +`level N not connected` fires from `graph.connected_circulation`, which keeps +only the generic `C`/`S` leaves and asks whether *they* form one component. +Measured over 20 constructed seeds per programme +(`experiments/diag_connectivity_yql.py`): + +| programme | levels connected | seeds fully connected | +|---|---|---| +| harbor-house | 21/40 (52%) | **1/20** | +| health-centre | 1/20 (5%) | **1/20** | +| maple-court | 39/60 (65%) | **0/20** | + +Then the decisive control — the same seeds with `proportion_aware=False`, i.e. +skipping `_size_divisions_from_targets`: + +| programme | with resize | **without resize** | +|---|---|---| +| harbor-house | 52% | **100%** | +| health-centre | 5% | **100%** | +| maple-court | 65% | **100%** | + +`_assign_adjacency_aware` picks circulation as a **connected** dominating set — +and it succeeds every time. The resize then moves every wall to hit the +programme's area targets, and the shared boundaries the dominating set relied on +shrink or vanish. On health-centre, **41 of 49 circulation-to-circulation edges +are destroyed by the resize**, and surviving shared walls are squeezed to +0.54–1.11 m against a 1.2 m `door_width`, so they stop counting as edges at all. + +This is exactly the failure mode §37.7 recorded for CP-SAT room assignment — +"resizing can shrink a shared-wall segment below the door-width adjacency +threshold, silently invalidating an edge the exact solve relied on" — but nobody +had looked for it in **circulation connectivity**, where it costs 35–95 points. + +**§39.7 cost check: zero.** The same measurement under prefix-inferred vs +declared usages is identical (52/5/65% both ways). `has_circulation` never trims +`C`–`C` edges, so the usage change could not and did not make connectivity +harder to achieve. + +#### The obvious repair is a net loss — measured + +`operators.repair_circulation_settled` applies §37.7's own alternating- +minimisation fix: after the geometry settles, re-connect circulation by retyping +the cheapest bridging leaves to `C` (preferring generic outside, then +unassigned, crossing a required room last — `mutate_bridge_circulation`'s cost +model). It works, completely: + +| programme | levels connected, repair OFF | repair ON | +|---|---|---| +| harbor-house | 52% (1/20 seeds full) | **100% (20/20)** | +| health-centre | 5% (1/20) | **100% (20/20)** | +| maple-court | 65% (0/20) | **100% (20/20)** | + +And it is still the wrong trade. Mean fails per constructed seed, 12 seeds: + +| programme | total | hard | connectivity | missing-room | +|---|---|---|---|---| +| harbor-house | 96.6 → **108.9** | 46.0 → 56.2 | 3.7 → 2.0 | 14.2 → **19.2** | +| health-centre | 62.8 → **84.2** | 24.2 → 46.8 | 2.9 → 2.2 | 2.0 → **10.5** | +| maple-court | 141.8 → **156.6** | 57.4 → 69.2 | 4.7 → 3.5 | 14.8 → **19.8** | + +Connectivity failures fall by 0.8–1.7; missing-room failures rise by 5.0–8.5, +because every leaf retyped to `C` displaces a required room and each displacement +costs a 3–5 fail cascade (§38.5). **Robbing Peter to pay Paul.** Kept default +off with this write-up, per house style for a measured-null lever. + +**The lever is upstream, not downstream.** The repair is treating a symptom: the +connection should never be destroyed in the first place. The named next move is +to *preserve* it during the resize — constrain `_size_divisions_from_targets` so +a shared boundary between two circulation leaves cannot fall below `door_width` +— rather than to rebuild it afterwards at the cost of the programme. That is a +constraint on an existing solve rather than a new repair pass. Filed as +`homemaker-py-3z0`. Worth noting while there: `solver.py` already carries +`min_width_generic` (default 1.2) to stop generic leaves collapsing to slivers +— the same idea applied to a leaf's WIDTH rather than to a shared BOUNDARY +between two specific leaves, so the new constraint may belong beside it. diff --git a/experiments/diag_connectivity_yql.py b/experiments/diag_connectivity_yql.py new file mode 100644 index 0000000..b977793 --- /dev/null +++ b/experiments/diag_connectivity_yql.py @@ -0,0 +1,167 @@ +"""Why does `level N not connected` persist? (`homemaker-py-yql`, DESIGN.md §39.9) + +`homemaker-py-2v1` closed NULL: severing a level's circulation is already +punished, so the fail is not something the search is paid to create. This asks +the follow-on question — is a connected layout **rarely constructed**, or +**constructed and then lost**? + +`level N not connected` fires from `graph.connected_circulation`, which keeps +only the generic circulation leaves (`C`/`S`) and asks whether *they* form one +connected component. It runs on `graph_circ`, i.e. AFTER +`graph.has_circulation` has trimmed edges, so §39.7's usage change can in +principle reach it — report (b) measures whether it did. + +Three reports: + + construct what fraction of constructed seeds start connected, per level + cost the same, prefix-inferred usages vs declared (the §39.7 cost) + survive from a CONNECTED layout, how often does one mutation break + connectivity, and would the outer comparator keep the mutant + +Usage:: + + python experiments/diag_connectivity_yql.py construct + python experiments/diag_connectivity_yql.py cost + python experiments/diag_connectivity_yql.py survive --seeds 40 +""" + +from __future__ import annotations + +import argparse +import copy +from pathlib import Path + +import numpy as np + +from homemaker_layout import dom as dom_mod +from homemaker_layout import driver, fitness, geometry +from homemaker_layout import graph as graph_mod +from homemaker_layout import operators, programme + +CORPUS = ["examples/harbor-house", "examples/health-centre", "examples/maple-court"] +LEGACY_PREFIX = {"b": "bedroom", "t": "toilet", "l": "living", "k": "kitchen"} + + +def make_fitness(progdir: str) -> fitness.Fitness: + overrides = driver._overrides_for( + leaf_sharing=True, superpose=False, max_share=None, conn_grade=False, + collapse_insearch=True, multi_use=False) + conf, cost = fitness.load_config(progdir, overrides=dict(overrides or {})) + return fitness.Fitness(conf, cost) + + +def constructed_seed(progdir: str, seed: int) -> dom_mod.Node: + reqs = programme.load_programme_dir(progdir) + return operators.constructive_topology( + dom_mod.load(f"{progdir}/init.dom"), reqs, np.random.default_rng(seed), + sorted(reqs) + ["C", "O"], + min_storeys=programme.storey_minimum(progdir), + adjacency_aware=True, proportion_aware=True, circ_divisor=3, + leaf_sharing=True, leaf_share_factor=3, depth_balanced=True, + interior_outside=True, outside_divisor=3) + + +def connectivity(root: dom_mod.Node, usages: dict[str, str]) -> tuple[int, int]: + """``(levels_connected, levels_total)`` for one tree. + + Mirrors the scorer: build the circ graphs, then ask + ``connected_circulation`` per level on a copy, exactly as + ``process_storey`` does. + """ + tree = copy.deepcopy(root) + geometry.clear_cache() + dom_mod.canonicalize_shares(tree) + _, circ = graph_mod.build_graphs_with_circ(tree, 1.2, lambda _f: None, usages) + connected = sum(1 for gc in circ + if graph_mod.connected_circulation(gc.copy())) + return connected, len(circ) + + +def report_construct(seeds: int) -> None: + print(f"how often does a CONSTRUCTED seed start connected? ({seeds} seeds)\n") + print(f" {'programme':<18}{'levels connected':<20}{'seeds fully connected'}") + print(" " + "-" * 62) + for progdir in CORPUS: + fit = make_fitness(progdir) + usages = fit.usages() + ok = tot = full = 0 + for s in range(seeds): + c, n = connectivity(constructed_seed(progdir, s), usages) + ok += c + tot += n + full += (c == n) + print(f" {Path(progdir).name:<18}{f'{ok}/{tot} ({100*ok/max(tot,1):.0f}%)':<20}" + f"{full}/{seeds}") + + +def report_cost(seeds: int) -> None: + """Did §39.7's usage change make level connectivity harder to achieve?""" + print("§39.7 cost check — prefix-inferred usages vs declared " + f"({seeds} seeds)\n") + print(f" {'programme':<18}{'prefix-inferred':<20}{'declared':<20}delta") + print(" " + "-" * 68) + for progdir in CORPUS: + reqs = programme.load_programme_dir(progdir) + declared = {c: r.usage for c, r in reqs.items()} + legacy = {c: LEGACY_PREFIX.get(c[:1].lower(), "none") for c in reqs} + res = {} + for label, usages in (("legacy", legacy), ("declared", declared)): + ok = tot = 0 + for s in range(seeds): + c, n = connectivity(constructed_seed(progdir, s), usages) + ok += c + tot += n + res[label] = (ok, tot) + (a, ta), (b, tb) = res["legacy"], res["declared"] + delta = 100 * b / max(tb, 1) - 100 * a / max(ta, 1) + print(f" {Path(progdir).name:<18}" + f"{f'{a}/{ta} ({100*a/max(ta,1):.0f}%)':<20}" + f"{f'{b}/{tb} ({100*b/max(tb,1):.0f}%)':<20}{delta:+.0f} pts") + + +def report_survive(seeds: int) -> None: + """From a CONNECTED level, how fragile is that connectivity under one + mutation — and would the comparator keep the mutant anyway?""" + print(f"survival of connectivity under one mutation ({seeds} trials)\n") + print(f" {'programme':<18}{'started connected':<20}{'broken by mutation':<22}" + f"{'…and kept by comparator'}") + print(" " + "-" * 82) + for progdir in CORPUS: + fit = make_fitness(progdir) + usages = fit.usages() + reqs = programme.load_programme_dir(progdir) + types = sorted(reqs) + ["C", "O"] + started = broken = kept = 0 + rng = np.random.default_rng(0) + for s in range(seeds): + root = constructed_seed(progdir, s) + c, n = connectivity(root, usages) + if c != n: + continue # only study layouts that ARE connected + started += 1 + base_score, base_fails = fit.score_with_fails(copy.deepcopy(root)) + child, _desc = operators.mutate(root, rng, types, reqs=reqs) + c2, n2 = connectivity(child, usages) + if c2 == n2: + continue + broken += 1 + # would the outer loop admit it? lexicographic (-n_fails, fitness) + score, fails = fit.score_with_fails(copy.deepcopy(child)) + if (-len(fails), score) > (-len(base_fails), base_score): + kept += 1 + print(f" {Path(progdir).name:<18}{f'{started}/{seeds}':<20}" + f"{f'{broken}/{max(started,1)}':<22}{kept}") + + +def main() -> None: + ap = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument("report", choices=("construct", "cost", "survive")) + ap.add_argument("--seeds", type=int, default=20) + args = ap.parse_args() + {"construct": report_construct, "cost": report_cost, + "survive": report_survive}[args.report](args.seeds) + + +if __name__ == "__main__": + main() diff --git a/src/homemaker_layout/operators.py b/src/homemaker_layout/operators.py index 2030bd3..555a75a 100644 --- a/src/homemaker_layout/operators.py +++ b/src/homemaker_layout/operators.py @@ -460,6 +460,80 @@ def mutate_bridge_circulation(root: dom.Node, rng: np.random.Generator, return _finalise(child), f"bridge_circulation lvl{li}: {names} -> C" +def repair_circulation_settled(lvl: dom.Node, reqs, max_bridges: int = 8) -> int: + """Reconnect a storey's circulation AFTER the geometry has settled. + + homemaker-py-yql (DESIGN.md §39.9). ``_assign_adjacency_aware`` picks + circulation as a CONNECTED dominating set, but it does so against the + pre-resize geometry; ``_size_divisions_from_targets`` then moves every wall + to hit the programme's area targets and the shared boundaries the dominating + set relied on shrink below ``door_width`` or vanish outright. Measured on + health-centre: 41 of 49 circulation-to-circulation edges destroyed by the + resize, surviving shared walls squeezed to 0.54-1.11 m against a 1.2 m + threshold — so only 5% of constructed seeds started connected, against 100% + with the resize disabled. + + This is the same alternating-minimisation fix §37.7 applied to room + assignment (``_cpsat_relabel_settled``): re-run the step against the + geometry that actually resulted. Retypes the cheapest bridging leaves to + ``C``, preferring generic outside, then unassigned, and crossing a required + room last — the cost model ``mutate_bridge_circulation`` already uses. + + Returns the number of leaves retyped. Idempotent once connected. + """ + import networkx as nx + + from . import geometry as _geo, graph as _graph + + def _cost(node: dom.Node) -> int: + if dom.is_circulation(node): + return 0 + if not node.type: + return 1 + if node.type in dom.GENERIC_OUTSIDE: + return 0 + if reqs and node.type in reqs: + return 5 + return 1 + + retyped = 0 + for _ in range(max_bridges): + _geo.clear_cache() + G = _geo.leaf_graph(lvl, _graph.DOOR_WIDTH) + circ = [x for x in G.nodes() if dom.is_circulation(x)] + if not circ: + return retyped + comps = list(nx.connected_components(G.subgraph(circ))) + if len(comps) <= 1: + return retyped + weighted = G.copy() + for u, v, data in weighted.edges(data=True): + data["bridge_weight"] = (_cost(u) + _cost(v)) / 2.0 + best_path = None + best_weight = None + for i in range(len(comps)): + for j in range(i + 1, len(comps)): + for a in comps[i]: + for b in comps[j]: + try: + path = nx.shortest_path(weighted, a, b, + weight="bridge_weight") + except nx.NetworkXNoPath: + continue + w = sum(_cost(x) for x in path[1:-1]) + if best_weight is None or w < best_weight: + best_weight, best_path = w, path + if not best_path: + return retyped + middle = [x for x in best_path[1:-1] if not dom.is_circulation(x)] + if not middle: + return retyped # components already touch; nothing to retype + for leaf in middle: + leaf.type = "C" + retyped += 1 + return retyped + + def _shape_failing(leaf: dom.Node, fit) -> bool: """A named-room leaf whose width or proportion factor actually fails (``< fitness.FAIL_THRESHOLD``) under ``fit``, the same Gaussian quality @@ -1207,7 +1281,8 @@ def constructive_topology(seed_root: dom.Node, reqs, rng: np.random.Generator, outside_divisor: int = 3, construction_beam_width: int = 1, multi_use: bool = False, - assign_solver: str = "greedy") -> dom.Node: + assign_solver: str = "greedy", + repair_circulation: bool = False) -> dom.Node: """Build a seed that instantiates every required space by construction. The §11.0 diagnosis: random divide+retype chains leave required programme @@ -1317,6 +1392,8 @@ def constructive_topology(seed_root: dom.Node, reqs, rng: np.random.Generator, leaf_extra=leaf_extra) if adjacency_aware and assign_solver == "cpsat": _cpsat_relabel_settled(lvl, reqs) + if repair_circulation: + repair_circulation_settled(lvl, reqs) return _finalise(child) diff --git a/tests/test_operators.py b/tests/test_operators.py index 9754eda..2d35194 100644 --- a/tests/test_operators.py +++ b/tests/test_operators.py @@ -937,3 +937,65 @@ def test_assign_cpsat_beats_greedy_on_a_namespace_clean_programme(): return total assert secondary_fails("cpsat") < secondary_fails("greedy") + + +# --------------------------------------------------------------------------- # +# homemaker-py-yql / DESIGN.md §39.9 — settled-geometry circulation repair +# --------------------------------------------------------------------------- # +@pytest.mark.skipif(not HARBOR.is_dir(), reason="harbor-house not available") +def test_repair_circulation_default_off_reproduces_prior_seeds(): + """Default off must be byte-identical, like every other experimental flag.""" + from homemaker_layout import programme + + reqs = programme.load_programme_dir(str(HARBOR)) + types = sorted(reqs) + ["C", "O"] + seed = dom.load(str(HARBOR / "init.dom")) + kw = dict(min_storeys=programme.storey_minimum(str(HARBOR)), + adjacency_aware=True, proportion_aware=True, circ_divisor=3) + + def sig(**extra): + root = operators.constructive_topology( + seed, reqs, np.random.default_rng(3), types, **kw, **extra) + return tuple(lf.type for lvl in dom.levels(root) for lf in lvl.leaves()) + + assert sig() == sig(repair_circulation=False) + + +@pytest.mark.skipif(not HARBOR.is_dir(), reason="harbor-house not available") +def test_repair_circulation_reconnects_every_storey(): + """§39.9: the constructed circulation dominating set is connected, but + _size_divisions_from_targets then moves every wall and the shared + boundaries it relied on drop below door_width. Repairing against the + SETTLED geometry restores connectivity — measured 52% -> 100% of levels on + harbor-house. (Whether that is a net WIN is a different question: it is + not, see §39.9 — it displaces required rooms. Hence default off.) + """ + import networkx as nx + + from homemaker_layout import geometry, graph as graph_mod, programme + + reqs = programme.load_programme_dir(str(HARBOR)) + types = sorted(reqs) + ["C", "O"] + seed = dom.load(str(HARBOR / "init.dom")) + + def levels_connected(repair: bool) -> tuple[int, int]: + ok = tot = 0 + for s in range(6): + root = operators.constructive_topology( + seed, reqs, np.random.default_rng(s), types, + min_storeys=programme.storey_minimum(str(HARBOR)), + adjacency_aware=True, proportion_aware=True, circ_divisor=3, + repair_circulation=repair) + for lvl in dom.levels(root): + geometry.clear_cache() + G = geometry.leaf_graph(lvl, graph_mod.DOOR_WIDTH) + circ = [n for n in G.nodes() if dom.is_circulation(n)] + tot += 1 + if circ and nx.is_connected(G.subgraph(circ)): + ok += 1 + return ok, tot + + off_ok, off_tot = levels_connected(False) + on_ok, on_tot = levels_connected(True) + assert on_ok == on_tot, f"repair left {on_tot - on_ok} storeys disconnected" + assert on_ok > off_ok, f"repair did not help: {off_ok}/{off_tot} -> {on_ok}/{on_tot}"