Skip to content

fix(demo): the demo import reported the ask, never the landing - #1784

Merged
rubenvdlinde merged 1 commit into
developmentfrom
fix/demo-data-count-what-landed
Sep 3, 2026
Merged

fix(demo): the demo import reported the ask, never the landing#1784
rubenvdlinde merged 1 commit into
developmentfrom
fix/demo-data-count-what-landed

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

The defect

DemoDataService::install() counted components.objects in the shipped file and returned that number as the import's result. Its own comment said so outright:

// Counted from the file rather than from the importer's reply, so the
// number reported is the number ASKED FOR.
$objects = count($components['objects']);

An ask is not an outcome. dossiq_mock_register.json carries 456 objects, so the wizard reported "456 objects" whether OpenRegister stored 456, three, or none. The ten demo keys no schema declares (#1782) were stripped on the way in under exactly that green message, and the message could not have said otherwise.

This is the same hollow-green shape as the seed steps of #1767 and #1769, where a step that touched nothing reported success: true with every counter at zero and recorded itself as done.

The fix

ImportHandler::importFromJson() already answers with both halves, and neither was being read:

  • objects — the ObjectEntity instances it created or updated
  • skipped.objects — the ones it refused, incremented in the per-entity catch (\Throwable)

Both now come from the reply. install() returns objects (landed), requested (the ask), refused, registers and schemas, and the wizard prints "Demo data installed: 456 of 456 objects stored across 143 schemas (0 refused)."

An import that stored none of what it was given throws instead of returning zeroes, so it cannot reach the caller in a success shape. A descriptor that ships no objects at all stays a success: registers and schemas are a legitimate thing to ship on their own. A partial import logs a warning naming what was lost, because the counts are the only place the difference is visible.

The test fake was part of the defect

The importer spy returned registers and schemas and no objects key at all, while testItImportsTheDescriptorAndReportsTheCounts asserted five objects. The two only agreed because the service was reading the file — a fake written from the call site encodes the caller's bug. It now answers in the importer's real shape.

Red first, on the unmodified service:

2) DemoDataServiceTest::testTheObjectCountComesFromTheImporterNotFromTheFile
the count must be the importer's reply, not the file's length
Failed asserting that 9 is identical to 3.

Six of twelve failed before the change; the new cases cover the count, the refusal count, the zero-landed refusal, an importer reply with no objects key, and a descriptor that legitimately ships none.

Verified locally

phpunit 3018 tests / 19999 assertions green · phpcs clean on both changed lib/ files · phpmd clean on lib/Service and lib/Controller · psalm no errors · phpstan no errors.

🤖 Generated with Claude Code

`DemoDataService::install()` counted `components.objects` in the shipped
file and returned that number as the import's result. The comment said so
outright: "the number reported is the number ASKED FOR". An ask is not an
outcome. A descriptor carrying 456 objects reported "456 objects" whether
OpenRegister stored 456, three, or none, so the ten demo keys no schema
declared (#1782) were stripped on the way in under a green message that
could not have said otherwise.

Same hollow-green shape as the seed steps of #1767 and #1769, where a step
that touched nothing reported success with every counter at zero and
recorded itself as done.

`ImportHandler::importFromJson()` already answers with both halves:
`objects` is the entities it created or updated, `skipped.objects` is the
ones it refused. Both are now read from the reply and both are returned,
so a caller prints the landing next to the ask, and an import that stored
none of what it was given throws instead of returning zeroes. A descriptor
that ships no objects at all stays a success: registers and schemas are a
legitimate thing to ship on their own.

The test fake is part of the fix. It returned `registers` and `schemas`
and no `objects` key at all, while the assertion expected five objects —
the two only agreed because the service was reading the file. It now
answers in the importer's real shape, and the new case that stores three
of nine fails red against the old code with "9 is identical to 3".
@rubenvdlinde
rubenvdlinde merged commit 1acd0f4 into development Sep 3, 2026
46 checks passed
@rubenvdlinde
rubenvdlinde deleted the fix/demo-data-count-what-landed branch September 3, 2026 19:08
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/dossiq @ 861e3c7

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-manifest
check-vue3-compile
test-l10n
format
check-schema-l10n
check-l10n-js
composer ✅ 106/106
npm ✅ 540/540
app:check-code ⏭️
info.xml
REUSE
PHPUnit
Newman ⏭️
Playwright ⏭️ deferred — runs on the promotion into beta/main, not on a pull request into development
Hydra gates

Quality workflow — 2026-09-03 19:12 UTC

Download the full PDF report from the workflow artifacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant