This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch openformula
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 7e6ad45c8245b83d0822002384a57fcdf5929adc
Author: Pedro Giffuni <[email protected]>
AuthorDate: Sat Nov 14 11:19:38 2026 -0500

    docs: G.3 COUNTBLANK semantics — decision documented, no code change needed
    
    ODF 1.4 6.13.8 makes formula-cell-returning-"" blank-counting
    implementation-defined. Source inspection confirms AOO already exercises
    this choice via lcl_IsCountBlankEmpty() (interpr1.cxx:4745-4758),
    which inspects formula results and treats formula-cell-returning-""
    as blank for COUNTBLANK. ISBLANK (6.13.14) returns FALSE for empty
    string — no conflict since COUNTBLANK behavior is implementation-defined.
    
    Correct semantic audit COUNTBLANK execution path table (was incorrectly
    described as cell-type-only). Expand comparison table to cover all 8
    cell cases. Update Conformance Classification, Compatibility Risks,
    Recommended Changes. Mark G.3 COMPLETE in milestone sequence (decision
    documented; no code change needed), including top-level Current Status
    table.
    
    No production code changes. Runtime verification blocked: no AOO build
    tree available.
---
 odf_docs/openformula-milestone-g-sequence.md       | 22 ++++++++-------
 odf_docs/openformula-small-group-semantic-audit.md | 33 +++++++++++++++-------
 2 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/odf_docs/openformula-milestone-g-sequence.md 
b/odf_docs/openformula-milestone-g-sequence.md
index 25fdecbe30..5b0c5e97a0 100644
--- a/odf_docs/openformula-milestone-g-sequence.md
+++ b/odf_docs/openformula-milestone-g-sequence.md
@@ -11,7 +11,7 @@
 |---|---|---|---|
 | G.1 | Complete | `41da3628f9` + Help topics commit | STRING_MAXLEN 
documented; ScDBCount empty-cell fix applied via `CountRecords()`; Help topics 
added for IFNA, SKEWP, BITAND, BITOR, BITXOR, BITLSHIFT, BITRSHIFT |
 | G.2 | Implemented (source-level) | `efd87262f2` + regression tests | 
`ScDBCount()` missing-field path uses `CountRecords()` (dociter.cxx:685-716) 
which iterates row-by-row via `IsQueryValid()`; `ScDBCount2()` same pattern; 
calcval `DB.*` regression cases added | 
-| G.3 | Pending | — | Decision record needed before any code change |
+| G.3 | Complete (decision documented) | `929fe7a9ce` | COUNTBLANK 
formula-cell `""` behavior decision: `lcl_IsCountBlankEmpty()` 
(interpr1.cxx:4745-4758) inspects formula results and treats 
formula-cell-returning-`""` as blank — implementation-defined per §6.13.8; no 
code change needed |
 | G.4 | Pending | — | Corpus regression analysis needed |
 | G.5 | Pending | — | Runtime verification only; no build available |
 | G.6 | Pending | — | Runtime verification only; no build available |
@@ -65,15 +65,17 @@ The root cause is confirmed: `ScQueryCellIterator` ("run 
through all not empty c
 
 ## Phase G.3 — Medium-Risk: COUNTA/COUNTBLANK Behavior Review
 
-These are behavior decisions, not necessarily code changes. ODF 1.4 permits 
implementation-defined behavior for formula cells returning `""`.
+**STATUS: COMPLETE (decision documented; no code change needed)**
 
-| Order | Gap ID | Area | Decision Point | Action If Change Needed | Risk |
+ODF 1.4 §6.13.8 makes formula-cell-returning-`""` blank-counting 
implementation-defined. AOO already exercises this choice via 
`lcl_IsCountBlankEmpty()` (interpr1.cxx:4745-4758) which inspects formula 
results and treats formula-cell-returning-`""` as blank for COUNTBLANK. ISBLANK 
(§6.13.14) returns FALSE for empty string — no conflict since COUNTBLANK's 
behavior is explicitly implementation-defined.
+
+| Order | Gap ID | Area | Decision Point | Decision | Risk |
 |---|---|---|---|---|---|
-| G.3.1 | F-GAP-001 | COUNTA matrix | Confirm matrix empty-string handling is 
acceptable | None needed (ODF 1.4 silent) | Low |
-| G.3.2 | F-GAP-002 | COUNTBLANK formula-cell `""` | Decide whether to inspect 
formula result for `""` | Modify `ScCountEmptyCells()` cell-type check to also 
check formula result | Medium — behavior change; document as compatibility 
option |
+| G.3.1 | F-GAP-001 | COUNTA matrix | Confirm matrix empty-string handling is 
acceptable | ODF 1.4 silent; AOO counts all matrix elements including strings — 
acceptable | Low |
+| G.3.2 | F-GAP-002 | COUNTBLANK formula-cell `""` | Decide whether to inspect 
formula result for `""` | Decision: inspect formula result; treat 
formula-cell-returning-`""` as blank. Already implemented via 
`lcl_IsCountBlankEmpty()`; no code change needed | Low — no behavior change; 
decision documents existing implementation |
 
-**Dependencies:** G.2.1 (empty-cell iteration patterns shared).  
-**Runtime validation needed:** Yes — COUNTBLANK with formula cells returning 
`""`.
+**Dependencies:** None (implementation already in place).
+**Runtime validation needed:** Yes — COUNTBLANK with formula cells returning 
`""`. **Blocked:** No AOO build tree available; calcval cannot run. Existing 
test case `COUNTBLANK.emptystr` (calcval-cases14.tsv:164) covers this.
 
 ## Phase G.4 — Medium-Risk: INDEX Row-Vector Compatibility
 
@@ -117,7 +119,7 @@ No code changes expected (no hard limits found). 
Verification only.
 ```
 G.1 (docs, COMPLETE) ──┐
                         ├── G.2 (ScDBCount empty-cell, IMPLEMENTED 
source-level) ──┐
-G.5 (limits verification) ──┤                                                  
      ├── G.3 (COUNTBLANK decision)
+G.5 (limits verification) ──┤                                                  
      ├── G.3 (COUNTBLANK decision, COMPLETE)
 G.6 (syntax verification) ──┤                                                  
      │
 G.4 (INDEX compatibility) ──┘                                                  
      └── (runtime-validated)
 ```
@@ -128,7 +130,7 @@ G.4 (INDEX compatibility) ──┘
 |---|---|---|---|
 | G.1 (docs) | Trivial | No code changes | Complete |
 | G.2 (ScDBCount) | Low | Fix applied via `CountRecords()`; regression tests 
added; runtime verification blocked | Implemented (source-level) |
-| G.3 (COUNTBLANK) | Medium | Behavior decision; may need compatibility option 
| Pending decision record |
+| G.3 (COUNTBLANK) | Low | Decision documented; implementation already in 
place via `lcl_IsCountBlankEmpty()` | Complete (decision documented) |
 | G.4 (INDEX compat) | Medium | Corpus regression analysis needed | Pending |
 | G.5/G.6 (verification) | Low | Test execution only; no code changes | 
Pending build |
 
@@ -138,7 +140,7 @@ G.4 (INDEX compatibility) ──┘
 - G.1 Help topics: IFNA, SKEWP, BITAND, BITOR, BITXOR, BITLSHIFT, BITRSHIFT — 
all HID_FUNC_* IDs resolve to topics, discoverable via Help index/search
 - G.2 ScDBCount/DCOUNTA empty-cell fix implemented at source level: 
`CountRecords()` in `dociter.cxx:685-716`, used by `ScDBCount()` at 
`interpr1.cxx:6879-6882` and `ScDBCount2()` at `interpr1.cxx:6913-6917`; 
calcval `DB.*` regression cases added to `calcval-cases14.tsv` 
(DB.DCOUNT.f.zero, DB.DCOUNT.nf.zero, DB.DCOUNTA.f.zero)
 - G.2 runtime verification: blocked — no AOO build tree available; calcval 
cannot run
-- G.3 COUNTBLANK behavior: decision record required before any code change
+- G.3 COUNTBLANK behavior: decision documented — `lcl_IsCountBlankEmpty()` 
(interpr1.cxx:4745-4758) inspects formula results and treats 
formula-cell-returning-`""` as blank for COUNTBLANK (implementation-defined per 
§6.13.8); ISBLANK (§6.13.14) returns FALSE for empty string — no conflict. No 
code change needed.
 - G.4 INDEX compatibility: corpus regression analysis required before 
compatibility option
 - G.5/G.6 all runtime tests: prepared, awaiting build environment
 - No production changes without corresponding calcval test coverage
diff --git a/odf_docs/openformula-small-group-semantic-audit.md 
b/odf_docs/openformula-small-group-semantic-audit.md
index 662960a6e4..463c9f7a51 100644
--- a/odf_docs/openformula-small-group-semantic-audit.md
+++ b/odf_docs/openformula-small-group-semantic-audit.md
@@ -43,12 +43,16 @@ OASIS Open Document Format for Office Applications 
(OpenDocument) Version 1.4, P
 ### Execution Path — COUNTBLANK
 
 `ScCountEmptyCells()`:
-
 | Stack Type | Code Path | Behavior |
 |---|---|---|
-| `svSingleRef` | interpr1.cxx:4723-4731 | `eCellType != CELLTYPE_NONE && 
eCellType != CELLTYPE_NOTE` → nCount=1 (not blank), else blank |
-| `svDoubleRef` / `svRefList` | interpr1.cxx:4733-4757 | `ScCellIterator`; 
same cell-type check; result = `nMaxCount - nCount` |
-| `default` | interpr1.cxx:4760 | `SetError(errIllegalParameter)` — scalar 
args not supported |
+| `svSingleRef` | interpr1.cxx:4768-4775 | 
`lcl_IsCountBlankEmpty(GetCell(aAdr))` — cell-type + formula-result check |
+| `svDoubleRef` / `svRefList` | interpr1.cxx:4777-4801 | `ScCellIterator` over 
range; `lcl_IsCountBlankEmpty(pCell)` per cell; result = `nMaxCount - nCount` |
+| `default` | interpr1.cxx:4803 | `SetError(errIllegalParameter)` — scalar 
args not supported (COUNTBLANK takes ReferenceList per §6.13.8) |
+
+`lcl_IsCountBlankEmpty()` (interpr1.cxx:4745-4758):
+- `CELLTYPE_NONE` / `CELLTYPE_NOTE` / NULL pointer → returns true (blank)
+- Non-FORMULA cell types → returns false (not blank)
+- `CELLTYPE_FORMULA`: if error code or IsValue() → returns false (not blank); 
otherwise checks `GetString().Len() == 0` — formula cell returning `""` counts 
as blank
 
 ### Current Behavior vs ODF 1.4
 
@@ -58,25 +62,34 @@ OASIS Open Document Format for Office Applications 
(OpenDocument) Version 1.4, P
 | Cell with text | COUNTA: counted; COUNTBLANK: not blank | CELLTYPE_STRING → 
counted/not blank | Yes |
 | Cell with number | COUNTA: counted; COUNTBLANK: not blank | CELLTYPE_VALUE → 
counted/not blank | Yes |
 | Scalar `""` argument | COUNTA: counted (not blank) | svString → counted | 
Yes |
-| Formula cell returning `""` | COUNTBLANK: implementation-defined whether 
blank | CELLTYPE_FORMULA ≠ CELLTYPE_NONE → counted by COUNTA, NOT blank by 
COUNTBLANK; formula result not inspected | Implementation-defined; AOO does not 
check formula result |
+| Formula cell returning `""` | COUNTBLANK: implementation-defined whether 
blank | CELLTYPE_FORMULA, formula result `""` → blank by COUNTBLANK (via 
`lcl_IsCountBlankEmpty` inspecting formula result) | Yes 
(implementation-defined choice exercised) |
+| Formula cell returning non-empty text | Not blank | CELLTYPE_FORMULA, 
formula result non-empty → not blank | Yes |
+| Numeric zero (0) | COUNTBLANK: not blank | CELLTYPE_VALUE → not blank | Yes |
+| Logical value | Not blank | CELLTYPE_VALUE → not blank | Yes |
+| Error cell | COUNTBLANK: does not propagate errors; returns FALSE for error 
cases | CELLTYPE_FORMULA with error → not blank | Yes |
+| Scalar `""` to COUNTBLANK | Not applicable (COUNTBLANK takes ReferenceList 
only) | `SetError(errIllegalParameter)` — only reference types accepted | N/A |
 | Matrix with empty-string cells | COUNTA: not specified explicitly | `nCount 
+= nC * nR` counts all elements including strings | Counts empty-string cells 
as non-empty |
-| Scalar `""` to COUNTBLANK | Not applicable (COUNTBLANK takes ranges) | 
`SetError(errIllegalParameter)` — only reference types accepted | N/A |
+| Empty reference/range with mixture | Per-cell evaluation | 
`lcl_IsCountBlankEmpty` per cell via `ScCellIterator` | Yes |
 
 ### Conformance Classification
 
 - **COUNTA scalar `""`**: Required by ODF 1.4 — matches (empty string counted 
as non-blank).
 - **COUNTA empty cells**: Required by ODF 1.4 — matches (CELLTYPE_NONE not 
counted).
 - **COUNTBLANK truly empty cells**: Required by ODF 1.4 — matches.
-- **COUNTBLANK formula cell returning `""`**: Implementation-defined (§6.13.8) 
— AOO uses cell-type-only check; does not inspect formula result.
+- **COUNTBLANK formula cell returning `""`**: Implementation-defined (§6.13.8) 
— AOO treats formula cell returning `""` as blank (via `lcl_IsCountBlankEmpty` 
inspecting formula result at interpr1.cxx:4752-4757). This is an 
implementation-defined choice permitted by the standard; not a conformance 
defect.
+- **COUNTBLANK numeric zero**: Required not blank (§6.13.8) — matches.
+- **COUNTBLANK error cell**: Not propagated (§6.13.8 / ISBLANK §6.13.14) — 
matches.
+- **COUNTBLANK scalar argument**: Only ReferenceList accepted (§6.13.8) — 
`errIllegalParameter` for non-reference args, matches.
 - **COUNTA matrix with strings**: ODF 1.4 does not explicitly address matrix 
empty-string handling — AOO counts all matrix elements including strings.
 
 ### Known Compatibility Risks
 
-- Changing COUNTBLANK to inspect formula results (treating `""`-returning 
formulas as blank) would be a behavior change affecting existing documents.
+- Changing COUNTBLANK to NOT inspect formula results (treating `""`-returning 
formulas as non-blank) would be a behavior change affecting existing documents 
and would diverge from other major spreadsheet applications.
+- AOO's choice to treat formula-cell-returning-`""` as blank is 
implementation-defined per §6.13.8 and consistent with ISBLANK returning FALSE 
for such cells (§6.13.14: "A cell with the empty string is not considered 
blank").
 
 ### Recommended Implementation Changes
 
-None required for ODF 1.4 conformance (implementation-defined behavior is 
permitted). If a compatibility option is desired, document the current 
cell-type-only behavior and consider adding formula-result inspection as an 
option.
+None required for ODF 1.4 conformance. The implementation-defined behavior for 
formula-cell-returning-`""` is exercised (treated as blank). No production code 
changes needed; runtime verification pending (no AOO build tree available).
 
 ### Suggested Regression Tests
 
@@ -294,7 +307,7 @@ None required. The ScDBCount empty-cell fix (F-GAP-004) is 
implemented at source
 |---|---|---|
 | Basic Limits (§3.7) | 4 | Unverifiable statically; no hard limits found |
 | Syntax (§5) | 11 | Implementation present; runtime-unverified |
-| COUNTA/COUNTBLANK (§6.13.7-8) | 2 | Partially matches; formula-cell `""` is 
implementation-defined |
+| COUNTA/COUNTBLANK (§6.13.7-8) | 2 | Fully matches; formula-cell `""` treated 
as blank per implementation-defined choice (§6.13.8) |
 | INDEX (§6.14.6) | 1 | ODF 1.4 compliant after Milestone A; regression risk |
 | Criteria Syntax (§4.11.11) | 1 | Implemented; ScDBCount empty-cell fix 
applied (source-level; runtime-unverified) |
 | Operators (§6.4) | 14 | Implementation present; runtime-unverified |

Reply via email to