Skip to content

ci(hosting): fix broken deploy workflow (no build script, missing tests)#2

Open
DDancingDeath wants to merge 1 commit into
mainfrom
fix/ci-no-build-script
Open

ci(hosting): fix broken deploy workflow (no build script, missing tests)#2
DDancingDeath wants to merge 1 commit into
mainfrom
fix/ci-no-build-script

Conversation

@DDancingDeath

Copy link
Copy Markdown
Owner

The auto-generated firebase-hosting-merge.yml ran npm ci && npm run build but this repo has no build script. Replaces with npm ci --legacy-peer-deps + npm test + Node 20 pin. Same fix for the PR preview workflow.

Safe to merge - only touches CI YAML, doesn't change app code or rules.

The auto-generated firebase-hosting-merge.yml ran
pm ci && npm run build
but this repo has no �uild script in package.json (it ships static
www/ files directly). Every push to main therefore failed at the
build step and the prod site has not been redeployed by CI for some
time.

Changes:
- Replace
pm ci && npm run build with
pm ci --legacy-peer-deps.
  --legacy-peer-deps is required because canvas@^3 has unresolvable
  peer deps (canvas is a leftover dep, not actually used by the app).
- Add a
pm test step before deploy. Today the suite is 100+ tests;
  this prevents pushing a redbar to prod.
- Pin Node 20 explicitly via actions/setup-node so we don't drift
  with the runner default.
- Same fix applied to firebase-hosting-pull-request.yml so PR
  preview channels also work.

This is the "fix prod CI" PR planned in the staging clone's
docs/PROMOTION.md and tracked as todo p5-first-pr-fix-prod-ci.
The change is intentionally tiny and self-contained so it's safe
to land first, before any of the larger walkthrough fixes from
the staging clone are cherry-picked over.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 6e27351):

https://aadhat-management--pr2-fix-ci-no-build-scri-16ignpz9.web.app

(expires Sat, 16 May 2026 10:48:40 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 5ce8f7fac8c1342e16024f8a7cbe810820e89324

DDancingDeath pushed a commit that referenced this pull request Jun 6, 2026
…rphan visibility

The stocks page was showing inflated quantities for items whose legacy sale
records had a slightly-different-cased name (or stale itemId) than the
canonical catalogue entry. Three independent bugs were collaborating to
hide the discrepancy:

  1. calculateStock applied stock adjustments in storage order (DESC by
     date) instead of chronological order, so a 'set' adjustment used a
     stale snapshot of stock and silently overwrote every event recorded
     after it. Refactored to a single chronological event timeline that
     replays purchases, sales and adjustments in real time order. A 'set'
     adjustment now uses adj.quantity (the user-entered target) rather
     than the stale adj.newStock snapshot.

  2. getItemKey did a case-sensitive name fallback for records without
     itemId, so a sale saved as 'Piyar Dana' produced a different bucket
     from a purchase saved as 'piyar dana'. Normalised with trim() +
     toLowerCase() and added an itemId-fallthrough so stale itemIds also
     resolve to the right bucket.

  3. renderStock then silently dropped any bucket that had no catalogue
     match (if (!item) return;). Orphans are now rendered as red/orange
     'Unmatched' warning rows so data-integrity issues are visible
     instead of hidden, and console.warn lists the orphan keys.

Also adds a debugItemForName helper (window.debugItem) that dumps the
full event timeline for a named item from the DevTools console — used
during diagnosis.

Tests: 114/114 passing (was 112) — 11 chronological-replay tests in
calculateStock.test.js cover bug fixes #1, #2 (case insensitivity for
both name and hindiName), and the on-demand sale-bucket creation that
prevents the silent-drop bug #3.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants