Commit 9b106d2
committed
feat(provider-tck): emit a machine-readable conformance report
Setting PROVIDER_TCK_REPORT_DIR makes each suite write its run to
<dir>/<name>.json against the report schema in the specification repository
(open-feature/spec#425, part of open-feature/spec#424).
Go is the language that needs this first. godog counts a capability-gated skip
in its passed tally, so a run that skipped five of twenty-nine scenarios prints
"29 scenarios (29 passed)". Appendix F is unambiguous that a scenario skipped
for an undeclared capability is reported as skipped with the reason and never as
passed, and the harness does say so in a separate log line -- but the headline
number still says something false, and the number is what gets read. pytest and
jest-cucumber report skips correctly, so this is the runner's property rather
than the suite's design.
The report does not fix godog's summary. It makes the summary stop mattering, by
recording every scenario's outcome individually so a consumer can check the rule
instead of trusting the runner to have applied it. The same run now reports
twenty-four passed and five not-declared, each with its reason.
Identity comes from revision.go, generated by sync_assets.go beside the embedded
artifacts. Generating both in one command is what keeps them honest: the CI check
regenerates and fails on any difference, so a revision disagreeing with the
artifacts beside it cannot be committed. The check is widened to cover the
generated file, which it would otherwise have missed. Both the commit and the
tree hash are recorded, the tree because it identifies the artifacts alone --
unchanged by unrelated edits elsewhere in the specification, so two runs of
identical artifacts agree even when pinned to different commits, and checkable
because `git rev-parse <commit>:specification/assets/provider-tck` reproduces it.
Two smaller decisions. The provider is identified by the name it reports through
its own metadata, with Config.Name recorded as the configuration, because
Config.Name is chosen to read well in a failure message -- "flagd-rpc" -- and a
provider with two materially different modes produces two reports that are not
interchangeable. And how the backend was driven is read through an optional
interface rather than a new BackendControl method, so that adding it breaks no
existing implementation and a control that does not implement it simply omits
the field.
Emission is opt-in through the environment rather than through Config so that
producing a report is a property of the run and not of the code: CI sets it, a
local run does not, and no adopter changes a line to publish one.
The tests assert the property that motivated the work -- that no scenario the
capability gate stopped is ever reported as passed, and that every scenario is
accounted for exactly once, since a report that silently omitted what it skipped
would satisfy the first half while still misleading a reader. That test earned
its place immediately: it caught this emitter recording every skipped scenario
twice, the second time as passed, because godog does not deliver the before
hook's ErrSkip to the after hook.
Signed-off-by: Simon Schrottner <simon.schrottner@flagsmith.com>1 parent 95586a3 commit 9b106d2
8 files changed
Lines changed: 726 additions & 2 deletions
File tree
- tools/provider-tck
- pkg/tck
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
437 | 493 | | |
438 | 494 | | |
439 | 495 | | |
| |||
522 | 578 | | |
523 | 579 | | |
524 | 580 | | |
| 581 | + | |
525 | 582 | | |
526 | 583 | | |
527 | 584 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
0 commit comments