Skip to content

fix(forms): record authored form version on observations - #1046

Open
Grace256c wants to merge 4 commits into
OpenDataEnsemble:devfrom
Grace256c:fix/950-record-authored-form-version
Open

Grace256c wants to merge 4 commits into
OpenDataEnsemble:devfrom
Grace256c:fix/950-record-authored-form-version

Conversation

@Grace256c

Copy link
Copy Markdown
Contributor

What & Why

New observations were not consistently recording the authored version of the form used to create them. Formulus could still persist "1.0" regardless of the opened schema, Desktop preview did not consistently preserve the session version, and Formplayer drafts/sticky values only considered the legacy version field.

This change carries the authored form version through the full observation workflow using the same resolution established in #909:

  1. non-empty root schemaVersion
  2. otherwise non-empty root version
  3. otherwise "1.0"

Formulus

  • Captures FormSpec.schemaVersion when a Formplayer session opens.
  • Persists that captured version for new observations, so a form opened at version "2" still records "2" even if the available form spec changes before submission.
  • Resolves headless creates from host-owned form metadata instead of trusting WebView input.
  • Keeps edit/update paths version-neutral so the observation's original formVersion is preserved.
  • Keeps sub-observation sessions return-only.
  • Aligns the direct FormService creation path with the resolved form version.

No Formulus bridge contract or interface version changes were required.

Formplayer

  • Adds the same schemaVersion → version → "1.0" resolution for:
    • draft metadata
    • draft selection
    • sticky-value lookup
    • sticky-value storage
  • Keeps legacy drafts without version metadata discoverable and does not relabel them.

Versionless sticky data now uses the resolved "1.0" bucket. Existing legacy ::0 sticky values are intentionally left untouched; no migration is included.

Desktop

  • Captures the resolved form version when each preview session opens.
  • Persists the captured version for new observations and JSON exports.
  • Preserves the original stored formVersion and other observation extras during edits.
  • Preserves existing extras during headless updates.
  • Resolves headless creates from the matching host session or host-loaded form spec, falling back to "1.0".
  • Matches nested preview version snapshots by both form type and sender identity so parallel nested sessions cannot use each other's version.
  • Leaves the generic/manual observation default unchanged.

No Rust persistence or public preview bridge changes were required.

Documentation

Updates the Form Versioning reference to document:

  • root schemaVersion precedence
  • legacy root version support
  • "1.0" fallback
  • invalid/blank value handling
  • opening-session version provenance for new observations
  • preservation of stored formVersion when editing

Type of Change

  • Bug fix
  • New feature / enhancement
  • Refactor / cleanup
  • Documentation
  • Chore / other

Component(s) Changed

  • formulus (React Native mobile app)
  • formulus-formplayer (form WebView UI)
  • synkronus (Go backend)
  • synkronus-cli (command-line client)
  • synkronus-portal (web admin UI)
  • desktop (Tauri app)
  • packages (tokens / components)
  • Documentation / DevOps / CI

Testing

  • Added/updated tests
  • Manually tested
  • Not applicable

Coverage includes:

  • authored schemaVersion
  • legacy version
  • precedence when both are present
  • versionless "1.0" fallback
  • invalid version metadata
  • Formulus session-version snapshot behavior
  • host-side headless creation
  • edit preservation
  • sub-observation behavior
  • Formplayer draft/sticky version isolation
  • legacy unversioned draft compatibility
  • Desktop preview session provenance
  • nested sessions with the same form type but different sender/version
  • Desktop headless create/update behavior
  • preservation of observation extras
  • JSON export version metadata

Verification after rebasing onto the merged #909:

Formulus

  • pnpm run lint
  • pnpm run format:check
  • pnpm run test --ci --watchAll=false
  • 65 suites / 531 tests passed

Formplayer

  • lint
  • format check
  • TypeScript compilation
  • Vite production build
  • 42 test files / 289 tests passed

Desktop

  • pnpm run lint
  • pnpm run format:check
  • pnpm test
  • pnpm typecheck
  • pnpm run build
  • 32 test files / 193 tests passed

Documentation

  • pnpm run validate
  • Docusaurus production build passed

Repository

  • git diff --check upstream/dev...HEAD

Known non-blocking warnings remain in existing test/build infrastructure, including Jest teardown warnings, jsdom canvas limitations, Desktop bundle-size warnings, and existing documentation link warnings.

During earlier verification, attachmentManifestResume.test.ts failed once on cursor advancement and then passed on rerun; repeated focused runs also passed, and no causal connection to this change was found.

Checklist

  • Pre-flight checks for changed packages passed (lint / format / tests)
  • Breaking changes (if any) have migration steps
  • Related issue linked, e.g. Closes #123

Closes #950

@Grace256c

Copy link
Copy Markdown
Contributor Author

Hello @najuna-brian i have solved this issue, could you please review when you get a minute
thank you

This branch has not been deployed

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

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

fix(formulus): record the authored form version on observations

1 participant