سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 08:00 UTC
test(real-stack): await committed legacy audit evidence; record unresolved treasury Quality failure
davoodmehraban89 committed
Oct 18, 2026 at 22:38 UTC
96b31f7396858743a64732f1ee6e69180911c07e
2 files changed
+14
-1
PROJECT_STATE.md
+5
@@ -169,3 +169,8 @@
169
- **HARNESS separately**: Run 39155696761 Job 117758346678 PASS; real-stack does not replace its local SQL/Chromium tests. Stage2.1 canaries 39155696783 PASS, Security 39155701082 PASS (Dependency Review skipped by configuration).
170
- Quality Run 39155701055 **FAIL** DOM test at `scripts/accounting-document-workflow.spec.js:633` (three DB jobs green). Fixture's amend-failure target mistakenly used existing-payment expected_version>0, whereas `js/payments.js:85–96` creates a NEW correction payment carrying `correctsPaymentId`. The isolated test injector is corrected to target that field without waiving checks. **Re-run Quality must pass before approval.**
171
- PR #162 still Draft [DO NOT MERGE]. Stage 2.2 not accepted by owner. No Production write/enforce, no main merge, no Phase 1B, no Stage 2.3 and no login-resilience work.
172
+
173
+
174
+### 2026-10-18 — Stage 2.2 acceptance HOLD: quality regression not waived
175
+- HEAD bbd616cecfbba56be6126266d01fc573e7f5789f Quality Run 39157016150 Job 117762212839 Step 54 **FAILED**: 122/123 DOM cases pass; `accounting-document-workflow.spec.js:637` treasury correction test still never sees its required rejection alert, even after a strict 25s wait that exceeds the 20s `invoicePilotAwaitSync` bound (`js/invoices.js:453–462`). Targeted RPC fault was independently proved consumed once in Run 39156589781 raw trace; **not safe to mark Quality green**. Treasury correction is OUTSIDE authorized Stage 2.2 and must not be changed to manufacture green.
176
+- Transient real-stack Run 39157013205 failed a timing read of the *append-only audit row* immediately after legacy audit sync. Test-only fix awaits actual database row for at most 12s, still fails if absent; a fresh real-stack Run is required. Prior independent real-stack Run 39156095490 Job 117759513522 Step 8 PASS with JWT/Auth/PostgREST, both REST attacks, single posted number and audit evidence (artifact 12147152448). Harness Run 39157013199 PASS, Security 39157016176 PASS. No owner acceptance yet.
scripts/stage22-real-stack.mjs
+9
-1
@@ -178,7 +178,15 @@ try{
178
await runSync();return {number:v.number,status:v.status};
179
});
180
if(!legacy.number||legacy.status!=='draft')throw Error('LEGACY_AUDIT_NOT_LEGACY');
181
- const violations=Number(db("SELECT count(*) FROM private.finora_phase1a_journal_audit WHERE organization_id="+quote(org)+"::uuid AND action='guard_violation'"));
181
+ // runSync() can coalesce with an already-in-flight sync. An audit row is
182
+ // asserted from real PostgreSQL, with a bounded wait for its actual commit.
183
+ let violations=0;
184
+ const auditDeadline=Date.now()+12000;
185
+ while(Date.now()<auditDeadline){
186
+ violations=Number(db("SELECT count(*) FROM private.finora_phase1a_journal_audit WHERE organization_id="+quote(org)+"::uuid AND action='guard_violation'"));
187
+ if(violations>0)break;
188
+ await new Promise(resolve=>setTimeout(resolve,300));
189
+ }
190
if(violations<1)throw Error('AUDIT_MODE_NO_VIOLATION_RECORDED');
191
evidence.scenarios.push('legacy-numbered-draft-audit-with-violation-row');
192
if(remote.length)throw Error('PRODUCTION_NETWORK_ATTEMPT');