Architecture العربية

Qwizin — Quality Attribute Scenarios

Status: Draft v0.1 · Date: 2026-07-20 Input: 00-requirements-baseline.md · Method: six-part scenario form (source, stimulus, artifact, environment, response, response measure)


Summary#

The source documents state quality goals only as adjectives: "secure", "scalable", "easy to use", "stable video calls". None are measurable, so none can drive or falsify a design decision. This document converts them into 21 testable scenarios.

The headline finding is that Qwizin's dominant quality attributes are not the ones the documents emphasise. The documents stress cost and usability. The architecture is actually dominated by:

  1. Confidentiality & tenant isolation — the platform holds commercial registrations, tax cards, and one employer's records about their employees. A cross-tenant leak is an existential, PDPL-reportable event. This outranks everything.
  2. Integrity of assessment and certification — certificates assert food-safety competence. A forgeable or tamperable certificate transfers real-world risk to restaurant patrons and destroys the platform's core value claim. This is a safety-adjacent concern that no source document treats as one.
  3. Modifiability at the Phase-2 seamsCONF-04 commits to a Phase-2 scope several times the MVP. The cost of getting boundaries wrong is a rewrite.

Availability and raw performance, by contrast, are moderate requirements. This is a scheduled-appointment, document-download, and read-heavy directory system — not a payments switch or a real-time trading platform. Over-engineering availability at the expense of the three attributes above would be the classic mistake here.


Priority Method#

Each scenario carries an ATAM-style (Business Value, Architectural Impact) pair, each H/M/L.

  • (H,H) — must be designed for explicitly and verified. These drive the architecture.
  • (H,L) — important but achievable with conventional practice; do not over-invest.
  • (L,H) — architecturally expensive for limited value; candidate for deliberate deferral.

1. Security — Confidentiality & Tenant Isolation#

QAS-SEC-01 — Cross-tenant data isolation (H,H)Top priority#

Source Authenticated Company A administrator or employee
Stimulus Requests a resource (employee record, assessment result, certificate, document) belonging to Company B — by direct object reference, enumerated ID, or manipulated filter parameter
Artifact API authorization layer + data access layer
Environment Normal operation
Response Request denied; no data or existence-confirming metadata returned; event written to the security audit log
Measure Zero successful cross-tenant reads. Enforced by a default-deny tenant scope applied at the persistence layer, not by per-endpoint checks. Verified by an automated test suite that attempts cross-tenant access on 100 % of tenant-scoped endpoints in CI.

Rationale: the single most likely catastrophic defect in a multi-tenant Laravel application is a query that forgot its tenant scope. Per-endpoint authorization checks fail because they rely on developer discipline at every new endpoint forever. The measure deliberately mandates an enforcement mechanism, not an outcome, because only the mechanism is testable in advance.

Source Unauthenticated attacker, or authenticated user without entitlement
Stimulus Attempts to retrieve an uploaded commercial registration or tax card via guessed/leaked URL, or after their access entitlement was revoked
Artifact Object storage + document access service
Environment Normal operation
Response Access denied; document never served from a publicly reachable, permanently valid URL
Measure Documents are never publicly readable. Access is via short-lived signed URLs (≤ 5 min TTL) issued only after authorization. Documents are encrypted at rest. No document URL remains valid after entitlement revocation beyond the TTL window. Objects are stored on a domain separate from the application.

QAS-SEC-03 — Malicious file upload (H,M)#

Source Registering company or service provider (potentially malicious)
Stimulus Uploads a file that is malware, a polyglot, or an executable disguised as a PDF/image
Artifact Upload pipeline
Environment Normal operation
Response File quarantined pending scan; never executed; never served inline from an application-trusted origin; admin reviewer is not exposed to it until scanned clean
Measure 100 % of uploads scanned before entering the admin review queue. Content-type validated by magic-byte inspection, not extension or client-declared MIME. Files served with Content-Disposition: attachment and a restrictive CSP. Scan completes within 60 s p95; upload is accepted asynchronously so the user is not blocked.

QAS-SEC-04 — Credential compromise blast radius (H,M)#

Source Attacker with a stolen mobile refresh token
Stimulus Attempts to use the token after the legitimate user has changed password or the session was revoked
Artifact Token/session management
Environment Post-compromise
Response Token rejected; entire token family invalidated; user notified
Measure Refresh-token rotation with reuse detection — replay of a consumed refresh token invalidates the whole family within ≤ 1 s. Password change revokes all sessions. Admin accounts require MFA. Access-token TTL ≤ 15 min.

2. Integrity — Assessment & Certification#

QAS-INT-01 — Assessment answer-key confidentiality (H,H)#

Source Employee taking an MCQ assessment
Stimulus Inspects API responses, app bundle, or network traffic to discover correct answers
Artifact Assessment delivery API
Environment Active assessment attempt
Response Correct answers are not present in any client-reachable payload at any point before submission
Measure Zero correct-answer indicators in assessment-delivery responses. Grading is server-side only. Verified by an automated contract test asserting the absence of answer-key fields in the delivery schema.

Rationale: the naive implementation ships the whole question object — including is_correct — to the client and grades locally. SRC-MOM REQ-05 says "automatic instant grading", which invites exactly this. Because certificates carry external weight, this is an integrity control, not a nicety.

QAS-INT-02 — Score tampering (H,M)#

Source Employee, or a company administrator wanting staff to appear compliant
Stimulus Submits a forged score, replays a passing submission, or retries an attempt until passing while presenting only the passing attempt
Artifact Assessment submission + attempt history
Environment Normal operation
Response Score derived solely server-side from submitted answers; every attempt persisted immutably; certificate issued only from a server-computed passing attempt
Measure Client-submitted scores are never trusted. All attempts recorded with timestamps and retained — attempt history is append-only. Certificate issuance is transactionally bound to a specific attempt ID.

QAS-INT-03 — Certificate authenticity (H,M)#

Source Third party — a municipal inspector, SFDA auditor, or prospective employer
Stimulus Presented with a Qwizin PDF certificate and needs to determine whether it is genuine and current
Artifact Certificate generation + public verification endpoint
Environment Offline document presented in the physical world
Response Certificate carries a verifiable identifier resolving to authoritative, current status
Measure Each certificate embeds a QR code → public verification URL returning holder name, competency, issue date, and current validity (accounting for revocation and company suspension per OQ-07). Certificate identifiers are non-sequential and unguessable. Verification endpoint available 99.5 % and answers in < 1 s p95.

Depends on OQ-09. If verification is ruled out of scope, this scenario drops to (M,L) — but the architect should note that an unverifiable food-safety certificate is trivially forged in a graphics editor, which undermines SRC-MOM KPI 3 and the platform's credibility claim.


3. Availability#

Deliberate position: Qwizin does not need four-nines. It needs predictable availability concentrated in KSA business hours, and it needs booked consultations not to fail. Availability investment should be asymmetric.

QAS-AVL-01 — Video consultation at appointment time (H,H)#

Source Customer and consultant with a confirmed, paid appointment
Stimulus Both join at the scheduled time
Artifact Video session service + provider integration
Environment Peak load, KSA business hours
Response Both connect and hold a stable session for its duration
Measure ≥ 99 % of scheduled consultations connect successfully within 30 s of both parties joining. Session drop rate < 2 %. On failure, an automatic remediation path exists (rejoin, reschedule, or refund per CONF-02 policy). Degradation to audio-only is preferred over session failure.

This is the highest-value availability scenario because a failure is simultaneously a refund event, a reputational event, and a two-sided marketplace failure — it burns the consultant's time slot as well as the customer's money.

QAS-AVL-02 — Core platform availability (H,M)#

Source Any user
Stimulus Uses browse/search/download/booking features
Artifact API + web tier
Environment Normal operation
Response Service available
Measure 99.5 % monthly availability measured against KSA business hours (Sun–Thu 08:00–20:00 AST) as the primary SLO, 99.0 % overall. Planned maintenance outside this window.

QAS-AVL-03 — Payment provider outage (H,M)#

Source Upstream payment gateway
Stimulus Becomes unavailable or times out mid-transaction
Artifact MOD-PAY + payment port
Environment Degraded external dependency
Response No double charge; no orphaned booking; user receives an unambiguous outcome
Measure All payment operations idempotent by client-supplied key. Reconciliation job resolves indeterminate transactions within 15 min. Zero double charges. Booking is never confirmed without a confirmed payment state, and never left indefinitely pending — it expires with an explicit outcome.

QAS-AVL-04 — Graceful degradation of non-critical modules (M,M)#

Source Internal component failure (search engine, notification service, PDF worker)
Stimulus Component becomes unavailable
Artifact Module boundaries
Environment Partial failure
Response Core flows (login, booking, learning, template download) continue
Measure Search failure → degraded database-backed listing, not an error page. Notification failure → queued for retry, never blocks the originating transaction. PDF worker failure → certificate marked pending and generated on recovery, assessment result is never lost. No non-critical dependency is in the synchronous path of a critical flow.

4. Performance & Scalability#

QAS-PERF-01 — Mobile API responsiveness on KSA mobile networks (H,M)#

Source Mobile user on 4G
Stimulus Opens marketplace directory or template catalogue
Artifact API + search + CDN
Environment Normal load, in-Kingdom
Response Content rendered
Measure API p95 < 300 ms, p99 < 800 ms server-side, measured in-region. First meaningful content < 2 s on 4G. Payloads paginated; list responses < 100 KB.

QAS-PERF-02 — Arabic-language marketplace search (H,H)#

Source Restaurant owner searching in Arabic
Stimulus Searches for a supplier using Arabic terms — with inconsistent orthography (أ/ا/إ, ة/ه, ى/ي), with or without diacritics, and with morphological variation
Artifact Search engine + indexing pipeline
Environment Normal operation
Response Relevant providers returned regardless of orthographic variation; Featured subscribers ranked above equivalent-relevance non-featured (REQ-06)
Measure Search p95 < 200 ms. Arabic normalisation (alef/teh-marbuta/yeh folding, diacritic stripping) and stemming applied. Featured boost is a ranking multiplier that cannot promote an irrelevant result above a relevant one. Relevance validated against a curated Arabic query set.

Called out as (H,H) deliberately. Arabic search quality is where naive stacks fail badly, and it is not a cosmetic issue — a Saudi user who searches in Arabic and gets nothing concludes the directory is empty. Generic full-text search on Arabic without normalisation produces near-zero recall. This constrains the search-engine choice and is the subject of dedicated research.

QAS-SCL-01 — Growth to target scale (H,H)#

Source Business growth
Stimulus Accounts grow from ~0 to tens of thousands over 12–18 months; concurrent video sessions from ~0 to hundreds
Artifact Whole system
Environment Sustained growth
Response Capacity added without architectural change
Measure Stateless API tier scales horizontally; adding capacity requires no code change. Autoscaling responds to sustained load within 3 min. Database has a defined scale path (read replicas → partitioning) with documented trigger thresholds. No component requires a redesign below 50 000 accounts.

QAS-SCL-02 — Video capacity elasticity (H,H)#

Source Booking pattern concentration
Stimulus Consultations cluster into business-hour peaks; concurrent sessions spike well above mean
Artifact Video infrastructure
Environment Peak
Response Capacity available at peak without paying for it off-peak
Measure Video capacity scales on a session/stress-based signal, not CPU. Peak:mean ratio assumed ≥ 5:1 given business-hour clustering. Cost scales sub-linearly with peak. Scale-up completes before the booked appointment window — this is predictable demand and should be scheduled from the booking calendar, not reactive.

The last sentence is an architectural insight worth preserving: unlike most systems, Qwizin knows its future load in advance because sessions are booked. Predictive scaling from the appointment calendar is strictly better than reactive autoscaling here.

QAS-SCL-03 — Certificate/PDF generation burst (M,M)#

Source Company administrator
Stimulus Assigns training to 500 employees who complete assessments in a compressed window
Artifact Async worker tier
Environment Burst
Response All certificates generated; interactive traffic unaffected
Measure Generation is asynchronous. Queue depth triggers worker autoscaling. p95 certificate availability < 2 min after passing. Burst does not degrade QAS-PERF-01.

5. Modifiability#

QAS-MOD-01 — Payment provider replacement (H,H)#

Source Business — gateway undecided (OQ-01), and licensing may force a change (OQ-10)
Stimulus Payment provider must be replaced or a second added
Artifact MOD-PAY + payment port (SEAM-01)
Environment Design/build time
Response Swap confined to an adapter
Measure Changes confined to one adapter package; zero changes in other modules. No provider-specific type, field, or webhook shape appears outside the adapter. New adapter implementable in ≤ 5 person-days.

This scenario is elevated to (H,H) because the decision is deliberately deferred. Deferring a decision is only safe if the architecture makes it cheap to make later — that is the whole justification for the port.

QAS-MOD-02 — Video provider replacement (H,H)#

Source Cost crossover, residency requirement, or provider EOL
Stimulus Video provider must be replaced
Artifact MOD-VID + video port (SEAM-02)
Environment Design/build time
Response Swap confined to an adapter
Measure Room lifecycle, token issuance, participant events, and recording expressed as provider-neutral domain concepts. Adapter replaceable in ≤ 10 person-days. Booking, payment, and notification modules unaware of the provider.

QAS-MOD-03 — Phase-2 module extraction (H,H)#

Source Phase-2 roadmap (CONF-04)
Stimulus A module (e.g. MOD-LRN growing into a full LMS, or MOD-MKT into procurement) must become an independently deployable service
Artifact Module boundaries + inter-module communication
Environment Post-MVP evolution
Response Extraction without redesigning the remaining system
Measure No cross-module database foreign keys. No cross-module ORM relationship traversal. Inter-module calls go through published contracts; inter-module events go through a bus swappable from in-process to broker without changing publisher or subscriber code. Extraction of one module ≤ 20 person-days. Enforced continuously by static analysis in CI — not by review discipline.

The CI-enforcement clause is the entire point. Modular monoliths fail not because the boundaries were drawn wrong, but because nothing stopped them eroding. A boundary that is not machine-checked is a comment.

QAS-MOD-04 — Adding a template as a structured instrument (M,H)#

Source Product evolution (SEAM-03)
Stimulus A downloadable audit checklist must become a fillable in-app instrument with submissions and scoring
Artifact MOD-TPL data model
Environment Post-MVP
Response Additive change
Measure Template metadata modelled as structured entities with typed sections and items from day one, even though MVP only serves a file. Adding response capture requires no migration of existing template records.

(M,H) — modest MVP value, high architectural leverage. The cost today is small (a richer schema behind an unchanged API); the cost of retrofitting later is a full remodelling of the module.


6. Compliance, Localization, Operability#

QAS-CMP-01 — Data subject rights request (H,M)#

Source Data subject exercising PDPL rights
Stimulus Requests access to, correction of, or deletion of their personal data
Artifact Whole system
Environment Normal operation
Response Complete data set located, exported, or erased across all stores
Measure All personal data locatable by subject identifier across primary DB, object storage, search index, logs, analytics, and backups. Export produced within the statutory deadline. Deletion honours legal-retention conflicts (financial records, issued certificates) via documented, defensible exceptions rather than silent non-deletion.

The hard part is not deletion — it is enumeration. A personal-data inventory must be maintained as a first-class artifact, or this scenario becomes unsatisfiable once data has spread into a search index and a log pipeline.

QAS-CMP-02 — Audit trail for approval decisions (H,L)#

Source Rejected company disputing a decision, or a regulator
Stimulus Requests the history of an approval decision
Artifact Audit log
Environment Post-hoc
Response Complete, tamper-evident history
Measure Every approval state transition records actor, timestamp, prior/new state, and reason. Audit records append-only. Retained ≥ 7 years (financial-record alignment). Documents referenced by immutable version, so a resubmission never overwrites the evidence a decision was based on.

QAS-LOC-01 — Arabic/RTL correctness in generated artifacts (H,M)#

Source Arabic-speaking user
Stimulus Downloads a generated PDF certificate containing their Arabic name
Artifact PDF generation pipeline
Environment Normal operation
Response Arabic renders correctly
Measure Correct glyph shaping (contextual joining), correct bidirectional layout, correct RTL alignment, embedded Arabic fonts. Verified by golden-image tests over a fixture set of Arabic names including mixed Arabic/Latin strings and Arabic-Indic digits.

This eliminates several common PHP PDF libraries outright. It is a genuine constraint on technology choice, not a rendering detail — a certificate with disconnected, reversed Arabic letters is unusable and visibly amateur to every Saudi user.

QAS-LOC-02 — GCC expansion (M,M)#

Source Business expansion (CON-12)
Stimulus Platform launches in a second GCC country with distinct currency, legal-document types, tax rules, and residency regime
Artifact Whole system
Environment Post-MVP
Response Expansion without redesign
Measure Country is an explicit first-class dimension on tenants, documents, pricing, and tax from day one — not hardcoded to KSA. Required-document sets, currency, and tax rules are configuration, not code. Adding a country requires no schema migration.

QAS-OPS-01 — Operability by a small team (H,H)#

Source Operations reality under CON-01
Stimulus A production incident occurs at 02:00
Artifact Observability + deployment tooling
Environment Incident
Response On-call engineer diagnoses and mitigates without deep tribal knowledge
Measure Every request carries a correlation ID traversing API, queue workers, and external calls. Time-to-detect < 5 min via alerting on user-facing SLOs (not CPU graphs). Rollback of any deployment in < 10 min, single command. Runbooks exist for the top 10 predicted failure modes.

(H,H) and non-negotiable. CON-15 (Kubernetes) raises the operational floor. Choosing Kubernetes without a matching investment in observability and automation converts an infrastructure choice into a permanent operational tax on a small team — that trade-off must be paid deliberately, not discovered later.

QAS-OPS-02 — Cost efficiency at low utilisation (H,M)#

Source CON-01 budget sensitivity
Stimulus Platform runs at low utilisation during the months after launch
Artifact Infrastructure
Environment Early production
Response Infrastructure cost proportionate to actual usage
Measure Baseline monthly infrastructure cost at launch scale within an agreed ceiling (to be set by the capacity/cost model). Video capacity — the dominant variable cost — scales to near zero when idle. No always-on component sized for peak.

Evidence vs Assumptions#

Evidence (traceable to source documents):

  • Approval-gated onboarding, six actor types, module capabilities — SRC-BRD
  • MCQ auto-grading + automatic PDF certificate — SRC-MOM REQ-05
  • Featured listings rank above standard — SRC-MOM REQ-06
  • "Stable video call start to finish" — SRC-MOM REQ-03
  • Security of uploaded legal documents — SRC-MOM NFR-1
  • Low cost / open-source preference — SRC-BRD §12, SRC-MOM NFR-3
  • GCC scalability without redesign — SRC-BRD §3.7

Assumptions (mine — require confirmation):

Assumption Basis If wrong
Availability SLO 99.5 % business-hours is adequate No SLO stated anywhere in the corpus Higher target changes DB HA topology and multi-AZ cost materially
Peak:mean video concurrency ≥ 5:1 Business-hour clustering of professional appointments Changes video capacity sizing and cost model
Certificates require third-party verifiability Inferred from food-safety context; unconfirmed (OQ-09) QAS-INT-03 drops to (M,L)
Consultations are not recorded in MVP Not mentioned in any source (OQ-08) Recording adds major storage, cost, consent, and PDPL scope
Content is bilingual Arabic/English KSA market + Arabic BRD exists (OQ-12) Arabic-only or English-only materially simplifies search and content modelling
~10 000 accounts / hundreds of concurrent sessions Architect-provided growth target Order-of-magnitude change invalidates the capacity model
No SAMA licensing obstacle to holding/disbursing funds Unverified — potential legal blocker (OQ-10) May force a different payment topology entirely

Risks & Trade-offs#

# Trade-off Position taken
1 Tenant isolation vs developer velocity Enforcement at the persistence layer adds friction and constrains query freedom. Accepted — QAS-SEC-01 is existential; velocity is not.
2 Kubernetes vs operability under CON-01 K8s (CON-15) conflicts with QAS-OPS-01 and QAS-OPS-02 for a small team. Accepted as an architect decision, but the observability and automation investment it forces is now a stated requirement, not an optional extra. Recorded as a risk in ADR-0003.
3 Modularity discipline vs MVP speed QAS-MOD-03's CI enforcement slows early development. Accepted — CONF-04's Phase-2 scope makes boundary erosion the highest-probability expensive failure.
4 Predictive video scaling vs complexity Calendar-driven scaling is more complex than reactive HPA but strictly better for booked load. Recommended, not mandated — quantify in the capacity model first.
5 Certificate verifiability vs MVP scope Adds a public endpoint and key management. Recommended despite being unrequested, because an unverifiable certificate undermines the platform's central value claim. Sponsor decision (OQ-09).
6 Structured template modelling vs YAGNI QAS-MOD-04 builds schema the MVP does not use. Justified by SEAM-03 — but this is the weakest of the anticipatory decisions and should be revisited if it complicates the MVP data model more than modestly.

Scenario Priority Summary#

Priority Scenarios
(H,H) — architecture-driving QAS-SEC-01, QAS-SEC-02, QAS-INT-01, QAS-AVL-01, QAS-PERF-02, QAS-SCL-01, QAS-SCL-02, QAS-MOD-01, QAS-MOD-02, QAS-MOD-03, QAS-OPS-01
(H,M)/(H,L) — important, conventional QAS-SEC-03, QAS-SEC-04, QAS-INT-02, QAS-INT-03, QAS-AVL-02, QAS-AVL-03, QAS-PERF-01, QAS-CMP-01, QAS-CMP-02, QAS-LOC-01, QAS-OPS-02
(M,*) — monitor QAS-AVL-04, QAS-SCL-03, QAS-MOD-04, QAS-LOC-02

  1. architecture-risk-assessor on the (H,H) set — particularly the Kubernetes/operability tension (#2) and the deferred payment decision (OQ-10).
  2. tradeoff-analysis-writer for the video build-vs-buy and search-engine decisions, once the research strands report.
  3. adr-writer for each decision already taken (hosting, style, orchestration, ports) so the rationale is captured while it is fresh.
Tech Lead · Amir Haroun Draft v0.1 · research & design only