Skip to content

update v2-rc2 from develop#1516

Merged
TheLastCicada merged 21 commits into
v2-rc2from
develop
Mar 2, 2026
Merged

update v2-rc2 from develop#1516
TheLastCicada merged 21 commits into
v2-rc2from
develop

Conversation

@TheLastCicada

Copy link
Copy Markdown
Contributor

No description provided.

TheLastCicada and others added 21 commits February 25, 2026 15:14
Make the following fields required in their respective Joi schemas,
integration tests, live API test generators, and documentation:

- Project: projectLink, projectSector, projectType, projectStatus,
  projectStatusDate, projectUnitMetric
- Location: locationCountry
- Validation: validationType, validationBody
- Verification: verificationBody
- Unit: unitCount, unitType, unitStatus, unitStatusReason, unitMetric
- Stakeholder: stakeholderType
- Label: labelType
- Unit-label: labelUnitDate
- Estimation: estimationUnitCount
- Rating: ratingType

Update integration tests to include all required fields in payloads
for tests targeting other validation rules (Joi abortEarly behavior).
Add dedicated reject-without-field tests for each new required field.
Update live API test data generators to include newly required fields.
Update API documentation to mark fields as required.

Made-with: Cursor
Skip 50ms CRUD delays in all V2 models when USE_SIMULATOR is true.
Remove unnecessary FTS setTimeout delays in V2 FTS tests. Reduce
polling intervals from 500ms to 100ms in governance and org-creation
tests. Make sync-registries scheduler (V1 and V2) run every 1s in
simulator mode instead of 5s. Increase V1 polling maxAttempts for
faster intervals. Update test-runner agent config.

Made-with: Cursor
- Fix staging cleanup in projects.spec.js (GET -> DELETE for /v1/staging/clean)
- Add staging cleanup beforeEach in units.spec.js for test isolation
- Fix orgUid filter assertion to verify exact match (to.equal(1))
- Strengthen split unit polling to verify unitCount, not just existence
- Strengthen project update polling to verify field change synced
- Make truncateStaging only delete committed records in simulator mode
- Increase simulator scheduler interval to 2s to prevent race conditions

Made-with: Cursor
When the DataLayer database is deleted or reset while the wallet retains
on-chain state, stores get stuck at generation=0 with an empty root hash
while the blockchain shows target_generation > 0. Writing new data to
stores in this state is silently discarded by DataLayer.

Add isOwnedStoreLocalDataMissing() to detect this condition, upgrade
sync task logging from debug to error level, and block writes in
pushChangesWhenStoreIsAvailable() with a descriptive error message.

Made-with: Cursor
projectSector was stored as a raw JavaScript array in staging data
while projectType was correctly JSON.stringify()'d. This caused
projectSector to be silently dropped during XLS changelist generation
(arrays treated as child relationships), resulting in null values
after the datalayer round-trip.
…cleanup

Parse project_sector as JSON string in V2 project staging assertions
to match the serialization added in d998c3c. Clean up committed
staging records in V1 unit test beforeEach to prevent
assertNoPendingCommits race condition.
…-store

fix: detect and block writes to DataLayer stores with lost local data
feat(V2): make key fields required across V2 API endpoints
Allow users to promote a non-home organization to home status when
they own the underlying datalayer stores but the database has
isHome/is_home set to false (e.g., after import without the home
flag or interrupted creation).

The endpoint performs 11 safety checks: read-only mode, wallet sync,
org existence, idempotent home check, no conflicting home org, no
PENDING creation, ownership of org/registry/singleton stores, orgHash
populated, and singleton version key consistency.

Also improves the simulator to track owned stores (via data writes
and createDataLayerStore calls) instead of returning an empty list,
enabling proper integration testing of ownership assertions.
V1 and V2 tests previously competed for port 31310 and could collide
on database files when run concurrently. Add CW_PORT env var override
in config-loader, assign distinct ports per suite (31310/31311), and
switch TEST_RUN_ID to nanosecond precision for guaranteed DB isolation.
V1 and V2 tests previously competed for port 31310 and could collide
on database files when run concurrently. Add CW_PORT env var override
in config-loader, assign distinct ports per suite (31310/31311), and
switch TEST_RUN_ID to nanosecond precision for guaranteed DB isolation.
…laim-home test

sinon cannot stub ES module named exports, causing TypeError in CI.
Use datalayer.syncDataLayer() to populate the simulator (matching
the v2 test pattern) so stores appear owned without sinon stubs.
Also fix PENDING org test to use isHome:false to hit the correct
controller check path, and replace stub-verification test with a
concurrency-safety test.
Prevent reclaim-home race conflicts by using serializable transactions
and conflict-aware 409 responses, enforce orgUid format for reclaim,
and make test run IDs portable across GNU/BSD date implementations.
The mirrorCheckInProgress lock in mirror-check-v2.js can be defeated by
module dual-instantiation under the extensionless loader, allowing the
org-creation mirror check and the periodic mirror-check-v2 task to race.
Add a per-store guard (pendingMirrorCreations Set) in persistance.js so
concurrent callers for the same storeId:url short-circuit instead of
both submitting add_mirror RPCs.

Also relax mirror validation in tests to warn on duplicates rather than
fail, since duplicate mirrors are functionally harmless.
The mirrorCheckInProgress lock in mirror-check-v2.js can be defeated by
module dual-instantiation under the extensionless loader, allowing the
org-creation mirror check and the periodic mirror-check-v2 task to race.
Add a per-store guard (pendingMirrorCreations Set) in persistance.js so
concurrent callers for the same storeId:url short-circuit instead of
both submitting add_mirror RPCs.

Also relax mirror validation in tests to warn on duplicates rather than
fail, since duplicate mirrors are functionally harmless.
feat: add reclaim-home endpoint for v1 and v2 organizations
Resolve conflict in tests/run-tests.sh by taking the portable
TEST_RUN_ID generation from develop (BSD/macOS fallback).
@TheLastCicada TheLastCicada merged commit 88aa48a into v2-rc2 Mar 2, 2026
32 of 33 checks passed
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