tg_geometry 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -79
  3. data/README.md +82 -191
  4. data/Rakefile +3 -3
  5. data/benchmark/falcon_concurrency.rb +1 -1
  6. data/benchmark/feature_source.rb +92 -0
  7. data/docs/ARCHITECTURE.md +29 -107
  8. data/docs/BENCHMARKING.md +20 -1
  9. data/docs/CASUAL_EXAMPLE.md +71 -458
  10. data/docs/CONCURRENCY.md +13 -7
  11. data/docs/ERROR_HANDLING.md +30 -0
  12. data/docs/FEATURE_SOURCE.md +166 -0
  13. data/docs/LIMITATIONS.md +11 -50
  14. data/docs/MEMORY_OWNERSHIP.md +20 -2
  15. data/ext/tg_geometry/extconf.rb +46 -4
  16. data/ext/tg_geometry/tg_geometry_ext.c +2453 -150
  17. data/ext/tg_geometry/tg_geometry_vendor_json.c +17 -0
  18. data/ext/tg_geometry/tg_geometry_vendor_tg.c +3 -0
  19. data/ext/tg_geometry/vendor/.vendored +8 -2
  20. data/ext/tg_geometry/vendor/json/LICENSE +20 -0
  21. data/ext/tg_geometry/vendor/json/VERSION +3 -0
  22. data/ext/tg_geometry/vendor/json/json.c +1024 -0
  23. data/ext/tg_geometry/vendor/json/json.h +207 -0
  24. data/lib/tg/geometry/registry.rb +3 -3
  25. data/lib/tg/geometry/version.rb +1 -1
  26. data/script/vendor_libs.rb +22 -6
  27. data/spec/{expansion_a_auto_strategy_spec.rb → auto_strategy_spec.rb} +1 -1
  28. data/spec/{block_12_batch_packed_spec.rb → batch_packed_spec.rb} +1 -1
  29. data/spec/{block_20_concurrency_spec.rb → concurrency_spec.rb} +1 -1
  30. data/spec/{block_13_error_hardening_spec.rb → error_hardening_spec.rb} +1 -1
  31. data/spec/feature_source_nogvl_spec.rb +51 -0
  32. data/spec/feature_source_spec.rb +268 -0
  33. data/spec/{expansion_d_format_coverage_spec.rb → format_coverage_spec.rb} +1 -1
  34. data/spec/{block_20_fuzz_spec.rb → fuzz_spec.rb} +1 -1
  35. data/spec/{block_4_geom_api_spec.rb → geom_api_spec.rb} +1 -1
  36. data/spec/{block_3_geom_parse_spec.rb → geom_parse_spec.rb} +1 -1
  37. data/spec/{block_8_index_borrowed_geometry_spec.rb → index_borrowed_geometry_spec.rb} +1 -1
  38. data/spec/{block_6_index_build_spec.rb → index_build_spec.rb} +2 -2
  39. data/spec/{block_9_flat_query_spec.rb → index_flat_query_spec.rb} +1 -1
  40. data/spec/{block_7_index_owned_geometry_spec.rb → index_owned_geometry_spec.rb} +1 -1
  41. data/spec/{block_10_rtree_strategy_spec.rb → index_rtree_accounting_spec.rb} +1 -1
  42. data/spec/{block_11_rtree_order_spec.rb → index_rtree_order_spec.rb} +1 -1
  43. data/spec/{block_1_skeleton_spec.rb → load_and_errors_spec.rb} +1 -1
  44. data/spec/{expansion_e_low_level_geometry_spec.rb → low_level_geometry_spec.rb} +1 -1
  45. data/spec/{block_14_memory_gc_hardening_spec.rb → memory_gc_spec.rb} +1 -1
  46. data/spec/{expansion_i_ractor_spec.rb → ractor_spec.rb} +1 -1
  47. data/spec/{block_5_rect_api_spec.rb → rect_api_spec.rb} +1 -1
  48. data/spec/{expansion_b_registry_spec.rb → registry_spec.rb} +1 -1
  49. data/spec/{expansion_j_full_tg_api_coverage_spec.rb → tg_api_coverage_spec.rb} +1 -1
  50. data/spec/{block_2_vendor_spec.rb → vendor_sources_spec.rb} +4 -4
  51. metadata +39 -38
  52. data/docs/ACTIVE_RECORD.md +0 -26
  53. data/docs/AUTO_STRATEGY.md +0 -15
  54. data/docs/EXPANSION_E_TO_H_STATUS.md +0 -51
  55. data/docs/FORMAT_COVERAGE.md +0 -23
  56. data/docs/FULL_TG_API_COVERAGE.md +0 -109
  57. data/docs/LOW_LEVEL_GEOMETRY.md +0 -121
  58. data/docs/RACTOR.md +0 -40
  59. data/docs/REGISTRY.md +0 -37
  60. data/docs/RELEASE_CHECKLIST.md +0 -39
  61. /data/spec/{expansion_c_active_record_source_spec.rb → active_record_source_spec.rb} +0 -0
data/docs/RACTOR.md DELETED
@@ -1,40 +0,0 @@
1
- # Ractor investigation
2
-
3
- This document covers Expansion Block I.
4
-
5
- ## Current result
6
-
7
- `tg_geometry` does not claim Ractor support.
8
-
9
- The current native wrappers are frozen and immutable for normal Ruby thread reads, but they are not Ractor-shareable Ruby objects. The test suite records this boundary with `Ractor.shareable?` and `Ractor.make_shareable` checks for:
10
-
11
- - `TG::Geometry::Geom`
12
- - `TG::Geometry::Rect`
13
- - `TG::Geometry::Index`
14
-
15
- This is an explicit unsupported boundary, not a partial support claim.
16
-
17
- ## Shareability rules
18
-
19
- Current rule for public docs and code comments:
20
-
21
- - Normal Ruby thread read-only use is supported by immutable object design and tests.
22
- - Ractor support is not supported and not advertised.
23
- - Do not use `TG::Geometry::Geom`, `TG::Geometry::Rect`, `TG::Geometry::Index`, or borrowed low-level wrappers as cross-Ractor shareable objects.
24
- - Do not add Ractor-specific code paths without a new explicit design and tests.
25
-
26
- ## Why no support claim is made
27
-
28
- The extension stores native pointers and Ruby `VALUE` references inside TypedData wrappers. The current contract validates GC marking, compaction, ownership, and normal thread read-only access. It does not define or validate cross-Ractor transfer/share semantics for those wrappers.
29
-
30
- ## Required before changing this status
31
-
32
- Before any future Ractor support claim:
33
-
34
- 1. Define shareability rules for owned and borrowed `TG::Geometry::Geom` wrappers.
35
- 2. Define shareability rules for `TG::Geometry::Index` entries and id `VALUE`s.
36
- 3. Define behavior for borrowed Line/Ring/Polygon/Segment wrappers.
37
- 4. Add Ractor tests that pass on the supported Ruby matrix.
38
- 5. Document whether objects are shareable directly, require duplication, or are unsupported.
39
-
40
- Until those items exist, Ractor remains unsupported.
data/docs/REGISTRY.md DELETED
@@ -1,37 +0,0 @@
1
- # Registry
2
-
3
- `TG::Geometry::Registry` is Ruby-side application sugar over immutable `TG::Geometry::Index`.
4
-
5
- It does not add a mutable native index. `reload!` always builds a new Index and then swaps a Ruby reference:
6
-
7
- ```ruby
8
- class DeliveryZones < TG::Geometry::Registry
9
- source do
10
- [
11
- [:zone_a, '{"type":"Polygon","coordinates":[[[0,0],[10,0],[10,10],[0,10],[0,0]]]}']
12
- ]
13
- end
14
- end
15
-
16
- registry = DeliveryZones.new(via: :geojson, strategy: :rtree)
17
- registry.reload!
18
- registry.find_covering(5, 5)
19
- ```
20
-
21
- Readers capture the current immutable Index. An active reader can continue using the old Index while `reload!` builds and swaps a new one.
22
-
23
- ## API
24
-
25
- - `source { ... }` on a subclass defines the entry source.
26
- - `index_options(...)` on a subclass sets default Index options.
27
- - `reload!` builds and swaps a new Index.
28
- - `find_covering`, `covering_ids`, `intersecting_rect`, and `covering_ids_batch_packed` delegate to the current Index.
29
- - `index`, `size`, `bbox`, and `loaded?` expose current state.
30
-
31
- The source must return the strict first-release entry format:
32
-
33
- ```ruby
34
- [[id, object], [id, object], ...]
35
- ```
36
-
37
- No Redis dependency, no Rails dependency, no global native singleton, and no in-place Index mutation are introduced.
@@ -1,39 +0,0 @@
1
- # First public release checklist
2
-
3
- This checklist is intentionally conservative. Do not publish until every required item is satisfied.
4
-
5
- ## Required state before release
6
-
7
- - [ ] All release-core specs pass locally.
8
- - [ ] GC.stress specs pass.
9
- - [ ] GC.compact specs pass.
10
- - [ ] ASAN status is documented.
11
- - [ ] Valgrind status is documented.
12
- - [ ] Benchmark scripts exist and have been run for the full scenario matrix.
13
- - [ ] README and docs are complete.
14
- - [ ] Gem metadata is final:
15
- - gem name: `tg_geometry`;
16
- - author: `Roman Haydarov`;
17
- - email: `romnhajdarov@gmail.com`;
18
- - repository: `https://github.com/roman-haidarov/tg_geometry`.
19
- - [ ] Vendored TG and rtree versions are pinned in `VERSION` files.
20
- - [ ] Upstream license files are included under `ext/tg_geometry/vendor/*/LICENSE`.
21
- - [ ] `CHANGELOG.md` exists.
22
-
23
- ## Do not release if any of these are true
24
-
25
- - [ ] Any OPEN QUESTION affects correctness.
26
- - [ ] Any memory accounting path is approximate.
27
- - [ ] Any failed build path waits for GC instead of immediate dispose.
28
- - [ ] `strategy: :auto` is enabled without benchmark-derived threshold.
29
- - [ ] Public API differs from the contract without Roman approval.
30
- - [ ] Ractor support is claimed.
31
- - [ ] Performance claims are present without project-owned benchmark output.
32
-
33
- ## OPEN QUESTION: ASAN setup
34
-
35
- ASAN setup is not fully specified in the contract and the worker must not research it independently. The repository contains a placeholder CI job that fails with an explicit message until Roman approves the exact ASAN approach.
36
-
37
- ## OPEN QUESTION: Valgrind setup
38
-
39
- Valgrind setup can vary by CI image and Ruby build. The repository contains a placeholder CI job that installs/runs nothing by default and asks for approval before adding a final Valgrind configuration.