Skip to content

Commit 854d177

Browse files
authored
Merge pull request #166 from DemchaAV/chore/sweep-aftermath
chore(docs): sweep aftermath - hasContent null contract, bisect note, debug-overlay guides
2 parents 5aa754a + 6bb3f04 commit 854d177

5 files changed

Lines changed: 70 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,19 @@ Entries land here as they merge.
192192
`ChartStyle` palette override (navy/gold) and an explicit 0–100 axis —
193193
~90 lines of hand-drawn AWT geometry replaced by a declarative spec.
194194

195+
### Internal
196+
197+
- **Sweep follow-up note for future bisectors.** The v1.8.0 import/Javadoc
198+
sweep (`f04a7dce`, part of #162) also carried mechanical code rewrites in
199+
roughly 40 files beyond its stated scope: ~30 private preset `Template`
200+
classes converted to records, constructor copy-loops replaced with
201+
`Collections.addAll`, explicit imports collapsed to wildcards, and five
202+
presets' explicit `section == null` guards folded into
203+
`SectionLookup.hasContent`'s null tolerance (now documented on the method
204+
and pinned by `SectionLookupTest`). All rewrites were verified
205+
behavior-preserving by the full gate at merge time; recorded here so a
206+
future bisect does not skip that commit on the strength of its message.
207+
195208
### Tests
196209

197210
- Chart geometry pinned without rendering: `NiceScaleTest` golden tables and

docs/getting-started.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@ document.guideLines(true);
120120
byte[] debugPdf = document.toPdfBytes();
121121
```
122122

123+
Need to know *which* block is which? `DocumentDebugOptions` adds semantic
124+
node labels on top of the guides — every rendered node gets a small corner
125+
badge with the same stable path `layoutSnapshot()` reports:
126+
127+
```java
128+
document.debug(DocumentDebugOptions.guidesAndNodeLabels());
129+
byte[] labelledPdf = document.toPdfBytes();
130+
```
131+
132+
Spot the misplaced block on the sheet, read its badge, then search that
133+
name in your builder code.
134+
123135
## Module-First Authoring
124136

125137
Use modules when you are building a normal document section. A module

docs/operations/production-rendering.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ the session.
4242

4343
## Debug Output
4444

45-
Use `GraphCompose.document(path).guideLines(true)` or
46-
`document.guideLines(true)` only for local diagnostics, visual tests, and layout
47-
debugging. Guide lines are a render-only overlay and do not change pagination or
48-
layout snapshots. Production services should normally leave them disabled.
45+
Use `GraphCompose.document(path).guideLines(true)`, `document.guideLines(true)`,
46+
or the fuller `document.debug(DocumentDebugOptions.guidesAndNodeLabels())`
47+
which adds semantic node-path badges on top of the guides — only for local
48+
diagnostics, visual tests, and layout debugging. Debug overlays are render-only
49+
and do not change pagination or layout snapshots. Production services should
50+
normally leave them disabled.
4951

5052
## Cache And Privacy Policy
5153

src/main/java/com/demcha/compose/document/templates/cv/v2/components/SectionLookup.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,15 @@ public static CvSection firstMatching(List<CvSection> sections,
4242
/**
4343
* Reports whether the section carries any renderable content.
4444
*
45-
* @param section the section to inspect
45+
* <p><b>{@code null} is accepted and reports {@code false}.</b> Preset
46+
* call sites feed this method straight from {@link #firstMatching}, which
47+
* returns {@code null} when no section title matches, and rely on the
48+
* null tolerance to silently skip absent modules. Keep that tolerance if
49+
* this method is ever rewritten as an exhaustive {@code switch} over the
50+
* sealed {@code CvSection} hierarchy — {@code SectionLookupTest} pins the
51+
* contract.</p>
52+
*
53+
* @param section the section to inspect; may be {@code null}
4654
* @return {@code true} if the section has non-empty body, entries,
4755
* rows, or skill groups
4856
*/
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.demcha.compose.document.templates.cv.v2.components;
2+
3+
import com.demcha.compose.document.templates.cv.v2.data.ParagraphSection;
4+
import org.junit.jupiter.api.Test;
5+
6+
import static org.assertj.core.api.Assertions.assertThat;
7+
8+
/**
9+
* Pins the {@link SectionLookup#hasContent} null contract: six v2 presets
10+
* call it directly on {@code SectionLookup.firstMatching(...)} results
11+
* (which are {@code null} when no section title matches) without their own
12+
* null guards, so a {@code null} section must keep reporting {@code false}
13+
* — never throw — even if the method is later rewritten as an exhaustive
14+
* switch over the sealed {@code CvSection} hierarchy.
15+
*/
16+
class SectionLookupTest {
17+
18+
@Test
19+
void hasContentToleratesNullSections() {
20+
assertThat(SectionLookup.hasContent(null)).isFalse();
21+
}
22+
23+
@Test
24+
void hasContentSeesParagraphBodies() {
25+
assertThat(SectionLookup.hasContent(new ParagraphSection("Profile", "Seasoned engineer.")))
26+
.isTrue();
27+
assertThat(SectionLookup.hasContent(new ParagraphSection("Profile", " ")))
28+
.isFalse();
29+
}
30+
}

0 commit comments

Comments
 (0)