tripverify 0.1.0__tar.gz

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 (43) hide show
  1. tripverify-0.1.0/LICENSE +202 -0
  2. tripverify-0.1.0/PKG-INFO +174 -0
  3. tripverify-0.1.0/README.md +145 -0
  4. tripverify-0.1.0/pyproject.toml +74 -0
  5. tripverify-0.1.0/setup.cfg +4 -0
  6. tripverify-0.1.0/src/tripverify/__init__.py +12 -0
  7. tripverify-0.1.0/src/tripverify/adapters/__init__.py +35 -0
  8. tripverify-0.1.0/src/tripverify/adapters/chinatravel.py +257 -0
  9. tripverify-0.1.0/src/tripverify/adapters/travelplanner.py +290 -0
  10. tripverify-0.1.0/src/tripverify/aggregate.py +120 -0
  11. tripverify-0.1.0/src/tripverify/cli.py +524 -0
  12. tripverify-0.1.0/src/tripverify/constraints/__init__.py +25 -0
  13. tripverify-0.1.0/src/tripverify/constraints/base.py +303 -0
  14. tripverify-0.1.0/src/tripverify/constraints/budget.py +288 -0
  15. tripverify-0.1.0/src/tripverify/constraints/structural.py +290 -0
  16. tripverify-0.1.0/src/tripverify/constraints/temporal.py +331 -0
  17. tripverify-0.1.0/src/tripverify/constraints/transit.py +403 -0
  18. tripverify-0.1.0/src/tripverify/hashing.py +159 -0
  19. tripverify-0.1.0/src/tripverify/models.py +111 -0
  20. tripverify-0.1.0/src/tripverify/providers/__init__.py +11 -0
  21. tripverify-0.1.0/src/tripverify/providers/base.py +132 -0
  22. tripverify-0.1.0/src/tripverify/providers/null.py +22 -0
  23. tripverify-0.1.0/src/tripverify/verdict.py +121 -0
  24. tripverify-0.1.0/src/tripverify.egg-info/PKG-INFO +174 -0
  25. tripverify-0.1.0/src/tripverify.egg-info/SOURCES.txt +41 -0
  26. tripverify-0.1.0/src/tripverify.egg-info/dependency_links.txt +1 -0
  27. tripverify-0.1.0/src/tripverify.egg-info/entry_points.txt +12 -0
  28. tripverify-0.1.0/src/tripverify.egg-info/requires.txt +6 -0
  29. tripverify-0.1.0/src/tripverify.egg-info/top_level.txt +1 -0
  30. tripverify-0.1.0/tests/test_adapters.py +342 -0
  31. tripverify-0.1.0/tests/test_aggregate.py +154 -0
  32. tripverify-0.1.0/tests/test_budget.py +298 -0
  33. tripverify-0.1.0/tests/test_cli.py +504 -0
  34. tripverify-0.1.0/tests/test_constraint_base.py +430 -0
  35. tripverify-0.1.0/tests/test_hashing.py +203 -0
  36. tripverify-0.1.0/tests/test_models.py +219 -0
  37. tripverify-0.1.0/tests/test_properties.py +290 -0
  38. tripverify-0.1.0/tests/test_providers.py +105 -0
  39. tripverify-0.1.0/tests/test_registry_cache.py +95 -0
  40. tripverify-0.1.0/tests/test_structural.py +363 -0
  41. tripverify-0.1.0/tests/test_temporal.py +280 -0
  42. tripverify-0.1.0/tests/test_transit.py +353 -0
  43. tripverify-0.1.0/tests/test_verdict.py +218 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,174 @@
1
+ Metadata-Version: 2.4
2
+ Name: tripverify
3
+ Version: 0.1.0
4
+ Summary: Verdict semantics for travel itinerary constraint checking
5
+ Author: VelVet8418
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/VelVet8418/tripverify
8
+ Project-URL: Repository, https://github.com/VelVet8418/tripverify
9
+ Project-URL: Issues, https://github.com/VelVet8418/tripverify/issues
10
+ Keywords: itinerary,constraint-checking,verifier,benchmark,llm-evaluation,travel-planning
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Topic :: Software Development :: Testing
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.12
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: pydantic>=2.14
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=8.0; extra == "dev"
26
+ Requires-Dist: hypothesis>=6.100; extra == "dev"
27
+ Requires-Dist: mypy>=1.10; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # tripverify
31
+
32
+ **Travel itinerary constraint checking with an honest verdict space.**
33
+
34
+ When a checker cannot tell whether a constraint holds, it says so. It does not
35
+ quietly round the answer up to *pass* or down to *fail*.
36
+
37
+ [![CI](https://github.com/VelVet8418/tripverify/actions/workflows/ci.yml/badge.svg)](https://github.com/VelVet8418/tripverify/actions/workflows/ci.yml)
38
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
39
+ [![Python](https://img.shields.io/badge/python-3.12%2B-blue.svg)](pyproject.toml)
40
+
41
+ ---
42
+
43
+ ## 30 seconds
44
+
45
+ ```bash
46
+ pip install git+https://github.com/VelVet8418/tripverify
47
+ ```
48
+
49
+ ```python
50
+ from decimal import Decimal
51
+ from datetime import time
52
+ from tripverify.models import Plan, Activity, Money
53
+ from tripverify.constraints.base import verify_all
54
+
55
+ plan = Plan(
56
+ days=1,
57
+ budget=Money(amount=Decimal("300")),
58
+ activities=[
59
+ Activity(poi_name="Gulangyu Islet", day=1,
60
+ start=time(9, 0), end=time(12, 0),
61
+ cost=Money(amount=Decimal("35"))),
62
+ Activity(poi_name="Nanputuo Temple", day=1,
63
+ start=time(11, 0), end=time(13, 0)),
64
+ ],
65
+ )
66
+
67
+ for v in verify_all(plan):
68
+ print(f"{v.state:<16} {v.constraint_id}")
69
+ ```
70
+
71
+ ```
72
+ UNDECIDABLE budget_total
73
+ SATISFIED logical_consistency
74
+ VIOLATED temporal_consistency
75
+ UNDECIDABLE transit_feasibility
76
+ ```
77
+
78
+ Three different answers, and only one of them is "no".
79
+
80
+ - **`VIOLATED`** — 09:00–12:00 and 11:00–13:00 overlap. You cannot be in two
81
+ places at once. This is a real defect in the plan.
82
+ - **`UNDECIDABLE`** (budget) — the temple has no price. The known 35 is under
83
+ 300, so the total *might* fit, or might not. Nobody knows.
84
+ - **`UNDECIDABLE`** (transit) — no routing provider is configured, so no
85
+ travel time exists for any leg.
86
+
87
+ Every other itinerary checker we are aware of has to pick *pass* or *fail* for
88
+ those last two. Both choices are wrong, and each is wrong in a way that
89
+ corrupts whatever you measure with it.
90
+
91
+ ## Why that matters
92
+
93
+ A checker that treats missing data as **pass** rewards saying less. The authors
94
+ of one travel benchmark found this in their own scorer and wrote it down:
95
+
96
+ > *"The dimension rewarded withholding information."*
97
+
98
+ They measured it: deleting the `arrival_time` field moved a model's score from
99
+ 0.447 up to **0.483**. Omission paid.
100
+
101
+ A checker that treats missing data as **fail** has the opposite bug: it charges
102
+ the model for the harness's own gaps. We found both patterns live in published
103
+ benchmarks, pointing in opposite directions.
104
+
105
+ The fix is not better defaults. It is admitting that a boolean has no room for
106
+ "I don't know".
107
+
108
+ ## The five states
109
+
110
+ | State | Meaning |
111
+ |---|---|
112
+ | `SATISFIED` | Evidence shows the constraint holds |
113
+ | `VIOLATED` | Evidence shows it is broken |
114
+ | `UNDECIDABLE` | The data needed to decide is missing |
115
+ | `NOT_APPLICABLE` | The constraint does not apply to this plan |
116
+ | `ERROR` | The checker itself failed |
117
+
118
+ `ERROR` is deliberately separate from `UNDECIDABLE`. "The world has no opening
119
+ hours for this museum" and "my parser crashed" are different problems with
120
+ different owners, and collapsing them hides bugs inside what looks like a data
121
+ gap.
122
+
123
+ **`UNDECIDABLE` is never silently folded.** Aggregate scores are reported under
124
+ all three conventions at once, because which one you pick changes the answer:
125
+
126
+ ```
127
+ strict 0.6667 (UNDECIDABLE counts as failure)
128
+ lenient 1.0000 (UNDECIDABLE counts as pass)
129
+ scoped 1.0000 (UNDECIDABLE excluded from denominator)
130
+ ```
131
+
132
+ If a leaderboard reports one number without saying which convention it used,
133
+ that number is not comparable to anything.
134
+
135
+ ## Command line
136
+
137
+ ```bash
138
+ tripverify verify plan.json
139
+ tripverify verify plan.json --format json --constraints budget_total,temporal_consistency
140
+ ```
141
+
142
+ Formats are auto-detected; ChinaTravel and TravelPlanner plans are converted
143
+ on the way in, and any field that has no canonical home is listed rather than
144
+ dropped in silence.
145
+
146
+ Exit codes: `0` clean, `1` something was violated, `2` the run itself was not
147
+ valid (too many `ERROR`s to trust), `64` bad usage.
148
+
149
+ ## Design rules
150
+
151
+ - **The judgment kernel calls no language model and touches no network.** Same
152
+ plan, same ruleset version, same verdicts — always. A verifier you cannot
153
+ reproduce is not a verifier.
154
+ - **Every verdict carries its evidence**: which activities, which sources, what
155
+ each source said, and why that led here. When two sources disagree, both
156
+ values are reported and neither is silently preferred.
157
+ - **Missing data has exactly one legal route** into a verdict: a provider
158
+ returning `NoData`. A provider that raises is a bug, and is reported as one.
159
+ - **Reproducibility is hashed over five components**, including the OSM extract
160
+ and OSRM build parameters. Leave those out and two machines can produce
161
+ different travel times under the same hash.
162
+
163
+ ## Status
164
+
165
+ Early. The core verdict semantics, the constraint kernel, format adapters and
166
+ the CLI are implemented and tested; the solver-based repair layer, the Xiamen
167
+ fixture and the MCP server are not yet.
168
+
169
+ Issues and PRs welcome — especially disagreements about where a verdict
170
+ boundary should sit. Those are the interesting bugs.
171
+
172
+ ## License
173
+
174
+ Apache-2.0
@@ -0,0 +1,145 @@
1
+ # tripverify
2
+
3
+ **Travel itinerary constraint checking with an honest verdict space.**
4
+
5
+ When a checker cannot tell whether a constraint holds, it says so. It does not
6
+ quietly round the answer up to *pass* or down to *fail*.
7
+
8
+ [![CI](https://github.com/VelVet8418/tripverify/actions/workflows/ci.yml/badge.svg)](https://github.com/VelVet8418/tripverify/actions/workflows/ci.yml)
9
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
10
+ [![Python](https://img.shields.io/badge/python-3.12%2B-blue.svg)](pyproject.toml)
11
+
12
+ ---
13
+
14
+ ## 30 seconds
15
+
16
+ ```bash
17
+ pip install git+https://github.com/VelVet8418/tripverify
18
+ ```
19
+
20
+ ```python
21
+ from decimal import Decimal
22
+ from datetime import time
23
+ from tripverify.models import Plan, Activity, Money
24
+ from tripverify.constraints.base import verify_all
25
+
26
+ plan = Plan(
27
+ days=1,
28
+ budget=Money(amount=Decimal("300")),
29
+ activities=[
30
+ Activity(poi_name="Gulangyu Islet", day=1,
31
+ start=time(9, 0), end=time(12, 0),
32
+ cost=Money(amount=Decimal("35"))),
33
+ Activity(poi_name="Nanputuo Temple", day=1,
34
+ start=time(11, 0), end=time(13, 0)),
35
+ ],
36
+ )
37
+
38
+ for v in verify_all(plan):
39
+ print(f"{v.state:<16} {v.constraint_id}")
40
+ ```
41
+
42
+ ```
43
+ UNDECIDABLE budget_total
44
+ SATISFIED logical_consistency
45
+ VIOLATED temporal_consistency
46
+ UNDECIDABLE transit_feasibility
47
+ ```
48
+
49
+ Three different answers, and only one of them is "no".
50
+
51
+ - **`VIOLATED`** — 09:00–12:00 and 11:00–13:00 overlap. You cannot be in two
52
+ places at once. This is a real defect in the plan.
53
+ - **`UNDECIDABLE`** (budget) — the temple has no price. The known 35 is under
54
+ 300, so the total *might* fit, or might not. Nobody knows.
55
+ - **`UNDECIDABLE`** (transit) — no routing provider is configured, so no
56
+ travel time exists for any leg.
57
+
58
+ Every other itinerary checker we are aware of has to pick *pass* or *fail* for
59
+ those last two. Both choices are wrong, and each is wrong in a way that
60
+ corrupts whatever you measure with it.
61
+
62
+ ## Why that matters
63
+
64
+ A checker that treats missing data as **pass** rewards saying less. The authors
65
+ of one travel benchmark found this in their own scorer and wrote it down:
66
+
67
+ > *"The dimension rewarded withholding information."*
68
+
69
+ They measured it: deleting the `arrival_time` field moved a model's score from
70
+ 0.447 up to **0.483**. Omission paid.
71
+
72
+ A checker that treats missing data as **fail** has the opposite bug: it charges
73
+ the model for the harness's own gaps. We found both patterns live in published
74
+ benchmarks, pointing in opposite directions.
75
+
76
+ The fix is not better defaults. It is admitting that a boolean has no room for
77
+ "I don't know".
78
+
79
+ ## The five states
80
+
81
+ | State | Meaning |
82
+ |---|---|
83
+ | `SATISFIED` | Evidence shows the constraint holds |
84
+ | `VIOLATED` | Evidence shows it is broken |
85
+ | `UNDECIDABLE` | The data needed to decide is missing |
86
+ | `NOT_APPLICABLE` | The constraint does not apply to this plan |
87
+ | `ERROR` | The checker itself failed |
88
+
89
+ `ERROR` is deliberately separate from `UNDECIDABLE`. "The world has no opening
90
+ hours for this museum" and "my parser crashed" are different problems with
91
+ different owners, and collapsing them hides bugs inside what looks like a data
92
+ gap.
93
+
94
+ **`UNDECIDABLE` is never silently folded.** Aggregate scores are reported under
95
+ all three conventions at once, because which one you pick changes the answer:
96
+
97
+ ```
98
+ strict 0.6667 (UNDECIDABLE counts as failure)
99
+ lenient 1.0000 (UNDECIDABLE counts as pass)
100
+ scoped 1.0000 (UNDECIDABLE excluded from denominator)
101
+ ```
102
+
103
+ If a leaderboard reports one number without saying which convention it used,
104
+ that number is not comparable to anything.
105
+
106
+ ## Command line
107
+
108
+ ```bash
109
+ tripverify verify plan.json
110
+ tripverify verify plan.json --format json --constraints budget_total,temporal_consistency
111
+ ```
112
+
113
+ Formats are auto-detected; ChinaTravel and TravelPlanner plans are converted
114
+ on the way in, and any field that has no canonical home is listed rather than
115
+ dropped in silence.
116
+
117
+ Exit codes: `0` clean, `1` something was violated, `2` the run itself was not
118
+ valid (too many `ERROR`s to trust), `64` bad usage.
119
+
120
+ ## Design rules
121
+
122
+ - **The judgment kernel calls no language model and touches no network.** Same
123
+ plan, same ruleset version, same verdicts — always. A verifier you cannot
124
+ reproduce is not a verifier.
125
+ - **Every verdict carries its evidence**: which activities, which sources, what
126
+ each source said, and why that led here. When two sources disagree, both
127
+ values are reported and neither is silently preferred.
128
+ - **Missing data has exactly one legal route** into a verdict: a provider
129
+ returning `NoData`. A provider that raises is a bug, and is reported as one.
130
+ - **Reproducibility is hashed over five components**, including the OSM extract
131
+ and OSRM build parameters. Leave those out and two machines can produce
132
+ different travel times under the same hash.
133
+
134
+ ## Status
135
+
136
+ Early. The core verdict semantics, the constraint kernel, format adapters and
137
+ the CLI are implemented and tested; the solver-based repair layer, the Xiamen
138
+ fixture and the MCP server are not yet.
139
+
140
+ Issues and PRs welcome — especially disagreements about where a verdict
141
+ boundary should sit. Those are the interesting bugs.
142
+
143
+ ## License
144
+
145
+ Apache-2.0
@@ -0,0 +1,74 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tripverify"
7
+ version = "0.1.0"
8
+ description = "Verdict semantics for travel itinerary constraint checking"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [{ name = "VelVet8418" }]
13
+ keywords = [
14
+ "itinerary",
15
+ "constraint-checking",
16
+ "verifier",
17
+ "benchmark",
18
+ "llm-evaluation",
19
+ "travel-planning",
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 3 - Alpha",
23
+ "Intended Audience :: Developers",
24
+ "Intended Audience :: Science/Research",
25
+ "License :: OSI Approved :: Apache Software License",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
29
+ "Topic :: Software Development :: Testing",
30
+ "Typing :: Typed",
31
+ ]
32
+ dependencies = [
33
+ "pydantic>=2.14",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/VelVet8418/tripverify"
38
+ Repository = "https://github.com/VelVet8418/tripverify"
39
+ Issues = "https://github.com/VelVet8418/tripverify/issues"
40
+
41
+ [project.optional-dependencies]
42
+ dev = [
43
+ "pytest>=8.0",
44
+ "hypothesis>=6.100",
45
+ "mypy>=1.10",
46
+ ]
47
+
48
+ [project.scripts]
49
+ tripverify = "tripverify.cli:main"
50
+
51
+ # All constraint entry points are declared up front so that parallel task
52
+ # implementations never need to edit this file. A name listed here whose
53
+ # module does not yet exist is simply skipped by the lazy registry loader.
54
+ [project.entry-points."tripverify.constraints"]
55
+ budget_total = "tripverify.constraints.budget:BudgetTotal"
56
+ temporal_consistency = "tripverify.constraints.temporal:TemporalConsistency"
57
+ transit_feasibility = "tripverify.constraints.transit:TransitFeasibility"
58
+ logical_consistency = "tripverify.constraints.structural:LogicalConsistency"
59
+ required_poi = "tripverify.constraints.structural:RequiredPOI"
60
+
61
+ [project.entry-points."tripverify.providers"]
62
+ null = "tripverify.providers.null:NullProvider"
63
+
64
+ [tool.setuptools.packages.find]
65
+ where = ["src"]
66
+
67
+ [tool.pytest.ini_options]
68
+ testpaths = ["tests"]
69
+ pythonpath = ["src"]
70
+
71
+ [tool.mypy]
72
+ python_version = "3.12"
73
+ strict = true
74
+ files = ["src/tripverify"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,12 @@
1
+ """tripverify - verdict semantics for travel itinerary constraint checking.
2
+
3
+ The judgment kernel is deterministic and calls no language model and no
4
+ network: the same plan under the same ruleset version always yields the same
5
+ verdicts. Data that is absent is reported as ``UNDECIDABLE`` rather than
6
+ being folded into pass or fail, so a plan cannot score well by omitting
7
+ information.
8
+ """
9
+
10
+ __all__ = ["__version__"]
11
+
12
+ __version__ = "0.1.0"
@@ -0,0 +1,35 @@
1
+ """Format adapters: foreign plan formats -> canonical :class:`Plan`.
2
+
3
+ Every adapter exposes the same entry point::
4
+
5
+ to_canonical(raw: dict) -> tuple[Plan, list[str]]
6
+
7
+ The second element is the **lost-field list**: the dotted paths of source keys
8
+ that the canonical model has no slot for. A lossy conversion must never be
9
+ silent, so the list is empty *only* when the conversion was lossless. Paths are
10
+ index free, de-duplicated and sorted (``"accommodation.room_type"``, not
11
+ ``"plan[2].accommodation.room_type"``).
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ from types import ModuleType
17
+
18
+ from . import chinatravel, travelplanner
19
+
20
+ __all__ = ["chinatravel", "travelplanner", "ADAPTERS", "get_adapter"]
21
+
22
+ #: Registry of adapter modules by format name.
23
+ ADAPTERS: dict[str, ModuleType] = {
24
+ "chinatravel": chinatravel,
25
+ "travelplanner": travelplanner,
26
+ }
27
+
28
+
29
+ def get_adapter(name: str) -> ModuleType:
30
+ """Return the adapter module for ``name``; raise ``KeyError`` if unknown."""
31
+ try:
32
+ return ADAPTERS[name]
33
+ except KeyError:
34
+ known = ", ".join(sorted(ADAPTERS))
35
+ raise KeyError(f"unknown plan format {name!r}; known formats: {known}") from None