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 ac2d06a54ae95fc1b833a49d4faf6c893071b9f2
Author: Pedro Giffuni <[email protected]>
AuthorDate: Sat Nov 14 11:53:48 2026 -0500

    docs: G.4 INDEX row-vector compatibility audit
    
    Audit INDEX row-vector compatibility: ODF 1.4 §6.14.6 removed the ODF 
1.2/1.3
    row-vector shortcut (Row acts as column offset on single-row range).
    Milestone A (bb58e28fc2) removed bRowArray but commit 8f3b3b25a2 restored 
it.
    Current ScIndex() (interpr1.cxx:7588-7612) keeps bRowArray so INDEX(H1:L1;3)
    returns column value instead of ODF 1.4 Error — documented legacy-compatible
    deviation, not ODF 1.4 compliant.
    
    ODF version comparison: ODF 1.2/1.3 had row-vector shortcut; ODF 1.4 removed
    it (OFFICE-4144). Test INDEX.row.rowonly expects #ERR but implementation
    returns 30 — mismatch disclosed.
    
    Correct semantic audit INDEX section (falsely claimed Milestone A fix 
applied).
    Fix gaps TSV F-GAP-001/F-GAP-002 to reflect G.3 COUNTBLANK source audit
    (lcl_IsCountBlankEmpty inspects formula results). Fix Definition of Done
    wording to distinguish implemented requirements from documented deviations
    and pending runtime verification.
    
    No production code changes. Runtime verification blocked: no AOO build tree
    available.
---
 odf_docs/openformula-milestone-g-sequence.md       | 21 +++++----
 odf_docs/openformula-small-group-semantic-audit.md | 54 ++++++++++++++--------
 odf_docs/openformula-small-group-semantic-gaps.tsv |  4 +-
 3 files changed, 49 insertions(+), 30 deletions(-)

diff --git a/odf_docs/openformula-milestone-g-sequence.md 
b/odf_docs/openformula-milestone-g-sequence.md
index 5b0c5e97a0..5795bdb444 100644
--- a/odf_docs/openformula-milestone-g-sequence.md
+++ b/odf_docs/openformula-milestone-g-sequence.md
@@ -12,7 +12,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 | 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.4 | Compatibility audit complete (decision documented) | — | `bRowArray` 
shortcut present in `ScIndex()` (interpr1.cxx:7588-7612); `INDEX(H1:L1;3)` 
returns column value instead of ODF 1.4 Error; kept as legacy-compatible 
deviation |
 | G.5 | Pending | — | Runtime verification only; no build available |
 | G.6 | Pending | — | Runtime verification only; no build available |
 
@@ -79,14 +79,16 @@ ODF 1.4 §6.13.8 makes formula-cell-returning-`""` 
blank-counting implementation
 
 ## Phase G.4 — Medium-Risk: INDEX Row-Vector Compatibility
 
-No code change needed for ODF 1.4 conformance (Milestone A already fixed). 
Compatibility option is optional.
+**STATUS: COMPATIBILITY AUDIT COMPLETE (no code change)**
 
-| Order | Gap ID | Area | Decision Point | Action If Needed | Risk |
+ODF 1.4 §6.14.6 removed the ODF 1.2/1.3 row-vector shortcut where 
`INDEX(rowvector; n)` treated Row as a column offset. Milestone A (bb58e28fc2) 
removed the `bRowArray` shortcut, but it was restored by commit 8f3b3b25a2 
("INDEX on a row vector keeps the Excel rule, a documented deviation"). Current 
`ScIndex()` (interpr1.cxx:7588-7612) still has `bRowArray`, so `INDEX(H1:L1;3)` 
returns column 3 (value 30) — ODF 1.3/Excel compatible, NOT ODF 1.4 compliant.
+
+| Order | Gap ID | Area | Decision Point | Decision | Risk |
 |---|---|---|---|---|---|
-| G.4.1 | F-GAP-003 | INDEX row-vector | Assess legacy document regression 
from Milestone A fix | Add document-compatibility option if corpus testing 
shows impact | Medium — affects existing documents |
+| G.4.1 | F-GAP-003 | INDEX row-vector | Keep bRowArray (legacy compatible) or 
remove (ODF 1.4 compliant) | Keep bRowArray for now; document as known ODF 1.4 
deviation. Consider compatibility option if corpus testing shows legacy 
document impact. | Medium — affects existing documents; ODF 1.4 non-conformance 
|
 
-**Dependencies:** None (Milestone A already applied).  
-**Runtime validation needed:** Yes — corpus regression test against existing 
documents.
+**Dependencies:** None.
+**Runtime validation needed:** Yes — corpus regression test against existing 
documents to assess legacy document impact. **Blocked:** No AOO build tree 
available; calcval cannot run. Existing test case `INDEX.row.rowonly` 
(calcval-cases14.tsv:39) expects `#ERR` (ODF 1.4) but current implementation 
returns `30` — test/implementation mismatch noted.
 
 ## Phase G.5 — Low-Risk: Basic Limits Runtime Verification
 
@@ -123,6 +125,7 @@ G.5 (limits verification) ──┤
 G.6 (syntax verification) ──┤                                                  
      │
 G.4 (INDEX compatibility) ──┘                                                  
      └── (runtime-validated)
 ```
+G.4 compatibility audit: `bRowArray` shortcut present 
(interpr1.cxx:7588-7612); `INDEX(H1:L1;3)` returns column value instead of ODF 
1.4 Error. Kept as documented deviation; removal would break legacy ODF 1.3 
documents.
 
 ## Estimated Implementation Complexity
 
@@ -131,7 +134,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) | Low | Decision documented; implementation already in 
place via `lcl_IsCountBlankEmpty()` | Complete (decision documented) |
-| G.4 (INDEX compat) | Medium | Corpus regression analysis needed | Pending |
+| G.4 (INDEX compat) | Medium | Compatibility audit complete; `bRowArray` 
shortcut present; ODF 1.4 deviation documented | Compatibility audit complete 
(decision documented) |
 | G.5/G.6 (verification) | Low | Test execution only; no code changes | 
Pending build |
 
 ## Definition of Done for Milestone G
@@ -141,10 +144,10 @@ G.4 (INDEX compatibility) ──┘
 - 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 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.4 INDEX compatibility: compatibility audit complete — `bRowArray` shortcut 
present in `ScIndex()` (interpr1.cxx:7588-7612); `INDEX(H1:L1;3)` returns 
column value instead of ODF 1.4 Error; kept as documented legacy-compatible 
deviation |
 - G.5/G.6 all runtime tests: prepared, awaiting build environment
 - No production changes without corresponding calcval test coverage
-- All changes verified against ODF 1.4 normative expected results
+- All G.1-G.3 requirements verified at source level against ODF 1.4 normative 
text; G.4 INDEX documented as known deviation (bRowArray shortcut, not ODF 1.4 
compliant); runtime verification for G.5/G.6 pending build environment
 
 ## Deferred Items (Post-G)
 
diff --git a/odf_docs/openformula-small-group-semantic-audit.md 
b/odf_docs/openformula-small-group-semantic-audit.md
index 463c9f7a51..6a8f5d1cbc 100644
--- a/odf_docs/openformula-small-group-semantic-audit.md
+++ b/odf_docs/openformula-small-group-semantic-audit.md
@@ -103,11 +103,23 @@ None required for ODF 1.4 conformance. The 
implementation-defined behavior for f
 
 ### Normative Requirement
 
-ODF 1.4 §6.14.6: `INDEX` with a single row argument on a single-row range (row 
vector) returns an error. The ODF 1.3 rule allowing the Row argument to act as 
a column offset for row vectors was removed.
+**ODF 1.4 §6.14.6:** `INDEX( ReferenceList|Array DataSource ; [ Integer Row ] 
[ ; [ Integer Column ] ] [ ; Integer AreaNumber = 1 ] )`. Row and Column are 
1-based, relative to the top-left of DataSource. If Row is omitted/empty/0, an 
entire column is returned. If Column is omitted/empty/0, an entire row is 
returned. If Row or Column exceeds the dimension of the area, an Error is 
returned. There is NO special row-vector shortcut: `INDEX(H1:L1;3)` (Row=3 on a 
1-row range) returns an Error.
+
+**ODF 1.2 (§6.14.6):** Had an explicit row-vector shortcut: "If DataSource is 
a one-dimensional row vector, Row is optional, which effectively makes Row act 
as the column offset into the vector." This text was deleted in ODF 1.4 (OASIS 
issue OFFICE-4144, fixed in ODF 1.4).
+
+**ODF 1.3 (§6.14.6):** "If DataSource is a one-dimensional row vector, Row is 
optional, which effectively makes Row act as the column offset into the 
vector." Retained the ODF 1.2 row-vector shortcut. Confirmed via direct ODF 1.3 
spec text.
+
+**Version comparison:**
+
+| Specification | Relevant rule | `INDEX(H1:L1;3)` interpretation | Evidence |
+|---|---|---|---|
+| ODF 1.2 | Row acts as column offset on single-row range | Returns column 3 
(value 30) | OFFICE-4144 "Delete" text (ODF 1.2 §6.14.6) |
+| ODF 1.3 | "If DataSource is a one-dimensional row vector, Row is optional, 
which effectively makes Row act as the column offset into the vector" | Returns 
column 3 (value 30) | ODF 1.3 §6.14.6 (§6.14.6 INDEX, part 4-formula) |
+| ODF 1.4 | Row and Column both 1-based; Row > dimension → Error | Error 
(Row=3 > 1 row dimension) | ODF 1.4 §6.14.6 (lines 7637-7639 of spec) |
 
 ### AOO Implementation Location
 
-- `ScIndex()` — `main/sc/source/core/tool/interpr1.cxx:7419`
+- `ScIndex()` — `main/sc/source/core/tool/interpr1.cxx:7448`
 - Dispatch: `interpr4.cxx:3650` (ocIndex → ScIndex)
 - Declaration: `main/sc/source/core/inc/interpre.hxx:564`
 - Parameter class: `main/sc/source/core/tool/parclass.cxx:123` (`ocIndex: {{ 
Reference, Value, Value, Value }, 0}`)
@@ -129,38 +141,42 @@ Then `switch(GetStackType())`:
 | `svSingleRef` | `if (nCol > 1 || nRow > 1) PushIllegalArgument();` — single 
cell, only row/col 0 or 1 valid |
 | `svDoubleRef` / `svRefList` | Full range bounds checking; returns 
sub-reference or single cell |
 
-### Before and After Milestone A (commit bb58e28fc2)
+### Historical Implementation — bRowArray Shortcut
 
-**Before Milestone A:** A `bRowArray` flag was set when `nParamCount == 2 && 
nRow1 == nRow2` (single-row range with row argument). This caused:
-- Row bounds check to be skipped: `(nRow > 0 && nRow1+nRow-1 > nRow2 && 
!bRowArray)`
-- Alternative row bounds: `(nRow > nCol2 - nCol1 + 1 && bRowArray)` — checked 
against column width
-- Row argument reinterpreted as column: `nCol = (SCCOL) nRow; nRow = 1;`
+**Milestone A** (commit bb58e28fc2): Removed the `bRowArray` shortcut from 
`ScIndex()`, making `INDEX(H1:L1;3)` return an error per ODF 1.4.
 
-Effect: `INDEX(H1:L1;3)` returned the 3rd column (value 30) instead of an 
error.
+**Undo** (commit 8f3b3b25a2): Restored the `bRowArray` shortcut, with commit 
message "INDEX on a row vector keeps the Excel rule, a documented deviation."
 
-**After Milestone A:** All `bRowArray` logic removed. `INDEX(H1:L1;3)` now:
-- nCol=0, nRow=3
-- svDoubleRef path: `(nRow > 0 && nRow1+nRow-1 > nRow2)` → `(3 > 0 && 1+3-1 > 
1)` → true → `PushIllegalArgument()` → error
+**Current state:** `bRowArray` IS present in 
`main/sc/source/core/tool/interpr1.cxx:7588-7612`. When `nParamCount == 2 && 
nRow1 == nRow2` (single-row range with row argument):
+- Row bounds check is skipped: `(nRow > 0 && nRow1+nRow-1 > nRow2 && 
!bRowArray)`
+- Alternative row bounds: `(nRow > nCol2 - nCol1 + 1 && bRowArray)` — checked 
against column width
+- Row argument reinterpreted as column: `nCol = (SCCOL) nRow; nRow = 1;`
 
-This matches ODF 1.4 §6.14.6.
+Effect: `INDEX(H1:L1;3)` returns the 3rd column (value 30) — ODF 1.3/Excel 
compatible, NOT ODF 1.4 compliant.
 
 ### Conformance Classification
 
-**Required by ODF 1.4** — Fixed in Milestone A. `INDEX(H1:L1;3)` returns error 
as required.
+**Required by ODF 1.4** — NOT currently conformant. `bRowArray` shortcut was 
removed in Milestone A (bb58e28fc2) but restored in the undo commit 
(8f3b3b25a2). `INDEX(H1:L1;3)` returns a value (30) instead of an Error as 
required by ODF 1.4 §6.14.6.
 
 ### Known Compatibility Risks
 
-- Legacy ODF 1.3 documents relying on `INDEX(rowvector; n)` returning column n 
will now get an error. Regression risk for document compatibility.
-- Compatibility handling can be isolated: the fix is localized to `ScIndex()`; 
no other code paths depend on `bRowArray`.
+- **ODF 1.4 non-conformance:** `INDEX(H1:L1;3)` returns column 3 value instead 
of Error.
+- **Legacy ODF 1.3 documents:** Documents relying on `INDEX(rowvector; n)` 
returning column n will break if bRowArray is removed.
+- **Test mismatch:** calcval test `INDEX.row.rowonly` expects `#ERR` (ODF 1.4) 
but current implementation returns `30` (ODF 1.3) via bRowArray.
 
 ### Recommended Implementation Changes
 
-None needed for ODF 1.4 conformance. Consider a document-compatibility option 
if legacy document regression is observed (out of scope for this milestone).
+None for this milestone (compatibility audit only). Two options exist:
+
+1. **Remove bRowArray** — ODF 1.4 compliant, breaks legacy ODF 1.3 documents 
using `INDEX(rowvector; n)`.
+2. **Keep bRowArray** — Legacy compatible, but not ODF 1.4 conformant; 
document as a known deviation.
+
+A document-compatibility option (version-aware or import-time handling) could 
be considered if corpus testing shows significant legacy document impact. This 
is out of scope for G.4.
 
 ### Suggested Regression Tests
 
-- `INDEX(H1:L1;3)` → error (single-arg row vector)
-- `INDEX(H1:L1;;3)` → column value (column-only arg)
+- `INDEX(H1:L1;3)` → value 30 (current bRowArray behavior) / error (ODF 1.4)
+- `INDEX(H1:L1;;3)` → column value 30 (column-only arg)
 - `INDEX(D1:D5;6)` → error (row out of range)
 - `INDEX(D1:F3;2;3)` → 2D result
 
@@ -308,7 +324,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 | 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 |
+| INDEX (§6.14.6) | 1 | NOT ODF 1.4 compliant — bRowArray shortcut present 
(undone by commit 8f3b3b25a2); INDEX(H1:L1;3) returns value instead of Error |
 | Criteria Syntax (§4.11.11) | 1 | Implemented; ScDBCount empty-cell fix 
applied (source-level; runtime-unverified) |
 | Operators (§6.4) | 14 | Implementation present; runtime-unverified |
 | Functions (§2.3.2.E) | 110 | Implementation present; runtime-unverified |
diff --git a/odf_docs/openformula-small-group-semantic-gaps.tsv 
b/odf_docs/openformula-small-group-semantic-gaps.tsv
index 44ca46752c..fa76f2cb22 100644
--- a/odf_docs/openformula-small-group-semantic-gaps.tsv
+++ b/odf_docs/openformula-small-group-semantic-gaps.tsv
@@ -1,7 +1,7 @@
 GapID  ODF Clause      Requirement     AOO Implementation Location     Current 
Behavior        Classification  Severity        Proposed Next Action    Test 
Coverage Status
 F-GAP-001      §6.13.7 COUNTA counts non-empty cells; empty string "" is not 
blank     main/sc/source/core/tool/interpr1.cxx:3834 (ScCount2 via 
IterateParameters(ifCOUNT2) at :3487)  COUNTA counts scalar string args 
including ""; counts cells where eCellType != CELLTYPE_NONE && != 
CELLTYPE_NOTE; matrix case counts ALL elements including strings; formula cells 
returning "" counted as non-blank based on CELLTYPE_FORMULA (result not 
checked)     Required by ODF 1.4; implementation-defined for formula cel [...]
-F-GAP-002      §6.13.8 COUNTBLANK counts empty cells; cell returning "" 
blankness is implementation-defined    
main/sc/source/core/tool/interpr1.cxx:4714 (ScCountEmptyCells)  COUNTBLANK uses 
cell-type-only check: eCellType != CELLTYPE_NONE && != CELLTYPE_NOTE → not 
blank; truly empty CELLTYPE_NONE cells are blank; formula cells returning "" 
treated as not blank (CELLTYPE_FORMULA != CELLTYPE_NONE); scalar "" argument 
not supported (only references)    Implementation-defined (§6.13.8); differs 
from po [...]
-F-GAP-003      §6.14.6 INDEX single-argument row vector returns error (no 
row-vector shortcut) main/sc/source/core/tool/interpr1.cxx:7419 (ScIndex); 
Milestone A commit bb58e28fc2 removed bRowArray shortcut  INDEX(H1:L1;3) 
returns error (nRow > 1 on single row → PushIllegalArgument); INDEX(H1:L1;;3) 
works (column-only); INDEX on matrix/vector handled per ODF 1.4    Required by 
ODF 1.4; fixed in Milestone A; regression risk for legacy ODF 1.3 documents 
High    Regression-test against existing document [...]
+F-GAP-002      §6.13.8 COUNTBLANK counts empty cells; cell returning "" 
blankness is implementation-defined    
main/sc/source/core/tool/interpr1.cxx:4714 (ScCountEmptyCells), :4745-4758 
(lcl_IsCountBlankEmpty)      COUNTBLANK uses lcl_IsCountBlankEmpty() which 
checks cell type AND formula result: CELLTYPE_NONE/CELLTYPE_NOTE/NULL → blank; 
non-FORMULA cell types → not blank; CELLTYPE_FORMULA with error or IsValue() → 
not blank; CELLTYPE_FORMULA with GetString().Len()==0 → blank (formula cell 
returning  [...]
+F-GAP-003      §6.14.6 INDEX single-argument row vector returns error (no 
row-vector shortcut) main/sc/source/core/tool/interpr1.cxx:7448 (ScIndex); 
bRowArray shortcut PRESENT at :7588-7612 (restored by commit 8f3b3b25a2, undid 
Milestone A bb58e28fc2)    ODF 1.2 had explicit row-vector shortcut (Row acts 
as column offset); deleted in ODF 1.4 per OFFICE-4144. Current AOO code keeps 
bRowArray (ODF 1.3/Excel compatible, NOT ODF 1.4 compliant). INDEX(H1:L1;3) 
returns value 30 instead of Error. Test  [...]
 F-GAP-004      §4.11.11        Criteria syntax supported in database functions 
main/sc/source/core/tool/interpr1.cxx:6621 (GetDBParams), :6760 (DBIterator); 
:6871-6902 (ScDBCount), :6905-6935 (ScDBCount2); dociter.cxx:685-716 
(CountRecords); queryparam.cxx:106-144 (operator prefix parsing)     Criteria 
operators parsed: <>, <=, <, >=, >, =; bQueryByString via IsNumberFormat; 
bRegExp via MayBeRegExp. DBCount empty-cell limitation RESOLVED: ScDBCount 
missing-field path uses CountRecords() (dociter.cxx:685 [...]
 F-GAP-005      §4.11.11        Database criteria: text criteria, wildcards, 
empty criteria     main/sc/source/core/tool/queryparam.cxx:106-144 (operator 
parsing); interpr1.cxx:6745-6748 (bQueryByString/bRegExp)     Text criteria 
supported via bQueryByString; wildcard/RegExp via MayBeRegExp; empty criteria 
cell (svMissing) handled as missing field   Required by ODF 1.4; partially 
verified Medium  Verify wildcard and text criteria matching      calcval: no 
dedicated wildcard/empty-criteria cases — not covered
 F-GAP-006      §3.7    Formula length at least 1024 characters No explicit 
formula length limit found in main/sc or main/formula source        No 
MAXFORMULA or formula-size enforcement found; FormulaCompiler parses token 
arrays dynamically        Unverifiable (static); absence of hard limit doesn't 
prove conformance  Low     Runtime test with 1024+ char formula    calcval: 
BL-001-1024chars (1026-char expression) — UNVERIFIED

Reply via email to