From ae7fdb59dd41e1c069164e2ee2547082b3be1cbf Mon Sep 17 00:00:00 2001 From: Dennis Decoene Date: Sun, 12 Jul 2026 17:14:36 +0200 Subject: [PATCH 1/2] fix: memory-variable GET prefills from its current value again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit doAtSayGet's variable-fallback branch (introduced by #59's field- binding rewrite) hardcoded value: '' instead of reading this.vars.get(varName), so every GET on a variable that already held a value (a STORE'd default, or a resubmitted form) showed blank. Silently broke every demo that pre-fills a form default: overtime.prg (m_week defaults to today's date in two menus, m_date in Register Leave Taken), INVENTORY.prg (m_stock/m_reord/m_price/m_qty default to 0/0.00 in three menus), crm.prg (m_val defaults to 0.00 in Add Deal). No test caught it because every existing var-GET test used a variable with no prior value, where '' is the correct answer either way — the untested surface was re-display of an existing value, not first display of a blank one. --- src/interpreter/Executor.ts | 5 ++++- tests/FormFieldBinding.test.ts | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/interpreter/Executor.ts b/src/interpreter/Executor.ts index f15283a..a261fb3 100644 --- a/src/interpreter/Executor.ts +++ b/src/interpreter/Executor.ts @@ -588,7 +588,10 @@ export class Executor implements IndexCommandsHost { return { output: out }; } } - this.pendingForm.push({ row, col, label: text, varName, target: { kind: 'var' }, value: '' }); + this.pendingForm.push({ + row, col, label: text, varName, target: { kind: 'var' }, + value: String(this.vars.get(varName) ?? ''), + }); return { output: out }; } diff --git a/tests/FormFieldBinding.test.ts b/tests/FormFieldBinding.test.ts index dfdea37..f186e3e 100644 --- a/tests/FormFieldBinding.test.ts +++ b/tests/FormFieldBinding.test.ts @@ -77,6 +77,16 @@ describe('field-bound @ SAY GET', () => { expect(form.fields[0].value).toBe(''); }); + it('a variable GET prefills from the variable\'s current value, not blank', async () => { + const { session, sent, run } = await setup(); + await run('APPEND RECORD'); + await run('STORE "2026-07-06" TO M_WEEK'); + await runBlock(session, sent, '@ 4, 5 SAY "Week: " GET M_WEEK\nREAD'); + const form = sent.find(m => m.type === 'form-open') as any; + expect(form.fields[0].target.kind).toBe('var'); + expect(form.fields[0].value).toBe('2026-07-06'); + }); + it('is a variable GET when no table is in use', async () => { const sent: ServerMessage[] = []; const session = new Session((m) => sent.push(m)); From 1f17838a6603d72d20578e809820da2c8bc1225e Mon Sep 17 00:00:00 2001 From: Dennis Decoene Date: Sun, 12 Jul 2026 17:15:54 +0200 Subject: [PATCH 2/2] docs: add Fixed section for the memvar-GET regression --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30a38ca..f12b677 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,17 @@ Versions follow [Semantic Versioning](https://semver.org/) — minor bump per su BROWSE/REPLACE enforcement, field-bound forms, two demo apps, and the GUI wizards all now agree on one constraint, declared once, on the column. +### Fixed +- A memory-variable `@ SAY GET` no longer shows blank when the variable already holds a + value. Field-binding (#59) rewrote the non-field fallback path to hardcode an empty + prefill instead of reading the variable's current value, silently breaking every demo + form that pre-fills a default via `STORE`: `overtime.prg`'s Week Monday date (Open/Prep + Week, Recalculate Week) and leave date (Register Leave Taken), `INVENTORY.prg`'s stock/ + reorder/price/quantity defaults (Add Product, Stock In, Stock Out), and `crm.prg`'s deal + value default (Add Deal). Found by exercising the running app, not by the test suite — + every existing test for this path used a variable with no prior value, where an empty + prefill happens to be correct either way. + ## [1.2.0] — 2026-07-09 — TIME columns, WEEK()/DATEADD(), BROWSE cell validation, Overtime demo ### Added