fischer-agentkit/tests/unit/bitable
Chiguyong e35b2289ce
Test / backend-test (pull_request) Waiting to run Details
Test / frontend-unit (pull_request) Waiting to run Details
Test / api-e2e (pull_request) Waiting to run Details
Test / frontend-e2e (pull_request) Waiting to run Details
fix(bitable): cross-table recalc + merge_record_values + SSRF tests
Fixes 4 bugs blocking AE1 acceptance scenario (rollup returns 0):

1. Decimal not recognized as numeric: PostgreSQL JSONB returns numbers
   as Decimal; _evaluate_rollup's isinstance(v, (int,float)) missed them.
   Added _to_float() helper (also excludes bool, an int subclass).
   Applied to _evaluate_lookup for JSON serialization safety.

2. add_relation_link clobbers record values: update_record_values does
   full-replace, so setting the relation field wiped amount/etc.
   Added merge_record_values (|| operator) and switched all relation
   link mutations to use it (add + remove + reverse cleanup).

3. enqueue_recalc ON CONFLICT DO NOTHING swallowed re-enqueues: once a
   task reached 'done', the unique constraint silently dropped new
   requests for the same (record_id, field_id) — field showed stale
   data forever. Changed to ON CONFLICT DO UPDATE: reset done/error
   tasks to pending; leave pending/calculating as-is (no double-process).

4. No cross-table recalc on record update: update_record_values only
   triggered recalc on the record's own table; rollup on the target
   table never updated when source values changed. Added
   _trigger_cross_table_recalc() — finds relation fields on the
   record's table, triggers recalc on linked target records.

Tests:
- AE1 acceptance: 3 e2e tests (SUM on insert, update-triggered recalc,
  AVG aggregation) — all pass against real PG.
- Bidirectional relation deletion: verifies _cleanup_reverse_link
  removes source from target's reverse field.
- SSRF guard: 3 tests blocking loopback, private IP, non-HTTP scheme.
- Updated test_recalc_deduplication for new ON CONFLICT DO UPDATE
  semantics (returns existing task, not None).
- Fixed test_crash_recovery to use stale_threshold=0 (was always broken
  with default 600s threshold).
2026-07-06 13:29:54 +08:00
..
__init__.py feat(bitable): add bitable companion service with full P0-P2 fixes 2026-06-25 01:09:59 +08:00
conftest.py feat(bitable): add bitable companion service with full P0-P2 fixes 2026-06-25 01:09:59 +08:00
test_ae1_cross_table_recalc.py fix(bitable): cross-table recalc + merge_record_values + SSRF tests 2026-07-06 13:29:54 +08:00
test_attachment.py feat(bitable): 多维表格文件层 + 默认字段 + 表内字段操作 + ce-code-review 修复 (Stage 1) 2026-06-29 04:07:45 +08:00
test_automation.py fix(bitable): cross-table recalc + merge_record_values + SSRF tests 2026-07-06 13:29:54 +08:00
test_bitable_tool.py merge: resolve conflict with origin/main (PR #24/#25) 2026-07-06 13:04:53 +08:00
test_cli.py feat(bitable): add bitable companion service with full P0-P2 fixes 2026-06-25 01:09:59 +08:00
test_conditional_formatting.py feat(bitable): U5 R4 grouping (max 3 fields) + conditional formatting (7 operators) 2026-07-03 22:33:18 +08:00
test_db.py feat(bitable): formula relations v2 — U1-U8 + review fixes 2026-07-06 12:57:07 +08:00
test_default_fields.py feat(bitable): 多维表格文件层 + 默认字段 + 表内字段操作 + ce-code-review 修复 (Stage 1) 2026-06-29 04:07:45 +08:00
test_file_crud.py refactor: remove all emoji from agentkit 2026-07-02 01:33:28 +08:00
test_formula_engine.py feat(bitable): formula relations v2 — U1-U8 + review fixes 2026-07-06 12:57:07 +08:00
test_formula_parser.py feat(bitable): formula relations v2 — U1-U8 + review fixes 2026-07-06 12:57:07 +08:00
test_functions_aggregate.py feat(bitable): formula relations v2 — U1-U8 + review fixes 2026-07-06 12:57:07 +08:00
test_functions_datetime.py feat(bitable): formula relations v2 — U1-U8 + review fixes 2026-07-06 12:57:07 +08:00
test_functions_logical.py feat(bitable): formula relations v2 — U1-U8 + review fixes 2026-07-06 12:57:07 +08:00
test_functions_text.py feat(bitable): formula relations v2 — U1-U8 + review fixes 2026-07-06 12:57:07 +08:00
test_grouping.py feat(bitable): U5 R4 grouping (max 3 fields) + conditional formatting (7 operators) 2026-07-03 22:33:18 +08:00
test_ingestion_excel.py feat(bitable): add bitable companion service with full P0-P2 fixes 2026-06-25 01:09:59 +08:00
test_models.py feat(bitable): formula relations v2 — U1-U8 + review fixes 2026-07-06 12:57:07 +08:00
test_recalc.py fix(bitable): cross-table recalc + merge_record_values + SSRF tests 2026-07-06 13:29:54 +08:00
test_relation_service.py fix(bitable): cross-table recalc + merge_record_values + SSRF tests 2026-07-06 13:29:54 +08:00
test_repository.py fix(bitable/team): U3 — Residual P2 findings (DR-1/3/4/5 + #2/#3) 2026-07-06 03:48:14 +08:00
test_routes.py feat(bitable): U6 R15a BitableTool 4 new actions + DELETE /views endpoint 2026-07-03 23:13:46 +08:00
test_service.py fix(bitable/team): U3 — Residual P2 findings (DR-1/3/4/5 + #2/#3) 2026-07-06 03:48:14 +08:00