fix(adi): tag ordinals follow creation order, as CDX does - #148
Closed
russimicro wants to merge 1 commit into
Closed
fix(adi): tag ordinals follow creation order, as CDX does#148russimicro wants to merge 1 commit into
russimicro wants to merge 1 commit into
Conversation
add_tag prepended its tag-directory entry, so ordinals came out reversed: after creating TCODIGO, TNOMBRE, TGRUPO the bag reported TGRUPO as ordinal 1. An application that navigates orders by NUMBER -- OrdSetFocus(n) / OrdName(n), which is what a browse doing click-to-sort on a column does -- then activates the wrong order, and it cannot compensate without knowing in advance how many tags the bag will end up holding. The same application over a .CDX bag gets creation order. Append instead. Reading is unaffected (the directory is scanned in file order either way), so a bag written before this change keeps its old ordinals until it is rebuilt. The existing wide-page test deliberately avoids asserting ordinals; the new test pins them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
FiveTechSoft
added a commit
that referenced
this pull request
Jul 30, 2026
Cherry-picked and conflict-resolved against main (post CI fix 54e977c): - #150 fix(sql): ORDER BY cursor keeps source column types - #148 fix(adi): tag ordinals follow creation order - #152 fix(adt): non-.adt extension (.DAT) works end to end - #151 fix(session): create honours absolute path with existing parent (+ #include <vector> so the new unit test builds under clang) - #154 fix(engine): partial SEEK keeps Found() with SET DELETED ON - #155 fix(engine): ordScope bound shorter than key is a prefix - #153 perf(engine): live key count without per-row goto + recno order Also includes the CMakeLists resolution that keeps every new regression case in the unit-test target.
Owner
|
Integrated into main as part of the PR stack merge (9e7ac41). Cherry-picked onto post-CI-fix main, conflict-resolved (CHANGELOG / CMakeLists), and verified locally. Thank you @russimicro. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported from a Harbour/FiveWin ERP migrating a company from DBFCDX to ADT.
Problem
AdiIndex::add_tagprepends its tag-directory entry, so tag ordinals comeout reversed. Creating TCODIGO, TNOMBRE, TGRUPO in that order leaves TGRUPO as
ordinal 1.
An xBase application navigates orders by number as much as by name —
OrdSetFocus(n),OrdName(n),DBSETORDER(n)— and a browse that sorts on acolumn click resolves the column to a tag number. With reversed ordinals it
activates the wrong order, and it cannot compensate: the mapping depends on how
many tags the bag ends up holding, which the caller does not know while it is
still creating them. Over a
.CDXbag the same code gets creation order.Change
Append the entry instead of prepending it. One block in
add_tag.Reading is unaffected —
scan_tagdirwalks the directory in file order eitherway — so a bag written before this change keeps its current ordinals until it is
rebuilt.
Note on the existing test
abi_adi_tagdir_wide_page_test.cppdeliberately avoids asserting ordinals("tag ordinals depend on whether the bag prepends or appends its directory
entries") and activates tags by handle. It keeps passing. The new test pins the
ordering that this PR establishes.
Verification
tests/unit/abi_adi_tagdir_order_test.cpp— creates three tags in a knownorder, closes, reopens, and checks
list_tagsreports them in creation order.Fails before the change (reads
{CGRUPO, CNOMBRE, CCODIGO}), passes after.Full suite on this branch (MSVC x64 Release): 1228/1235. The 7 failures are
pre-existing on
mainand unrelated — 6 ×abi_pritpal_lock_test(remoteconnect, the residual noted in the v1.8.37 release) and one
abi_oads_file_funcs_testteardown that threw onremove_allbecause thetemp directory was held by another process on this machine.