Commit 90dffe6
feat(datafabric ontology): first-class read-only entities, enforcement, debug, read-flow wiring
Extends the ontology layer per review feedback:
1. df:ReadableEntity is now first-class. CompiledOntology gains
`known_entities` (every df:entityKey the ontology declares) plus
is_known / is_writable / is_read_only helpers. Previously a read-only
entity was indistinguishable from one the ontology never mentioned —
both were merely absent from entity_access.
2. Read-only is enforced, not advisory. validate_mutation_intent rejects
a write to an entity the ontology knows but grants no write ops; the
write handler prunes such entities from write_schemas so they never
appear in the write tool description. (Verified: Customer is excluded
and a direct update is rejected.)
3. Debug output. CompiledOntology.to_human_readable() + module-level
format_ontology_debug(owl, compiled) render the raw OWL Turtle and a
human-readable IR (entities + access modes, measure/state/reference
field semantics, relationships). Logged at DEBUG in the fetch/compile
path and printed by both POC scripts during a run.
4. Ontology wired into the READ flow (reads still go through the existing
NL-to-SQL path — ontology enriches, does not restrict). Shared
maybe_fetch_and_compile_ontology helper used by both handlers; the read
handler threads CompiledOntology into DataFabricGraph.create ->
datafabric_prompt_builder, which emits an "## Ontology Context" section
(access modes, relationships, FK/reference targets, state-value sources)
for schema linking (P5).
Also: poc_refund_drive.py verification read-back now addresses entities by
GUID (get_record_async requires the id, not the name).
Validated live on staging (dataservicetest/addyTest): debug IR shows
Customer READ-ONLY; Customer pruned from writes + write rejected; refund
flow insert + 3 updates persist, 4/4 verified. 752 tests pass, ruff clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 8a10b1a commit 90dffe6
14 files changed
Lines changed: 558 additions & 49 deletions
File tree
- scripts
- src/uipath_langchain/agent/tools/datafabric_tool
- tests/agent/tools
- datafabric_tool
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
96 | 103 | | |
97 | 104 | | |
98 | 105 | | |
| |||
148 | 155 | | |
149 | 156 | | |
150 | 157 | | |
151 | | - | |
152 | | - | |
153 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
154 | 164 | | |
155 | 165 | | |
156 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
144 | 168 | | |
145 | 169 | | |
146 | 170 | | |
| |||
201 | 225 | | |
202 | 226 | | |
203 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
204 | 232 | | |
205 | 233 | | |
206 | 234 | | |
| |||
309 | 337 | | |
310 | 338 | | |
311 | 339 | | |
| 340 | + | |
312 | 341 | | |
313 | 342 | | |
314 | 343 | | |
| |||
414 | 443 | | |
415 | 444 | | |
416 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
417 | 453 | | |
418 | 454 | | |
419 | 455 | | |
| |||
Lines changed: 83 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
56 | | - | |
| 61 | + | |
| 62 | + | |
57 | 63 | | |
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
Lines changed: 78 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
152 | 212 | | |
153 | 213 | | |
154 | 214 | | |
155 | 215 | | |
156 | 216 | | |
| 217 | + | |
157 | 218 | | |
158 | 219 | | |
159 | 220 | | |
| |||
173 | 234 | | |
174 | 235 | | |
175 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
176 | 243 | | |
177 | 244 | | |
178 | 245 | | |
179 | 246 | | |
180 | 247 | | |
| 248 | + | |
181 | 249 | | |
182 | 250 | | |
183 | 251 | | |
| |||
210 | 278 | | |
211 | 279 | | |
212 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
213 | 285 | | |
214 | 286 | | |
215 | 287 | | |
| |||
245 | 317 | | |
246 | 318 | | |
247 | 319 | | |
| 320 | + | |
248 | 321 | | |
249 | 322 | | |
250 | 323 | | |
| |||
258 | 331 | | |
259 | 332 | | |
260 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
261 | 338 | | |
262 | 339 | | |
263 | 340 | | |
| |||
270 | 347 | | |
271 | 348 | | |
272 | 349 | | |
| 350 | + | |
273 | 351 | | |
274 | 352 | | |
275 | 353 | | |
| |||
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
98 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
99 | 104 | | |
100 | 105 | | |
101 | 106 | | |
| |||
226 | 231 | | |
227 | 232 | | |
228 | 233 | | |
| 234 | + | |
229 | 235 | | |
230 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
231 | 242 | | |
232 | 243 | | |
233 | 244 | | |
234 | 245 | | |
235 | 246 | | |
236 | 247 | | |
237 | 248 | | |
| 249 | + | |
238 | 250 | | |
239 | 251 | | |
0 commit comments